Skip to content

Commit

Permalink
implement Delete on WadTreeItem
Browse files Browse the repository at this point in the history
  • Loading branch information
Crauzer committed Mar 29, 2023
1 parent ba67114 commit 8222980
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Obsidian/Data/Wad/IWadTreePathable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public interface IWadTreePathable
{
IWadTreePathable Parent { get; }
IWadTreeParent Parent { get; }
int Depth { get; }

string Name { get; }
Expand Down
2 changes: 1 addition & 1 deletion Obsidian/Data/Wad/WadTreeFileModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public sealed class WadTreeFileModel : WadTreeItemModel
public WadChunk Chunk { get; }
public WadFile Wad { get; }

public WadTreeFileModel(IWadTreePathable parent, string name, WadFile wad, WadChunk chunk)
public WadTreeFileModel(IWadTreeParent parent, string name, WadFile wad, WadChunk chunk)
: base(parent, name)
{
this.Chunk = chunk;
Expand Down
4 changes: 2 additions & 2 deletions Obsidian/Data/Wad/WadTreeItemModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class WadTreeItemModel
_ => throw new InvalidOperationException("Invalid wad tree item type")
};

public IWadTreePathable Parent { get; protected set; }
public IWadTreeParent Parent { get; protected set; }
public int Depth => this.GetDepth();

public Guid Id { get; } = Guid.NewGuid();
Expand Down Expand Up @@ -52,7 +52,7 @@ public bool IsWadArchive
}
}

public WadTreeItemModel(IWadTreePathable parent, string name)
public WadTreeItemModel(IWadTreeParent parent, string name)
{
this.Parent = parent;
this.Name = name;
Expand Down
2 changes: 1 addition & 1 deletion Obsidian/Data/Wad/WadTreeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class WadTreeModel : IWadTreeParent, IDisposable
public HashtableService Hashtable { get; }
public Config Config { get; }

public IWadTreePathable Parent => null;
public IWadTreeParent Parent => null;
public int Depth => 0;
public string Name => string.Empty;
public string Path => string.Empty;
Expand Down
6 changes: 5 additions & 1 deletion Obsidian/Shared/TreeWadItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,9 @@ private void Save()
}
}

private void Delete() { }
private void Delete()
{
this.Item.Parent.Items.Remove(this.Item.Name);
this.Explorer.RefreshState();
}
}

0 comments on commit 8222980

Please sign in to comment.