private void decompressScriptToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog fd = new OpenFileDialog(); fd.FileName = "All PSB Files|*.psb;*.scn;*.pimg"; if (fd.ShowDialog() != DialogResult.OK) { return; } byte[] Content = System.IO.File.ReadAllBytes(fd.FileName); System.IO.File.WriteAllBytes(fd.FileName, PSBStrMan.ExtractMDF(Content)); MessageBox.Show("Finished"); }
void tryRecoveryToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "All PSB Files|*.psb;*.scn;*.pimg"; DialogResult dr = ofd.ShowDialog(); if (dr == DialogResult.OK) { try { byte[] data = System.IO.File.ReadAllBytes(ofd.FileName); var PSBManager = new PSBStrMan(data); data = PSBManager.TryRecovery(); System.IO.File.WriteAllBytes(ofd.FileName, data); MessageBox.Show("Package Offset's Updated", "ScnEditorGUI", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Failed To Recovery:\n" + ex.Message, "ScnEditorGUI", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }