Пример #1
0
            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();
                        }
                    }
                }
            }
Пример #2
0
            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();
                    }
                }
            }
Пример #3
0
        public void CreateNewNutexb()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect = false;
            ofd.Filter      = FileFilters.NUTEXB;
            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            NUTEXB nutexb = new NUTEXB();

            nutexb.CanSave    = true;
            nutexb.IFileInfo  = new IFileInfo();
            nutexb.ArrayCount = 1;
            nutexb.Depth      = 1;
            nutexb.Replace(ofd.FileName);
        }