private void exportNutToFolder(object sender, EventArgs e) { using (FolderSelectDialog f = new FolderSelectDialog()) { if (f.ShowDialog() == DialogResult.OK) { if (!Directory.Exists(f.SelectedPath)) { Directory.CreateDirectory(f.SelectedPath); } foreach (NUT_Texture tex in NUT.Nodes) { if (tex.type == PixelInternalFormat.Rgba) { string filename = Path.Combine(f.SelectedPath, $"{tex.HASHID.ToString("X")}.png"); ExportPNG(filename, tex); } else { string filename = Path.Combine(f.SelectedPath, $"{tex.HASHID.ToString("X")}.dds"); DDS dds = new DDS(); dds.fromNUT_Texture(tex); dds.Save(filename); } } Process.Start("explorer.exe", f.SelectedPath); } } }
private void ExportDDS(string filename, NutTexture tex) { DDS dds = new DDS(); dds.fromNUT_Texture(tex); dds.Save(filename); }
private void exportAsDDSToolStripMenuItem_Click(object sender, EventArgs e) { using (var sfd = new SaveFileDialog()) { sfd.Filter = "Direct Draw Surface (.dds)|*.dds|" + "All Files (*.*)|*.*"; if (sfd.ShowDialog() == DialogResult.OK) { if (sfd.FileName.EndsWith(".dds") && selected != null) { DDS dds = new DDS(); dds.fromNUT_Texture((NUT.NUD_Texture)(listBox2.SelectedItem)); dds.Save(sfd.FileName); } } } }
private void extractAndPickAProgramToEditWithToolStripMenuItem_Click(object sender, EventArgs e) { string tempFileName; bool setupFileModifying = false; dontModify = true; fw.EnableRaisingEvents = true; if (!fileFromTexture.ContainsKey((NUT.NUD_Texture)(listBox2.SelectedItem))) { tempFileName = Path.GetTempFileName(); DeleteIfExists(Path.ChangeExtension(tempFileName, ".dds")); File.Move(tempFileName, Path.ChangeExtension(tempFileName, ".dds")); tempFileName = Path.ChangeExtension(tempFileName, ".dds"); fileFromTexture.Add((NUT.NUD_Texture)(listBox2.SelectedItem), tempFileName); textureFromFile.Add(tempFileName, (NUT.NUD_Texture)listBox2.SelectedItem); setupFileModifying = true; } else { tempFileName = fileFromTexture[(NUT.NUD_Texture)listBox2.SelectedItem]; } DDS dds = new DDS(); dds.fromNUT_Texture((NUT.NUD_Texture)(listBox2.SelectedItem)); dds.Save(tempFileName); ShowOpenWithDialog(tempFileName); if (setupFileModifying) { if (fw.Filter.Equals("*.*")) { fw.Filter = Path.GetFileName(tempFileName); } else { fw.Filter += "|" + Path.GetFileName(tempFileName); } Console.WriteLine(fw.Filter); } dontModify = false; }
private void extractAndOpenInDefaultEditorToolStripMenuItem_Click(object sender, EventArgs e) { string tempFileName; bool setupFileModifying = false; dontModify = true; fw.EnableRaisingEvents = true; if (!fileFromTexture.ContainsKey((NUT_Texture)(textureList.SelectedItem))) { tempFileName = Path.GetTempFileName(); DeleteIfExists(Path.ChangeExtension(tempFileName, ".dds")); File.Move(tempFileName, Path.ChangeExtension(tempFileName, ".dds")); tempFileName = Path.ChangeExtension(tempFileName, ".dds"); fileFromTexture.Add((NUT_Texture)textureList.SelectedItem, tempFileName); textureFromFile.Add(tempFileName, (NUT_Texture)textureList.SelectedItem); setupFileModifying = true; } else { tempFileName = fileFromTexture[(NUT_Texture)textureList.SelectedItem]; } DDS dds = new DDS(); dds.fromNUT_Texture((NUT_Texture)(textureList.SelectedItem)); dds.Save(tempFileName); System.Diagnostics.Process.Start(tempFileName); if (setupFileModifying) { if (fw.Filter.Equals("*.*")) { fw.Filter = Path.GetFileName(tempFileName); } else { fw.Filter += "|" + Path.GetFileName(tempFileName); } Console.WriteLine(fw.Filter); } dontModify = false; }
private void exportNutToFolder(object sender, EventArgs e) { using (FolderSelectDialog f = new FolderSelectDialog()) { if (f.ShowDialog() == DialogResult.OK && listBox1.SelectedItem != null) { if (!Directory.Exists(f.SelectedPath)) { Directory.CreateDirectory(f.SelectedPath); } foreach (var tex in selected.textures) { string filename = Path.Combine(f.SelectedPath, $"{tex.id.ToString("X")}.dds"); DDS dds = new DDS(); dds.fromNUT_Texture(tex); dds.Save(filename); } Process.Start("explorer.exe", f.SelectedPath); } } }
private void exportAsDDSToolStripMenuItem_Click(object sender, EventArgs e) { if (textureList.SelectedItem == null) { return; } using (var sfd = new SaveFileDialog()) { NUT_Texture tex = (NUT_Texture)(textureList.SelectedItem); if (tex.type == PixelInternalFormat.Rgba) { sfd.Filter = "Portable Networks Graphic (.png)|*.png|" + "All files(*.*)|*.*"; } else { sfd.Filter = "Direct Draw Surface (.dds)|*.dds|" + "All files(*.*)|*.*"; } if (sfd.ShowDialog() == DialogResult.OK) { // use png instead if (sfd.FileName.EndsWith(".png") && NUT != null && tex.type == PixelInternalFormat.Rgba) { ExportPNG(sfd.FileName, tex); } if (sfd.FileName.EndsWith(".dds") && NUT != null) { DDS dds = new DDS(); dds.fromNUT_Texture(tex); dds.Save(sfd.FileName); } } } }