From db563c54aedf5e9d96ca70eec08c560ccbc42d8d Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 21 Apr 2017 18:53:41 -0400 Subject: Add ShiftOS->Host Shared Persistence ShiftOS can now write to the shared folder when saving files/deleting files to the 1:/ drive. --- ShiftOS.Objects/ShiftFS.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'ShiftOS.Objects/ShiftFS.cs') diff --git a/ShiftOS.Objects/ShiftFS.cs b/ShiftOS.Objects/ShiftFS.cs index 2c6b28b..d35e5b7 100644 --- a/ShiftOS.Objects/ShiftFS.cs +++ b/ShiftOS.Objects/ShiftFS.cs @@ -173,6 +173,11 @@ namespace ShiftOS.Objects.ShiftFS t.Start(); } + public static event Action DirectoryCreated; + public static event Action DirectoryDeleted; + public static event Action FileWritten; + public static event Action FileDeleted; + public static void CreateDirectory(string path) { @@ -190,6 +195,7 @@ namespace ShiftOS.Objects.ShiftFS Name = pathlist[pathlist.Length - 1], permissions = CurrentUser, }); + DirectoryCreated?.Invoke(path); } else { @@ -231,7 +237,7 @@ namespace ShiftOS.Objects.ShiftFS var f = dir.FindFileByName(pathlist[pathlist.Length - 1]); f.Data = Encoding.UTF8.GetBytes(contents); } - + FileWritten?.Invoke(path); } @@ -248,10 +254,12 @@ namespace ShiftOS.Objects.ShiftFS if (FileExists(path)) { dir.RemoveFile(pathlist[pathlist.Length - 1]); + FileDeleted?.Invoke(path); } else { dir.RemoveDirectory(pathlist[pathlist.Length - 1]); + DirectoryDeleted?.Invoke(path); } } @@ -276,7 +284,7 @@ namespace ShiftOS.Objects.ShiftFS var f = dir.FindFileByName(pathlist[pathlist.Length - 1]); f.Data = contents; } - + FileWritten?.Invoke(path); } -- cgit v1.2.3