public void Load() { IsActive = true; EditorRoot = new NuTex(); ((NuTex)EditorRoot).FileHandler = this; ((NuTex)EditorRoot).ArcOffset = System.IO.Path.GetFileNameWithoutExtension(FileName); ((NuTex)EditorRoot).Read(new FileReader(Data)); }
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) { NuTex texture = new NuTex(); texture.Read(new FileReader(file)); Console.WriteLine(texture.Format.ToString("x") + " " + file + " " + texture.Text); try { Bitmap bitmap = texture.DisplayTexture(); 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("Somethign went wrong??"); } texture.blocksCompressed.Clear(); texture.mipmaps.Clear(); texture = null; GC.Collect(); } } }