mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
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:
parent
7a26ffc108
commit
2d095dcf8d
1 changed files with 22 additions and 0 deletions
|
@ -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('/');
|
||||
|
|
Loading…
Reference in a new issue