private void fileTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Tag is Directory) { e.Node.Expand(); return; } File f = e.Node.Tag as File; String filename = f.name; filename = filename.ToLowerInvariant(); try { if (filename == "banner.bin") { LevelChooser.showImgMgr(); File imgFile = new InlineFile(f, 0x20, 0x200, f.name); File palFile = new InlineFile(f, 0x220, 0x20, f.name); LevelChooser.imgMgr.m.addImage(new Image2D(imgFile, 32, true, false)); LevelChooser.imgMgr.m.addPalette(new FilePalette(palFile)); } else if (filename.EndsWith(".enpg")) { LevelChooser.showImgMgr(); LZFile fileLz = new LZFile(f, LZFile.CompressionType.LZ); File imgFile = new InlineFile(fileLz, 0, 0x10000, f.name); File palFile = new InlineFile(fileLz, 0x10000, 0x200, f.name); LevelChooser.imgMgr.m.addImage(new EnpgImage2D(imgFile)); LevelChooser.imgMgr.m.addPalette(new FilePalette(palFile)); } else if (filename.EndsWith(".bncd")) { Bncd b = new Bncd(f); } if (filename.EndsWith(".nsbtx") || filename.EndsWith(".nsbmd")) { new NSBTX(f); } else if (filename.EndsWith(".narc")) { new FilesystemBrowserDialog(new NarcFilesystem(f)).Show(); } else if (filename.EndsWith(".carc")) { new FilesystemBrowserDialog(new NarcFilesystem(f, true)).Show(); } else if (filename.Contains("_ncl.bin")) { new PaletteViewer(f).Show(); } else if (filename.Contains("_nsc.bin")) { if (LevelChooser.imgMgr == null) { return; } Image2D img = LevelChooser.imgMgr.m.getSelectedImage(); Palette[] pals = LevelChooser.imgMgr.m.getPalettes(); if (img == null) { return; } if (pals == null) { return; } if (pals.Length == 0) { return; } Tilemap t = new Tilemap(f, 32, img, pals, 0, 0); new TilemapEditorWindow(t).Show(); } else if (filename.Contains("_ncg.bin")) { LevelChooser.showImgMgr(); LevelChooser.imgMgr.m.addImage(new Image2D(f, 256, false)); } } catch (AlreadyEditingException ex) { MessageBox.Show(this, (LanguageManager.Get("Errors", "File"))); } }
private void fileTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Tag is Directory) { e.Node.Expand(); return; } File f = e.Node.Tag as File; String filename = f.name; filename = filename.ToLowerInvariant(); try { if (filename == "banner.bin") { LevelChooser.showImgMgr(); File imgFile = new InlineFile(f, 0x20, 0x200, f.name); File palFile = new InlineFile(f, 0x220, 0x20, f.name); LevelChooser.imgMgr.m.addImage(new Image2D(imgFile, 32, true, false)); LevelChooser.imgMgr.m.addPalette(new FilePalette(palFile)); } else if (filename.EndsWith(".enpg")) { LevelChooser.showImgMgr(); LZFile fileLz = new LZFile(f, LZFile.CompressionType.LZ); File imgFile = new InlineFile(fileLz, 0, 0x10000, f.name); File palFile = new InlineFile(fileLz, 0x10000, 0x200, f.name); LevelChooser.imgMgr.m.addImage(new EnpgImage2D(imgFile)); LevelChooser.imgMgr.m.addPalette(new FilePalette(palFile)); } else if (filename.EndsWith(".bncd")) { Bncd b = new Bncd(f); } if (filename.EndsWith(".nsbtx") || filename.EndsWith(".nsbmd")) new NSBTX(f); else if (filename.EndsWith(".narc")) new FilesystemBrowserDialog(new NarcFilesystem(f)).Show(); else if (filename.EndsWith(".carc")) new FilesystemBrowserDialog(new NarcFilesystem(f, true)).Show(); else if (filename.Contains("_ncl.bin")) new PaletteViewer(f).Show(); else if (filename.Contains("_nsc.bin")) { if (LevelChooser.imgMgr == null) return; Image2D img = LevelChooser.imgMgr.m.getSelectedImage(); Palette[] pals = LevelChooser.imgMgr.m.getPalettes(); if (img == null) return; if (pals == null) return; if (pals.Length == 0) return; Tilemap t = new Tilemap(f, 32, img, pals, 0, 0); new TilemapEditorWindow(t).Show(); } else if (filename.Contains("_ncg.bin")) { LevelChooser.showImgMgr(); LevelChooser.imgMgr.m.addImage(new Image2D(f, 256, false)); } } catch (AlreadyEditingException ex) { MessageBox.Show(this, (LanguageManager.Get("Errors", "File"))); } }