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.
This commit is contained in:
Michael 2017-01-24 12:22:12 -05:00
parent 7a26ffc108
commit 2d095dcf8d

View file

@ -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('/');