private void Export(object sender, EventArgs args) { string formats = FileFilters.NUTEXB; string[] forms = formats.Split('|'); List <string> Formats = new List <string>(); for (int i = 0; i < forms.Length; i++) { if (i > 1 || i == (forms.Length - 1)) //Skip lines with all extensions { if (!forms[i].StartsWith("*")) { Formats.Add(forms[i]); } } } BatchFormatExport form = new BatchFormatExport(Formats); if (form.ShowDialog() == DialogResult.OK) { string extension = form.GetSelectedExtension(); OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; ofd.Filter = Utils.GetAllFilters(typeof(NUTEXB)); if (ofd.ShowDialog() == DialogResult.OK) { foreach (string file in ofd.FileNames) { NUTEXB texture = new NUTEXB(); texture.Read(new FileReader(file)); try { texture.Export(System.IO.Path.GetFullPath(file) + texture.ArcOffset + texture.Text + extension); } catch { Console.WriteLine("Something went wrong??"); } texture = null; GC.Collect(); } } } }
private void Export(object sender, EventArgs args) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; if (ofd.ShowDialog() == DialogResult.OK) { foreach (string file in ofd.FileNames) { NUTEXB texture = new NUTEXB(); texture.Read(new FileReader(file)); Console.WriteLine(texture.Format.ToString("x") + " " + file + " " + texture.Text); try { Bitmap bitmap = texture.GetBitmap(); if (bitmap != null) { bitmap.Save(System.IO.Path.GetFullPath(file) + texture.ArcOffset + texture.Text + ".png"); } else { Console.WriteLine(" Not supported Format! " + texture.Format); } if (bitmap != null) { bitmap.Dispose(); } } catch { Console.WriteLine("Something went wrong??"); } texture.Surfaces.Clear(); texture = null; GC.Collect(); } } }