aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Objects/ShiftFS.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-21 18:53:41 -0400
committerMichael <[email protected]>2017-04-21 18:53:41 -0400
commitdb563c54aedf5e9d96ca70eec08c560ccbc42d8d (patch)
tree4f8b3ba5bb54ee68e217705876e2288075c1026f /ShiftOS.Objects/ShiftFS.cs
parent25f83c8f191c0e451e2fc88b193d158517396f31 (diff)
downloadshiftos_thereturn-db563c54aedf5e9d96ca70eec08c560ccbc42d8d.tar.gz
shiftos_thereturn-db563c54aedf5e9d96ca70eec08c560ccbc42d8d.tar.bz2
shiftos_thereturn-db563c54aedf5e9d96ca70eec08c560ccbc42d8d.zip
Add ShiftOS->Host Shared Persistence
ShiftOS can now write to the shared folder when saving files/deleting files to the 1:/ drive.
Diffstat (limited to 'ShiftOS.Objects/ShiftFS.cs')
-rw-r--r--ShiftOS.Objects/ShiftFS.cs12
1 files changed, 10 insertions, 2 deletions
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<string> DirectoryCreated;
+ public static event Action<string> DirectoryDeleted;
+ public static event Action<string> FileWritten;
+ public static event Action<string> 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);
}