private void convertToPngToolStripMenuItem_Click(object sender, EventArgs e) { RhoPackedFileInfo fileInfo = (RhoPackedFileInfo)Array.Find(BaseRhoFile.NowFolderContent, x => x.Type == ObjectType.File && (((RhoPackedFileInfo)x).FileName + $".{((RhoPackedFileInfo)x).Extension}") == listView1.SelectedItems[0].SubItems[0].Text); byte[] a = BaseRhoFile.GetPackedFile(fileInfo); TgaDDsViewer t = new TgaDDsViewer(); t.Data = a; t.ConvertTGADDSToPng(); a = null; }
private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { return; } if (listView1.SelectedItems.Count == 0) { return; } ListViewItem lvii = listView1.SelectedItems[0]; if (listView1.SelectedItems[0].SubItems[2].Text == ("listview_item2_file").GetStringBag()) { Random rm = new Random(); RhoPackedFileInfo fileInfo = (RhoPackedFileInfo)Array.Find(BaseRhoFile.NowFolderContent, x => x.Type == ObjectType.File && (((RhoPackedFileInfo)x).FileName + $".{((RhoPackedFileInfo)x).Extension}") == lvii.Text); if (fileInfo.Extension == "dds" || fileInfo.Extension == "tga") { TgaDDsViewer tdv = new TgaDDsViewer(); tdv.Data = BaseRhoFile.GetPackedFile(fileInfo); tdv.Type = fileInfo.Extension == "dds" ? TgaDDsViewer.FileType.dds : fileInfo.Extension == "tga" ? TgaDDsViewer.FileType.tga : throw new Exception(); tdv.ShowBox(); return; } else if (fileInfo.Extension == "bml") { byte[] bmlData = BaseRhoFile.GetPackedFile(fileInfo); bmlViewer bv = new bmlViewer(bmlData, fileInfo.FileName); bv.Show(); return; } FileStream fs = new FileStream(Environment.GetEnvironmentVariable("TEMP") + $"\\{lvii.Text}", FileMode.Create); byte[] a = BaseRhoFile.GetPackedFile(fileInfo); fs.Write(a, 0, a.Length); fs.Close(); a = null; Process ps = new Process(); ps.StartInfo.FileName = Environment.GetEnvironmentVariable("TEMP") + $"\\{lvii.Text}"; ps.Start(); return; } string FolderName = lvii.SubItems[0].Text; BaseRhoFile.EnterToFolder(FolderName); UpdateFolders(); this.toolStripButton1.Enabled = true; }