private void run(string[] args) { nds = new NDS(File.OpenRead(args[0])); scriptArchive = new MainArchive(nds.FileSystem.OpenFile("jpn/spt.bin")); SPT spt = new SPT(scriptArchive.OpenFile(int.Parse(args[1]))); string contents = spt.OpenSection(int.Parse(args[2])); }
public TestForm(string[] args) { InitializeComponent(); nds = new NDS(File.OpenRead(args[0])); MainArchive mainArchive = new MainArchive(nds.FileSystem.OpenFile(args[1])); NCLR nclr = new NCLR(mainArchive.OpenFile(int.Parse(args[2]))); SubArchive subArchive = new SubArchive(mainArchive.OpenFile(int.Parse(args[3]))); NCGR ncgr = new NCGR(subArchive.OpenFile(2)); NANR nanr = new NANR(subArchive.OpenFile(1)); NCER ncer = new NCER(subArchive.OpenFile(0)); NANR.Animation anim = nanr.animations[int.Parse(args[4])]; //imgDisp.Image = cell.DrawOamBoxes(Color.Red); player = new AnimationPlayer_WinForms(anim, ncgr, nclr, ncer, imgDisp); player.Start(); }
public void Run(string[] args) { nds = new NDS(File.OpenRead(args[0])); outputPath = args[1]; var archiveList = nds.FileSystem.RootDir.FindMatchingFiles("*.bin"); foreach (var archiveEntry in archiveList) { Console.WriteLine($"Opening archive \"{archiveEntry.AbsPath}\""); var archiveStream = nds.FileSystem.OpenFile(archiveEntry); var archive = new MainArchive(archiveStream); for (var fileIndex = 0; fileIndex < archive.FileCount; ++fileIndex) { try { var fileStream = archive.OpenFile(fileIndex); var ext = SniffFileExtension(fileStream); fileStream.Position = 0; if (ext == "bin") { bool isArch = SniffArchive(fileStream); fileStream.Position = 0; if (isArch) { Console.WriteLine($"Opening subarch \"{archiveEntry.AbsPath}/{fileIndex}"); var subArch = new SubArchive(fileStream); for (int subFileIndex = 0; subFileIndex < subArch.FileCount; ++subFileIndex) { var subfile = subArch.OpenFile(subFileIndex); var subExt = SniffFileExtension(subfile); subfile.Position = 0; WriteFile(subfile, $"{archiveEntry.AbsPath}/{fileIndex}/{subFileIndex}.{subExt}"); } continue; } } WriteFile(fileStream, $"{archiveEntry.AbsPath}/{fileIndex}.{ext}"); } catch (Exception err) { Console.WriteLine(err.Message); } } } }