aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Objects
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-01-24 12:22:12 -0500
committerMichael <[email protected]>2017-01-24 12:22:12 -0500
commit2d095dcf8d1839929e0fa2d12ca5c3f58a394764 (patch)
treea9e209aaa1faf871c1eda64876e1aa487b5309ae /ShiftOS.Objects
parent7a26ffc108b6941eff6d9683b1cfd4b91dbee59a (diff)
downloadshiftos_thereturn-2d095dcf8d1839929e0fa2d12ca5c3f58a394764.tar.gz
shiftos_thereturn-2d095dcf8d1839929e0fa2d12ca5c3f58a394764.tar.bz2
shiftos_thereturn-2d095dcf8d1839929e0fa2d12ca5c3f58a394764.zip
ShiftFS file structure changes
Files can now store header data in a separate byte[] array inside File.Header. You can use the Utils.Set/GetHeaderText/Data(path, data) methods to set the header of an existing file.
Diffstat (limited to 'ShiftOS.Objects')
-rw-r--r--ShiftOS.Objects/ShiftFS.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/ShiftOS.Objects/ShiftFS.cs b/ShiftOS.Objects/ShiftFS.cs
index fa7a9e6..e14c2a8 100644
--- a/ShiftOS.Objects/ShiftFS.cs
+++ b/ShiftOS.Objects/ShiftFS.cs
@@ -43,6 +43,7 @@ namespace ShiftOS.Objects.ShiftFS
{
public string Name;
public byte[] Data;
+ public byte[] HeaderData;
public bool ReadAccessToLowUsers;
public Permissions permissions;
public System.IO.Stream GetStream()
@@ -346,6 +347,27 @@ namespace ShiftOS.Objects.ShiftFS
}
+ public static byte[] GetHeaderData(string filePath)
+ {
+ return GetFileInfo(filePath).HeaderData;
+ }
+
+ public static string GetHeaderText(string filePath)
+ {
+ byte[] header = GetHeaderData(filePath);
+ return (header == null) ? "" : Encoding.UTF8.GetString(header);
+ }
+
+ public static void SetHeaderData(string filePath, byte[] data)
+ {
+ GetFileInfo(filePath).HeaderData = data;
+ }
+
+ public static void SetHeaderText(string filePath, string text)
+ {
+ SetHeaderData(filePath, Encoding.UTF8.GetBytes(text));
+ }
+
public static string[] GetDirectories(string path)
{
string[] pathlist = path.Split('/');