示例#1
0
        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);
                    }

                    ShowGtxMipmapWarning(currentNut);

                    foreach (NutTexture tex in currentNut.Nodes)
                    {
                        if (tex.pixelInternalFormat == 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.FromNutTexture(tex);
                            dds.Save(filename);
                        }
                    }

                    Process.Start("explorer.exe", f.SelectedPath);
                }
            }
        }
示例#2
0
        private void ExportDds(string filename, NutTexture tex)
        {
            Dds dds = new Dds();

            dds.FromNutTexture(tex);
            dds.Save(filename);
        }
示例#3
0
        private void extractAndPickAProgramToEditWithToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string tempFileName;
            bool   setupFileModifying = false;

            dontModify             = true;
            fw.EnableRaisingEvents = true;
            if (!fileFromTexture.ContainsKey((NutTexture)(textureListBox.SelectedItem)))
            {
                tempFileName = Path.GetTempFileName();
                DeleteIfExists(Path.ChangeExtension(tempFileName, ".dds"));
                File.Move(tempFileName, Path.ChangeExtension(tempFileName, ".dds"));
                tempFileName = Path.ChangeExtension(tempFileName, ".dds");
                fileFromTexture.Add((NutTexture)(textureListBox.SelectedItem), tempFileName);
                textureFromFile.Add(tempFileName, (NutTexture)textureListBox.SelectedItem);
                setupFileModifying = true;
            }
            else
            {
                tempFileName = fileFromTexture[(NutTexture)textureListBox.SelectedItem];
            }

            Dds dds = new Dds();

            dds.FromNutTexture((NutTexture)(textureListBox.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;
        }