Exemple #1
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);
 }
Exemple #2
0
        public object Clone()
        {
            GDFDirTable table = new GDFDirTable {
                Sector = this.Sector,
                Size   = this.Size
            };

            foreach (GDFDirEntry entry in this)
            {
                GDFDirEntry item = (GDFDirEntry)entry.Clone();
                item.Parent = table;
                table.Add(item);
            }
            return(table);
        }