Updated to Risa's changes

This commit is contained in:
2025-08-10 12:48:02 +03:00
parent 0a0ae4bee9
commit 9730de1ba4
59 changed files with 302 additions and 2810 deletions

View File

@@ -46,15 +46,6 @@ public class ProfileFileSystem : FileSystem<Profile>, IDisposable, ISavable
_profileChanged.Unsubscribe(OnProfileChange);
}
// Search the entire filesystem for the leaf corresponding to a profile.
public bool FindLeaf(Profile profile, [NotNullWhen(true)] out Leaf? leaf)
{
leaf = Root.GetAllDescendants(ISortMode<Profile>.Lexicographical)
.OfType<Leaf>()
.FirstOrDefault(l => l.Value == profile);
return leaf != null;
}
private void OnProfileChange(ProfileChanged.Type type, Profile? profile, object? data)
{
switch (type)
@@ -75,14 +66,14 @@ public class ProfileFileSystem : FileSystem<Profile>, IDisposable, ISavable
return;
case ProfileChanged.Type.Deleted:
if (FindLeaf(profile, out var leaf1))
if (TryGetValue(profile, out var leaf1))
Delete(leaf1);
return;
case ProfileChanged.Type.ReloadedAll:
Reload();
return;
case ProfileChanged.Type.Renamed when data is string oldName:
if (!FindLeaf(profile, out var leaf2))
if (!TryGetValue(profile, out var leaf2))
return;
var old = oldName.FixName();