From e929a9f5105c00b0a3a2b4e75a876bbb95bbfa7b Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 13 Jul 2017 21:30:04 -0400 Subject: Delete a LOT of obsolete code --- ShiftOS.Objects/ShiftFS.cs | 72 +++++++++++++--------------------------------- 1 file changed, 20 insertions(+), 52 deletions(-) (limited to 'ShiftOS.Objects/ShiftFS.cs') diff --git a/ShiftOS.Objects/ShiftFS.cs b/ShiftOS.Objects/ShiftFS.cs index bc08880..a54fae9 100644 --- a/ShiftOS.Objects/ShiftFS.cs +++ b/ShiftOS.Objects/ShiftFS.cs @@ -38,25 +38,15 @@ namespace ShiftOS.Objects.ShiftFS public byte[] Data; public byte[] HeaderData; public bool ReadAccessToLowUsers; - public UserPermissions permissions; public System.IO.Stream GetStream() { - if ((int)CurrentUser <= (int)permissions) - { - return new System.IO.MemoryStream(Data); - } - else if (ReadAccessToLowUsers == true) - { - return new System.IO.MemoryStream(Data, false); - } - return null; + return new System.IO.MemoryStream(Data); } - public File(string name, byte[] data, bool ReadAccess_to_low_users, UserPermissions perm) + public File(string name, byte[] data, bool ReadAccess_to_low_users) { Name = name; Data = data; - permissions = perm; ReadAccessToLowUsers = ReadAccess_to_low_users; } } @@ -66,71 +56,49 @@ namespace ShiftOS.Objects.ShiftFS public List Files = new List(); public List Subdirectories = new List(); public bool ReadAccessToLowUsers; - public UserPermissions permissions; public void AddFile(File file) { - if ((int)CurrentUser <= (int)permissions) - { - Files.Add(file); - } + Files.Add(file); } + public void RemoveFile(string name) { - if ((int)CurrentUser <= (int)permissions) - { - Files.Remove(Files.Find(x => x.Name == name)); - } + Files.Remove(Files.Find(x => x.Name == name)); } + public void RemoveFile(File file) { - if ((int)CurrentUser <= (int)permissions) - { - Files.Remove(file); - } + Files.Remove(file); } + public File FindFileByName(string name) { - if ((int)CurrentUser <= (int)permissions) - { - return Files.Find(x => x.Name == name); - } - return null; + return Files.Find(x => x.Name == name); } + public void AddDirectory(Directory dir) { - if ((int)CurrentUser <= (int)permissions) - { - Subdirectories.Add(dir); - } + Subdirectories.Add(dir); } + public void RemoveDirectory(string name) { - if ((int)CurrentUser <= (int)permissions) - { - Subdirectories.Remove(Subdirectories.Find(x => x.Name == name)); - } + Subdirectories.Remove(Subdirectories.Find(x => x.Name == name)); } + public void RemoveDirectory(Directory dir) { - if ((int)CurrentUser <= (int)permissions) - { - Subdirectories.Remove(dir); - } + Subdirectories.Remove(dir); } + public Directory FindDirectoryByName(string name) { - if ((int)CurrentUser <= (int)permissions) - { - return Subdirectories.Find(x => x.Name == name); - } - return null; + return Subdirectories.Find(x => x.Name == name); } } public static class Utils { - public static UserPermissions CurrentUser { get; set; } - public static List Mounts { get; set; } static Utils() @@ -186,7 +154,7 @@ namespace ShiftOS.Objects.ShiftFS dir.AddDirectory(new Directory { Name = pathlist[pathlist.Length - 1], - permissions = CurrentUser, + }); DirectoryCreated?.Invoke(path); } @@ -225,7 +193,7 @@ namespace ShiftOS.Objects.ShiftFS { try { - dir.AddFile(new File(pathlist[pathlist.Length - 1], Encoding.UTF8.GetBytes(contents), false, CurrentUser)); + dir.AddFile(new File(pathlist[pathlist.Length - 1], Encoding.UTF8.GetBytes(contents), false)); } catch { } } @@ -274,7 +242,7 @@ namespace ShiftOS.Objects.ShiftFS if (!FileExists(path)) { - dir.AddFile(new File(pathlist[pathlist.Length - 1], contents, false, CurrentUser)); + dir.AddFile(new File(pathlist[pathlist.Length - 1], contents, false)); } else { -- cgit v1.2.3