From 2d095dcf8d1839929e0fa2d12ca5c3f58a394764 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 24 Jan 2017 12:22:12 -0500 Subject: [PATCH] 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. --- ShiftOS.Objects/ShiftFS.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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('/');