private static void BuildRomFS() { ROOT_DIR = FullPath; FileNameTable FNT = new FileNameTable(ROOT_DIR); RomfsFile[] RomFiles = new RomfsFile[FNT.NumFiles]; LayoutManager.Input[] In = new LayoutManager.Input[FNT.NumFiles]; Console.WriteLine("Creating Layout..."); for (int i = 0; i < FNT.NumFiles; i++) { In[i] = new LayoutManager.Input(); In[i].FilePath = FNT.NameEntryTable[i].FullName; In[i].AlignmentSize = 0x10; } LayoutManager.Output[] Out = LayoutManager.Create(In); for (int i = 0; i < Out.Length; i++) { RomFiles[i] = new RomfsFile(); RomFiles[i].Offset = Out[i].Offset; RomFiles[i].PathName = Out[i].FilePath.Replace(Path.GetFullPath(ROOT_DIR), "").Replace("\\", "/"); RomFiles[i].FullName = Out[i].FilePath; RomFiles[i].Size = Out[i].Size; } using (MemoryStream memoryStream = new MemoryStream()) { Console.WriteLine("Creating RomFS MetaData..."); MetaDataBuilder mdb = new MetaDataBuilder(); mdb.BuildRomFSHeader(memoryStream, RomFiles, ROOT_DIR); MakeRomFSData(RomFiles, memoryStream); } }
private void BuildRomFS() { this.isWorkerThreadAlive = true; ROOT_DIR = TB_Path.Text; FileNameTable FNT = new FileNameTable(ROOT_DIR); RomfsFile[] RomFiles = new RomfsFile[FNT.NumFiles]; LayoutManager.Input[] In = new LayoutManager.Input[FNT.NumFiles]; TB_Progress.Invoke((Action)(() => UpdateTB_Progress("Creating Layout..."))); for (int i = 0; i < FNT.NumFiles; i++) { In[i] = new LayoutManager.Input(); In[i].FilePath = FNT.NameEntryTable[i].FullName; In[i].AlignmentSize = 0x10; } LayoutManager.Output[] Out = LayoutManager.Create(In); for (int i = 0; i < Out.Length; i++) { RomFiles[i] = new RomfsFile(); RomFiles[i].Offset = Out[i].Offset; RomFiles[i].PathName = Out[i].FilePath.Replace(Path.GetFullPath(ROOT_DIR), "").Replace("\\", "/"); RomFiles[i].FullName = Out[i].FilePath; RomFiles[i].Size = Out[i].Size; } using (MemoryStream memoryStream = new MemoryStream()) { TB_Progress.Invoke((Action)(() => UpdateTB_Progress("Creating RomFS MetaData..."))); MetaDataBuilder mdb = new MetaDataBuilder(); mdb.BuildRomFSHeader(memoryStream, RomFiles, ROOT_DIR); MakeRomFSData(RomFiles, memoryStream); } this.isWorkerThreadAlive = false; Invoke((Action)(() => { B_Go.Enabled = true; B_Open.Enabled = true; } )); }