public static SFSDirectory FromDirectory(String Path)
        {
            SFSDirectory Root = new SFSDirectory("/", true);

            FillSFSDirFromDisk(new DirectoryInfo(Path), Root);
            return(Root);
        }
 private static void FillSFSDirFromDisk(DirectoryInfo Dir, SFSDirectory Dst)
 {
     foreach (var v in Dir.EnumerateFiles())
     {
         Dst.Files.Add(new SFSFile(-1, v.Name, Dst)
         {
             Data = File.ReadAllBytes(v.FullName)
         });
     }
     foreach (var v in Dir.EnumerateDirectories())
     {
         SFSDirectory d = new SFSDirectory(v.Name, false)
         {
             Parent = Dst
         };
         Dst.SubDirectories.Add(d);
         FillSFSDirFromDisk(v, d);
     }
 }
Пример #3
0
 private void fileBrowser1_OnAddDirectory(object sender, EventArgs e)
 {
     var dir = Root.GetDirectoryByPath(fileBrowser1.SelectedFolderPath);
     if (dir == null) return;
     String name = null;
     retry:
     name = Microsoft.VisualBasic.Interaction.InputBox("Please give the name of the new directory:", "New Directory", name);
     if (name == null || name.Length == 0) return;
     if (dir.IsValidName(name))
     {
         SFSDirectory d = new SFSDirectory(name, false);
         d.Parent = dir;
         dir.SubDirectories.Add(d);
         Archive.FromFileSystem(Root);
         fileBrowser1.UpdateDirectories(Root.GetTreeNodes(), true);
     }
     else
     {
         MessageBox.Show("The name contains either one or more invalid chars, or is already in use!", "Invalid Name");
         goto retry;
     }
 }
Пример #4
0
 private static void FillSFSDirFromDisk(DirectoryInfo Dir, SFSDirectory Dst)
 {
     foreach (var v in Dir.EnumerateFiles())
     {
         Dst.Files.Add(new SFSFile(-1, v.Name, Dst) { Data = File.ReadAllBytes(v.FullName) });
     }
     foreach (var v in Dir.EnumerateDirectories())
     {
         SFSDirectory d = new SFSDirectory(v.Name, false) { Parent = Dst };
         Dst.SubDirectories.Add(d);
         FillSFSDirFromDisk(v, d);
     }
 }
Пример #5
0
 public static SFSDirectory FromDirectory(String Path)
 {
     SFSDirectory Root = new SFSDirectory("/", true);
     FillSFSDirFromDisk(new DirectoryInfo(Path), Root);
     return Root;
 }
Пример #6
0
 public NARCViewer(NARC Archive)
 {
     this.Archive = Archive;
     Root = Archive.ToFileSystem();
     InitializeComponent();
 }
Пример #7
0
 public NDSViewer(Nitro.NDS Archive)
 {
     this.Archive = Archive;
     Root = Archive.ToFileSystem();
     InitializeComponent();
 }
 public UtilityBinViewer(UtilityBin Archive)
 {
     this.Archive = Archive;
     Root = Archive.ToFileSystem();
     InitializeComponent();
 }
Пример #9
0
 public SFSFile(Int32 Id, String Name, SFSDirectory Parent)
 {
     FileID = Id;
     FileName = Name;
     this.Parent = Parent;
 }
Пример #10
0
 public DARCViewer(DARC Archive)
 {
     Root = Archive.ToFileSystem();
     InitializeComponent();
 }
Пример #11
0
        public static void GenerateEntryNameTable(List<DirectoryTableEntry> directoryTable, List<EntryNameTableEntry> entryNameTable, SFSDirectory dir, ref uint Offset, ref ushort FileId)
        {
            directoryTable[dir.DirectoryID - 0xF000].dirEntryStart = Offset;
            directoryTable[dir.DirectoryID - 0xF000].dirEntryFileID = FileId;

            foreach (SFSDirectory d in dir.SubDirectories)
            {
                entryNameTable.Add(new EntryNameTableDirectoryEntry(d.DirectoryName, d.DirectoryID));
                Offset += (uint)d.DirectoryName.Length + 3u;
            }
            foreach (SFSFile f in dir.Files)
            {
                f.FileID = FileId;
                entryNameTable.Add(new EntryNameTableFileEntry(f.FileName));
                Offset += (uint)f.FileName.Length + 1u;
                FileId++;
            }
            entryNameTable.Add(new EntryNameTableEndOfDirectoryEntry());
            Offset++;

            foreach (SFSDirectory d in dir.SubDirectories)
            {
                GenerateEntryNameTable(directoryTable, entryNameTable, d, ref Offset, ref FileId);
            }
        }
Пример #12
0
 public static void GenerateDirectoryTable(List<DirectoryTableEntry> directoryTable, SFSDirectory dir)
 {
     DirectoryTableEntry cur = new DirectoryTableEntry();
     if (dir.IsRoot)
     {
         cur.dirParentID = (ushort)(dir.TotalNrSubDirectories + 1);
         cur.dirEntryStart = cur.dirParentID * 8u;
     }
     else cur.dirParentID = dir.Parent.DirectoryID;
     dir.DirectoryID = (ushort)(0xF000 + directoryTable.Count);
     directoryTable.Add(cur);
     foreach (SFSDirectory d in dir.SubDirectories)
     {
         GenerateDirectoryTable(directoryTable, d);
     }
 }
Пример #13
0
 public U8Viewer(U8 Archive)
 {
     Root = Archive.ToFileSystem();
     InitializeComponent();
 }
Пример #14
0
		public SFSFile(Int32 Id, String Name, SFSDirectory Parent)
		{
			FileID = Id;
			FileName = Name;
			this.Parent = Parent;
		}