Example #1
0
 public NARC.FileEntry GetFileByPath(string Path)
 {
     if (!Path.StartsWith(this.Name.Replace("root", "\\")))
     {
         return((NARC.FileEntry)null);
     }
     Path = Path.Remove(0, this.Name.Replace("root", "\\").Length);
     string[] strArray = Path.Split(new string[1] {
         "\\"
     }, StringSplitOptions.RemoveEmptyEntries);
     if (strArray.Length == 1)
     {
         for (int index = 0; index < this.Files.Count; ++index)
         {
             if (this.Files[index].Name == strArray[0])
             {
                 return(this.Files[index]);
             }
         }
     }
     for (int index = 0; index < this.Subdirs.Count; ++index)
     {
         NARC.FileEntry fileByPath = this.Subdirs[index].GetFileByPath(string.Join("\\", strArray));
         if (fileByPath != null)
         {
             return(fileByPath);
         }
     }
     return((NARC.FileEntry)null);
 }
Example #2
0
 public NARC.FileEntry GetFile(int id)
 {
     for (int index = 0; index < this.Files.Count; ++index)
     {
         if (this.Files[index].Id == id)
         {
             return(this.Files[index]);
         }
     }
     for (int index = 0; index < this.Subdirs.Count; ++index)
     {
         NARC.FileEntry file = this.Subdirs[index].GetFile(id);
         if (file != null)
         {
             return(file);
         }
     }
     return((NARC.FileEntry)null);
 }
Example #3
0
 public bool SetFile(NARC.FileEntry f)
 {
     for (int index = 0; index < this.Files.Count; ++index)
     {
         if (this.Files[index].Id == f.Id)
         {
             this.Files[index] = f;
             return(true);
         }
     }
     for (int index = 0; index < this.Subdirs.Count; ++index)
     {
         if (this.Subdirs[index].SetFile(f))
         {
             return(true);
         }
     }
     return(false);
 }