private int getIconForFile(File f) { int returnValue = 1; CompressedFile.CompressionType CompressionType = f.guessCompression(true); string type = getFileTypeForFile(f); if (type == "NSMBeUD") { returnValue = 17; } if (type == "NARC") { returnValue = 2; } if (type == "CARC") { returnValue = 2; } if (type == "NCG") { returnValue = 3; } if (type == "NCGR") { returnValue = 3; } if (type == "BNCD") { returnValue = 3; } if (type == "BANNER") { returnValue = 3; } if (type == "NCL") { returnValue = 4; } if (type == "NCLR") { returnValue = 4; } if (type == "NSC") { returnValue = 5; } if (type == "NSCR") { returnValue = 5; } if (type == "BMD0") { returnValue = 6; } if (type == "BTX0") { returnValue = 7; } if (type == "SDAT") { returnValue = 8; } if (type == "ENPG") { returnValue = 9; } if (type == "BCA0") { returnValue = 10; } if (type == "BTP0") { returnValue = 11; } if (type == "BTA0") { returnValue = 12; } if (type == "BMA0") { returnValue = 13; } if (type == "BVA0") { returnValue = 14; } if (type == "BMG") { returnValue = 15; } if (type == "SPA") { returnValue = 16; } if (type == "BNBL") { returnValue = 18; } if (type == "BNCL") { returnValue = 19; } int intCompressionType = 0; if (CompressionType == CompressedFile.CompressionType.LZ) { intCompressionType = 1; } else if (CompressionType == CompressedFile.CompressionType.LZWithHeader) { intCompressionType = 2; } else if (CompressionType == CompressedFile.CompressionType.Yaz0) { intCompressionType = 3; } return(returnValue + (intCompressionType * (fileTreeView.ImageList.Images.Count / 4))); }
private void Yaz0Button_Click(object sender, EventArgs e) { Canceled = false; ChosenCompression = CompressedFile.CompressionType.Yaz0; Close(); }
private string getFileTypeForFile(File f) { string name = f.name.ToLowerInvariant(); if (f.id == 131) { return("NSMBeUD"); } //Name checks if (name == "banner.bin") { return("BANNER"); } if (name.Contains("_ncg")) { return("NCG"); } if (name.Contains("_ncl")) { return("NCL"); } if (name.Contains("_nsc")) { return("NSC"); } if (name.EndsWith(".enpg")) { return("ENPG"); //ENPG (256x256 Bitmap with 256x256 Palette) } //Header checks CompressedFile.CompressionType CompressionType = f.guessCompression(true); int i = 0; if (CompressionType == CompressedFile.CompressionType.LZ) { i = 5; } else if (CompressionType == CompressedFile.CompressionType.LZWithHeader) { i = 9; } else if (CompressionType == CompressedFile.CompressionType.Yaz0) { i = 17; } int HeaderMinSize = 4 + i; if (f.fileSize >= HeaderMinSize + 0x10 && f.getUintAt(i + 0x10) == 0x43484152) { return("NCGR"); //NCGR (NCR with header) } if (f.fileSize >= HeaderMinSize + 0x10 && f.getUintAt(i + 0x10) == 0x504C5454) { return("NCLR"); //NCLR (NCL with header) } if (f.fileSize >= HeaderMinSize + 0x10 && f.getUintAt(i + 0x10) == 0x5343524E) { return("NSCR"); //NSCR (NSC with header) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x4352414E) { return("NARC"); //NARC (ARCHIVE) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x30444D42) { return("BMD0"); //BMD0 (NSBMD/MODEL) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x30585442) { return("BTX0"); //BTX0 (NSBTX/MODEL TEXTURE) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x54414453) { return("SDAT"); //SDAT (SDAT/MUSIC) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x30414342) { return("BCA0"); //BCA0 (NSBCA/ANIMATION) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x30505442) { return("BTP0"); //BTP0 (NSBTP) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x30415442) { return("BTA0"); //BTA0 (NSBTA) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x30414D42) { return("BMA0"); //BMA0 (NSBMA) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x30415642) { return("BVA0"); //BVA0 (NSBVA) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x4753454D) { return("BMG"); //MESG (BMG/MESSAGE) } if (f.fileSize >= HeaderMinSize + 4 && f.getUintAt(i) == 0x53504120 && f.getUintAt(i + 4) == 0x315F3232) { return("SPA"); // APS22_1 (SPA/PARTICLE) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0X4C424E4A) { return("BNBL"); //JNBL (BNBL/TOUCHPOS) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x4C434E4A) { return("BNCL"); //JNCL (BNCL/GFXPOS) } if (f.fileSize >= HeaderMinSize && f.getUintAt(i) == 0x44434E4A) { return("BNCD"); //JNCD (BNCD/BITMAP) } return("Unknown File"); }
private void LZ77hButton_Click(object sender, EventArgs e) { Canceled = false; ChosenCompression = CompressedFile.CompressionType.LZWithHeader; Close(); }