Fix LockSystemProfiles

This commit is contained in:
Ben Olden-Cooligan 2024-02-17 20:53:01 -08:00
parent 05b56cdc0a
commit 87762c82aa
3 changed files with 9 additions and 2 deletions

View File

@ -104,4 +104,6 @@ public class ProfileManagerTests : ContextualTests
Assert.Equal(2, profiles[0].Version);
Assert.Equal(1, profiles[0].UpgradedFrom);
}
// TODO: Add tests for LockSystemProfiles etc
}

View File

@ -151,7 +151,7 @@ public class ProfileManager : IProfileManager
}
var systemProfileNames = new HashSet<string>(systemProfiles.Select(x => x.DisplayName));
foreach (var profile in userProfiles)
foreach (var profile in userProfiles.ToList())
{
if (systemProfileNames.Contains(profile.DisplayName))
{

View File

@ -31,7 +31,12 @@ public class ScanProfile
public ScanProfile Clone()
{
// Easy deep copy. Ideally we'd do this in a more efficient way.
return this.ToXml().FromXml<ScanProfile>();
var copy = this.ToXml().FromXml<ScanProfile>();
// Copy XmlIgnore properties
copy.UpgradedFrom = UpgradedFrom;
copy.IsLocked = IsLocked;
copy.IsDeviceLocked = IsDeviceLocked;
return copy;
}
public override string ToString() => DisplayName;