Пример #1
0
 public static void Insert(GDFEntryNode Root, GDFDirEntry NewKey)
 {
     if (Root.Key == null)
     {
         Root.Key = NewKey;
     }
     else
     {
         int num = Root.Key.Name.CompareTo(NewKey.Name);
         if (num > 0)
         {
             if (Root.Left == null)
             {
                 Root.Left = new GDFEntryNode(Root);
             }
             Insert(Root.Left, NewKey);
         }
         else if (num < 0)
         {
             if (Root.Right == null)
             {
                 Root.Right = new GDFEntryNode(Root);
             }
             Insert(Root.Right, NewKey);
         }
     }
     if ((Root.Parent != null) && (Root.Parent.Parent != null))
     {
         Rebalance(Root.Parent.Parent, Root.Parent, GetBalance(Root));
     }
 }
Пример #2
0
 private void buildTables(ref GDFDirTable t, string dir)
 {
     string[] directories = Directory.GetDirectories(dir);
     string[] files       = Directory.GetFiles(dir);
     t.Size = (uint)((directories.Length + files.Length) * 0x90);
     if (t.Parent != null)
     {
         t.Parent.Size = t.Size;
     }
     foreach (string str in directories)
     {
         GDFDirEntry entry;
         entry = new GDFDirEntry {
             Name       = str.Substring(str.LastIndexOf(@"\") + 1),
             NameLength = (byte)entry.Name.Length,
             Attributes = GDFDirEntryAttrib.Directory,
             SubDir     = new GDFDirTable()
         };
         entry.SubDir.Parent = entry;
         entry.Parent        = t;
         t.Add(entry);
         this.buildTables(ref entry.SubDir, str);
     }
     foreach (string str2 in files)
     {
         if (!str2.EndsWith("i2g.iso"))
         {
             GDFDirEntry entry2;
             entry2 = new GDFDirEntry {
                 Name       = str2.Substring(str2.LastIndexOf(@"\") + 1),
                 NameLength = (byte)entry2.Name.Length,
                 Attributes = GDFDirEntryAttrib.Normal,
                 SubDir     = null,
                 Parent     = t
             };
             try
             {
                 uint.TryParse(File.ReadAllText(str2, Encoding.ASCII), out entry2.Size);
             }
             catch (Exception)
             {
                 entry2.Size = 0;
                 Console.WriteLine("Exception occured when reading file size from disk for {0}", entry2.Name);
             }
             t.Add(entry2);
         }
     }
     this.tables.Add(t);
 }
Пример #3
0
 public void Insert(GDFDirEntry Value)
 {
     if (this.Root == null)
     {
         this.Root = new GDFEntryNode(Value);
     }
     else
     {
         GDFEntryNode.Insert(this.Root, Value);
     }
     while (this.Root.Parent != null)
     {
         this.Root = this.Root.Parent;
     }
 }
Пример #4
0
 private void calcPath(GDFDirTable t, GDFDirEntry e, ref string path)
 {
     if (e != null)
     {
         path = path.Insert(0, @"\" + e.Name);
         if (e.Parent != null)
         {
             this.calcPath(e.Parent, null, ref path);
         }
     }
     else if (t.Parent != null)
     {
         path = path.Insert(0, @"\" + t.Parent.Name);
         if (t.Parent.Parent != null)
         {
             this.calcPath(t.Parent.Parent, null, ref path);
         }
     }
 }
Пример #5
0
 public GDFStreamEntry(GDFDirEntry Entry, string Path)
 {
     this.Entry = Entry;
     this.Path  = Path;
 }
Пример #6
0
 public GDFEntryNode(GDFDirEntry Key)
 {
     this.Key = Key;
 }