Exemple #1
0
        private static void SavePVRAsPNGFile(TextureModder.PVRConfig config, List <Byte> pvrData, String outputDirectory, int index)
        {
            var texture = new VrSharp.PvrTexture.PvrTexture(pvrData.ToArray());

            config.Add(texture);
            var bitmap = texture.ToBitmap();

            bitmap.Save(outputDirectory + "/RIPPED_" + index + ".png");
            bitmap.Dispose();
        }
Exemple #2
0
        public static void SavePVRAsPNGFiles(TextureModder.PVRConfig config, List <List <Byte> > pvrData, String outputDirectory)
        {
            int index = 0;

            foreach (var pvr in pvrData)
            {
                try
                {
                    SavePVRAsPNGFile(config, pvr, outputDirectory, index);
                }
                catch (CannotDecodePvrException)
                {
                    SavePVRFile(pvr, outputDirectory, index);
                }
                index++;
            }
        }
        private void convertToPNGButton_Click(object sender, EventArgs e)
        {
            ValidateControlsForExport();

            try
            {
                byte[] binData = System.IO.File.ReadAllBytes(BinToExportFilePathTextBox.Text);
                var    pvrData = JSReverse.JSR.BinToPVR(binData);

                var config = new TextureModder.PVRConfig();
                JSReverse.JSR.SavePVRAsPNGFiles(config, pvrData, ExportedTexturesDirectoryTextBox.Text);
                config.Save(ExportedTexturesDirectoryTextBox.Text + "/" + Preferences.PVR_CONFIG_FILENAME);
            }
            catch (Exception ex)
            {
                ExportErrorLabel.Text = ex.Message;
                return;
            }

            ExportSuccessLabel.Text = "Success";
        }