private void ReadFolder(string folder) { toolStripInfoRom.Enabled = false; btnSaveROM.Enabled = false; romInfo = new RomInfo(); // Para que no se formen errores... DateTime startTime = DateTime.Now; accion = new Acciones("", "NO GAME"); DateTime t1 = DateTime.Now; accion.LastFileID = 0; accion.LastFolderID = 0xF000; // Obtenemos el sistema de archivos sFolder root = new sFolder(); root.name = "root"; root.id = 0xF000; accion.LastFileID = 0x00; accion.LastFolderID = 0xF000; root = accion.Recursive_GetExternalDirectories(folder, root); DateTime t2 = DateTime.Now; accion.Root = root; DateTime t3 = DateTime.Now; Set_Format(root); DateTime t4 = DateTime.Now; treeSystem.BeginUpdate(); treeSystem.Nodes.Add(Create_Nodes(root)); // Show files treeSystem.EndUpdate(); DateTime t5 = DateTime.Now; treeSystem.Nodes[0].Expand(); Get_SupportedFiles(); DateTime t6 = DateTime.Now; XElement xml = Tools.Helper.GetTranslation("Messages"); Console.Write("<br><u>" + xml.Element("S0F").Value + "</u><ul><font size=\"2\" face=\"consolas\">"); Console.WriteLine("<li>" + xml.Element("S10").Value + (t6 - startTime).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S12").Value + (t1 - startTime).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S21").Value + (t2 - t1).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S16").Value + (t3 - t2).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S17").Value + (t4 - t3).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S18").Value + (t5 - t4).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S19").Value + (t6 - t5).ToString() + "</li>"); Console.Write("</font></ul><br>"); }
private void ReadGame(string file) { DateTime startTime = DateTime.Now; romInfo = new RomInfo(file); // Read the header and banner DateTime t1 = DateTime.Now; accion = new Acciones(file, new String(romInfo.Cabecera.gameCode)); DateTime t2 = DateTime.Now; // Read File Allocation Table (offset and size) Nitro.Estructuras.sFAT[] fat = Nitro.FAT.ReadFAT(file, romInfo.Cabecera.FAToffset, romInfo.Cabecera.FATsize); DateTime t3 = DateTime.Now; // Read the File Name Table and get the directory hierarchy sFolder root = Nitro.FNT.ReadFNT(file, romInfo.Cabecera.fileNameTableOffset, fat, accion); DateTime t4 = DateTime.Now; accion.LastFileID = fat.Length; accion.LastFolderID = root.id + 0xF000; root.id = 0xF000; // Add system files (fnt.bin, banner.bin, overlays, arm9 and arm7) if (!(root.folders is List<sFolder>)) root.folders = new List<sFolder>(); root.folders.Add(Add_SystemFiles(fat)); DateTime t5 = DateTime.Now; accion.Root = root; accion.SortedIDs = Nitro.FAT.SortByOffset(fat); DateTime t6 = DateTime.Now; Stream stream = File.OpenRead(file); treeSystem.BeginUpdate(); treeSystem.Nodes.Add(Create_Nodes(root, stream)); // Get the node hierarchy treeSystem.EndUpdate(); stream.Close(); stream.Dispose(); DateTime t7 = DateTime.Now; treeSystem.Nodes[0].Expand(); Get_SupportedFiles(); DateTime t8 = DateTime.Now; XElement xml = Tools.Helper.GetTranslation("Messages"); Console.Write("<br><u>" + xml.Element("S0F").Value + "</u><font size=\"2\" face=\"consolas\"><ul>"); Console.WriteLine("<li>" + xml.Element("S10").Value + (t8 - startTime).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S11").Value + (t1 - startTime).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S12").Value + (t2 - t1).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S15").Value + (t3 - t2).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S13").Value + (t4 - t3).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S14").Value + (t5 - t4).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S16").Value + (t6 - t5).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S18").Value + (t7 - t6).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S19").Value + (t8 - t7).ToString() + "</li>"); Console.WriteLine("</ul>"); Console.WriteLine("Number of directories: {0}", accion.LastFolderID - 0xF000 - 1); Console.WriteLine("Number of files: {0}</font>", fat.Length); this.Text += " " + new String(romInfo.Cabecera.gameTitle).Replace("\0", "") + " (" + new String(romInfo.Cabecera.gameCode) + ')'; }
private void ReadFiles(string[] files) { toolStripInfoRom.Enabled = false; btnSaveROM.Enabled = false; romInfo = new RomInfo(); // Para que no se formen errores... DateTime startTime = DateTime.Now; accion = new Acciones("", "NO GAME"); DateTime t1 = DateTime.Now; accion.LastFileID = files.Length; accion.LastFolderID = 0xF000; // Obtenemos el sistema de archivos sFolder root = new sFolder(); root.name = "root"; root.id = 0xF000; root.files = new List<sFile>(); for (int i = 0; i < files.Length; i++) { sFile currFile = new sFile(); currFile.id = (ushort)i; currFile.name = Path.GetFileName(files[i]); currFile.offset = 0x00; currFile.path = files[i]; currFile.size = (uint)new FileInfo(files[i]).Length; root.files.Add(currFile); } DateTime t2 = DateTime.Now; accion.Root = root; DateTime t3 = DateTime.Now; Set_Format(root); DateTime t4 = DateTime.Now; treeSystem.BeginUpdate(); treeSystem.Nodes.Add(Create_Nodes(root)); // Show files treeSystem.EndUpdate(); DateTime t5 = DateTime.Now; treeSystem.Nodes[0].Expand(); Get_SupportedFiles(); DateTime t6 = DateTime.Now; XElement xml = Tools.Helper.GetTranslation("Messages"); Console.Write("<br><u>" + xml.Element("S0F").Value + "</u><ul><font size=\"2\" face=\"consolas\">"); Console.WriteLine("<li>" + xml.Element("S10").Value + (t6 - startTime).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S12").Value + (t1 - startTime).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S21").Value + (t2 - t1).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S16").Value + (t3 - t2).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S17").Value + (t4 - t3).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S18").Value + (t5 - t4).ToString() + "</li>"); Console.WriteLine("<li>" + xml.Element("S19").Value + (t6 - t5).ToString() + "</li>"); Console.Write("</font></ul><br>"); }