diff --git a/LANCommander/Components/FileManagerComponents/FileManager.razor b/LANCommander/Components/FileManagerComponents/FileManager.razor
index 7d73c23..1eb9933 100644
--- a/LANCommander/Components/FileManagerComponents/FileManager.razor
+++ b/LANCommander/Components/FileManagerComponents/FileManager.razor
@@ -1,5 +1,6 @@
@using AntDesign.TableModels;
@inject ArchiveService ArchiveService
+@inject IMessageService MessageService
@@ -21,7 +22,7 @@
-
+
@@ -34,7 +35,7 @@
-
+
@@ -44,7 +45,7 @@
-
+
@@ -109,6 +110,8 @@
+
+
@code {
[Parameter] public Guid ArchiveId { get; set; }
[Parameter] public string WorkingDirectory { get; set; }
@@ -125,6 +128,8 @@
List Entries { get; set; } = new List();
HashSet Directories { get; set; } = new HashSet();
+ NewFolderModal NewFolderModal;
+
Dictionary OnRow(RowData row) => new()
{
["data-path"] = row.Data.Path,
@@ -313,8 +318,47 @@
ChangeDirectory(Path.Parent, true);
}
- void NewFolder()
+ void Refresh()
{
-
+ ChangeDirectory(Path, false);
+ }
+
+ void AddFolder(string name)
+ {
+ try
+ {
+ Directory.CreateDirectory(System.IO.Path.Combine(Path.Path, name));
+
+ Refresh();
+
+ MessageService.Success("Folder created!");
+ }
+ catch
+ {
+ MessageService.Error("Error creating folder!");
+ }
+ }
+
+ void Delete()
+ {
+ try
+ {
+ foreach (var entry in Selected)
+ {
+ if (entry is FileManagerDirectory)
+ Directory.Delete(entry.Path);
+ else if (entry is FileManagerFile)
+ File.Delete(entry.Path);
+ }
+
+ Selected = new List();
+ MessageService.Success("Deleted!");
+ }
+ catch
+ {
+ MessageService.Error("Error deleting!");
+ }
+
+ Refresh();
}
}
diff --git a/LANCommander/Components/FileManagerComponents/NewFolderModal.razor b/LANCommander/Components/FileManagerComponents/NewFolderModal.razor
new file mode 100644
index 0000000..5df4468
--- /dev/null
+++ b/LANCommander/Components/FileManagerComponents/NewFolderModal.razor
@@ -0,0 +1,34 @@
+
+
+
+
+@code {
+ [Parameter] public EventCallback OnFolderNameEntered { get; set; }
+
+ bool Visible { get; set; } = false;
+ string Name { get; set; }
+
+ protected override async Task OnInitializedAsync()
+ {
+ Name = "";
+ }
+
+ public void Open()
+ {
+ Name = "";
+ Visible = true;
+ }
+
+ public void Close()
+ {
+ Visible = false;
+ }
+
+ async Task OnOk(MouseEventArgs e)
+ {
+ if (OnFolderNameEntered.HasDelegate)
+ await OnFolderNameEntered.InvokeAsync(Name);
+
+ Close();
+ }
+}