private void loadInViewerToolStripMenuItem1_Click(object sender, EventArgs e) { this.Enabled = false; FileEntry xent = xprof.GetFile(xprof.UserGPD.TitlesPlayed[listBox3.SelectedIndex].ID.ToString("X") + ".gpd"); if (xent == null) { Log("Could not find specified file"); this.Enabled = true; return; } Log("Extracting " + xent.Name + "..."); string xOut = VariousFunctions.GetTempFileLocale(); if (!xent.Extract(xOut)) { Log("Extraction error"); VariousFunctions.DeleteFile(xOut); this.Enabled = true; return; } GameGPD xload = new GameGPD(xOut, ProfileTools.GPDNameToID(xent.Name)); if (!xload.IsValid) { Log("Error when parsing GPD"); xload.Close(); try { VariousFunctions.DeleteFile(xOut); } catch { } this.Enabled = true; return; } GPDViewer x = new GPDViewer(xload); x.MdiParent = xMForm; x.Show(); Log("GPD Loaded"); this.Enabled = true; }
private void loadInViewerToolStripMenuItem_Click(object sender, EventArgs e) { if (listView1.SelectedIndices.Count == 0) { return; } FileEntry xent = (FileEntry)listView1.SelectedItems[0].Tag; this.Enabled = false; Log("Extracting " + xent.Name + "..."); string xOut = VariousFunctions.GetTempFileLocale(); if (!xent.Extract(xOut)) { Log("Extraction error"); this.Enabled = true; return; } GameGPD xload = new GameGPD(xOut, ProfileTools.GPDNameToID(xent.Name)); if (!xload.IsValid) { Log("Error when parsing GPD"); xload.Close(); try { VariousFunctions.DeleteFile(xOut); } catch { } this.Enabled = true; return; } GPDViewer x = new GPDViewer(xload); x.MdiParent = xMForm; x.Show(); Log("GPD Loaded"); this.Enabled = true; }
void ReadFile(string file) { try { switch (VariousFunctions.ReadFileType(file)) { case XboxFileType.STFS: { LogRecord x = new LogRecord(); STFSPackage xPackage = new STFSPackage(file, x); if (!xPackage.ParseSuccess) { return; } PackageExplorer xExplorer = new PackageExplorer(this); xExplorer.listBox4.Items.AddRange(x.Log); x.WhenLogged += new LogRecord.OnLog(xExplorer.xAddLog); xExplorer.set(ref xPackage); xExplorer.Show(); } break; case XboxFileType.SVOD: { SVODPackage hd = new SVODPackage(file, null); if (!hd.IsValid) { return; } HDDGameForm frm = new HDDGameForm(hd, file, this); frm.MdiParent = this; frm.Show(); } break; case XboxFileType.Music: { MusicFile xfile = new MusicFile(file); MusicView xview = new MusicView(this, file, xfile); xview.MdiParent = this; xview.Show(); } break; case XboxFileType.GPD: { GameGPD y = new GameGPD(file, 0xFFFFFFFF); GPDViewer z = new GPDViewer(y, file, this); z.MdiParent = this; z.Show(); } break; case XboxFileType.FATX: { FATXDrive xdrive = new FATXDrive(file); Files.Add(file); FATXBrowser y = new FATXBrowser(xdrive, file, this); y.MdiParent = this; y.Show(); } break; case XboxFileType.GDF: { StatsForm x = new StatsForm(0); x.Text = "Select Deviation"; if (x.ShowDialog() != DialogResult.OK) { return; } GDFImage ximg = new GDFImage(file, x.ChosenID); if (!ximg.Valid) { throw new Exception("Invalid package"); } GDFViewer xViewer = new GDFViewer(ximg, this); xViewer.MdiParent = this; xViewer.Show(); } break; default: MessageBox.Show("Error: Unknown file"); return; } Files.Add(file); } catch (Exception x) { MessageBox.Show(x.Message); } }
private void loadInViewerToolStripMenuItem_Click(object sender, EventArgs e) { if (listView1.SelectedIndices.Count == 0) return; FileEntry xent = (FileEntry)listView1.SelectedItems[0].Tag; this.Enabled = false; Log("Extracting " + xent.Name + "..."); string xOut = VariousFunctions.GetTempFileLocale(); if (!xent.Extract(xOut)) { Log("Extraction error"); this.Enabled = true; return; } GameGPD xload = new GameGPD(xOut, ProfileTools.GPDNameToID(xent.Name)); if (!xload.IsValid) { Log("Error when parsing GPD"); xload.Close(); try { VariousFunctions.DeleteFile(xOut); } catch { } this.Enabled = true; return; } GPDViewer x = new GPDViewer(xload); x.MdiParent = xMForm; x.Show(); Log("GPD Loaded"); this.Enabled = true; }
void ReadFile(string file) { try { switch (VariousFunctions.ReadFileType(file)) { case XboxFileType.STFS: { LogRecord x = new LogRecord(); STFSPackage xPackage = new STFSPackage(file, x); if (!xPackage.ParseSuccess) return; PackageExplorer xExplorer = new PackageExplorer(this); xExplorer.listBox4.Items.AddRange(x.Log); x.WhenLogged += new LogRecord.OnLog(xExplorer.xAddLog); xExplorer.set(ref xPackage); xExplorer.Show(); } break; case XboxFileType.SVOD: { SVODPackage hd = new SVODPackage(file, null); if (!hd.IsValid) return; HDDGameForm frm = new HDDGameForm(hd, file, this); frm.MdiParent = this; frm.Show(); } break; case XboxFileType.Music: { MusicFile xfile = new MusicFile(file); MusicView xview = new MusicView(this, file, xfile); xview.MdiParent = this; xview.Show(); } break; case XboxFileType.GPD: { GameGPD y = new GameGPD(file, 0xFFFFFFFF); GPDViewer z = new GPDViewer(y, file, this); z.MdiParent = this; z.Show(); } break; case XboxFileType.FATX: { FATXDrive xdrive = new FATXDrive(file); Files.Add(file); FATXBrowser y = new FATXBrowser(xdrive, file, this); y.MdiParent = this; y.Show(); } break; case XboxFileType.GDF: { StatsForm x = new StatsForm(0); x.Text = "Select Deviation"; if (x.ShowDialog() != DialogResult.OK) return; GDFImage ximg = new GDFImage(file, x.ChosenID); if (!ximg.Valid) throw new Exception("Invalid package"); GDFViewer xViewer = new GDFViewer(ximg, this); xViewer.MdiParent = this; xViewer.Show(); } break; default: MessageBox.Show("Error: Unknown file"); return; } Files.Add(file); } catch (Exception x) { MessageBox.Show(x.Message); } }