Example #1
0
 public static Hacknet.Folder Move(this Hacknet.Folder self, Hacknet.FileEntry src, Hacknet.Folder to)
 {
     if (src == null || to == null)
     {
         return(self);
     }
     self.files.Remove(src);
     to.files.Add(src);
     return(self);
 }
Example #2
0
 public static Hacknet.Folder AddFolder(this Hacknet.Folder self, string name, List <Hacknet.Folder> folders = null, List <Hacknet.FileEntry> files = null)
 {
     self.Add(new Hacknet.Folder(name));
     if (folders != null)
     {
         self.folders[self.folders.Count].folders = folders;
     }
     if (files != null)
     {
         self.folders[self.folders.Count].files = files;
     }
     return(self);
 }
Example #3
0
 public static Hacknet.Folder AddRandomFile(this Hacknet.Folder self, object name = null, uint?id = null) =>
 self.AddFile(name as string ??
              Hacknet.FileEntry.filenames[
                  (int)Math.Min(
                      (name as long?).GetValueOrDefault(),
                      Hacknet.FileEntry.filenames.Count - 1
                      )
              ],
              Hacknet.FileEntry.fileData[
                  (int)Math.Min(
                      id.Value,
                      Hacknet.FileEntry.filenames.Count - 1)
              ]);
Example #4
0
 public static Hacknet.Folder Remove(this Hacknet.Folder self, Hacknet.FileEntry file)
 {
     self.files.Remove(file);
     return(self);
 }
Example #5
0
 public static Hacknet.Folder Remove(this Hacknet.Folder self, Hacknet.Folder folder)
 {
     self.folders.Remove(folder);
     return(self);
 }
Example #6
0
 public static Hacknet.Folder Add(this Hacknet.Folder self, Hacknet.FileEntry file)
 {
     self.files.Add(file);
     return(self);
 }
Example #7
0
 public static Hacknet.Folder Add(this Hacknet.Folder self, Hacknet.Folder folder)
 {
     self.folders.Add(folder);
     return(self);
 }
Example #8
0
 public static Hacknet.Folder MoveFile(this Hacknet.Folder self, string name, Hacknet.Folder to) =>
 self.Move(self.files.Find(obj => obj.name == name), to);
Example #9
0
 public static Hacknet.Folder RemoveFile(this Hacknet.Folder self, string name)
 {
     self.files.RemoveAll(obj => obj.name == name);
     return(self);
 }
Example #10
0
 public static Hacknet.Folder AddExecutableFile(this Hacknet.Folder self, string name, int id) =>
 self.AddFile(name, ExeInfoManager.GetExecutableInfo(id).Data);
Example #11
0
 public static Hacknet.Folder AddExecutableFile(this Hacknet.Folder self, string name, string id) =>
 self.AddFile(name,
              ExeInfoManager.GetExecutableInfo(id).Data ??
              Executable.Handler.GetStandardFileDataBy(id, true));
Example #12
0
 public static Hacknet.Folder AddFile(this Hacknet.Folder self, string name, uint?dataIndex = null) =>
 self.AddFile(name,
              Hacknet.FileEntry.fileData[(int)Math.Min(dataIndex.Value,
                                                       Hacknet.FileEntry.filenames.Count - 1
                                                       )]);
Example #13
0
 public static Hacknet.Folder AddFile(this Hacknet.Folder self, string name, Executable.IInterface data) =>
 self.AddFile(name, Executable.Handler.GetStandardFileDataBy(data));
Example #14
0
 public static Hacknet.Folder AddFile(this Hacknet.Folder self, string name, string data = null)
 {
     self.Add(new Hacknet.FileEntry(name, data));
     return(self);
 }