void SarcEditor(object sender, EventArgs e) { OpenFileDialog opn = new OpenFileDialog() { Filter = "szs file|*.szs|every file|*.*" }; if (opn.ShowDialog() != DialogResult.OK) { return; } byte[] file = File.ReadAllBytes(opn.FileName); if (file[0] == 'S' && file[1] == 'A' && file[2] == 'R' && file[3] == 'C') { new SarcEditor(SARC.UnpackRamN(file)).Show(); } else if (file[0] == 'Y' && file[1] == 'a' && file[2] == 'z' && file[3] == '0') { new SarcEditor(SARC.UnpackRamN(YAZ0.Decompress(file))).Show(); } else { MessageBox.Show("Unknown file format"); } }
public void OpenFile(string filename, Stream file) { new SarcEditor(SARC.UnpackRamN(file)).Show(); }