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 listView1_ItemDrag(object sender, ItemDragEventArgs e) { if (listView1.SelectedItems.Count == 0) { return; } if (e.Button != MouseButtons.Left) { return; } isitem = true; xparent.Enabled = false; string folder = VariousFunctions.GetTempFileLocale(); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string[] file; byte[] rand = new byte[10]; new Random().NextBytes(rand); temp = rand.HexString(); file = new string[1] { folder + "/" + temp }; var data = new DataObject(DataFormats.FileDrop, file); data.SetData(DataFormats.StringFormat, file[0]); File.Create(file[0]).Dispose(); File.SetAttributes(folder + "/" + temp, FileAttributes.Hidden | FileAttributes.Temporary); xWatcher.Filter = temp; xWatcher.NotifyFilter = NotifyFilters.FileName; xWatcher.Created += new FileSystemEventHandler(xWatch_Created); xWatcher.EnableRaisingEvents = xWatcher.IncludeSubdirectories = true; DoDragDrop(data, DragDropEffects.Move); xparent.Enabled = true; Application.DoEvents(); VariousFunctions.DeleteFile(folder + "/" + temp); }
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; }
private void listBox3_SelectedIndexChanged(object sender, EventArgs e) { if (listBox3.SelectedIndex < 0) { return; } tabControl1.Enabled = false; buttonX12.Enabled = true; TitlePlayedEntry x = xprof.UserGPD.TitlesPlayed[listBox3.SelectedIndex]; try { dateTimePicker3.Value = dateTimePicker4.Value = x.LastLoadedDT; } catch { dateTimePicker3.Value = dateTimePicker4.Value = DateTime.Now; } textBoxX14.Text = "Unlocked " + x.EarnedCount.ToString() + " of " + x.PossibleCount.ToString(); textBoxX14.Text += Environment.NewLine + "Total of " + x.EarnedWorth.ToString() + " of " + x.PossibleWorth.ToString(); string path = x.TitleID.ToString("X").ToUpper() + ".gpd"; FileEntry xent = xPackage.GetFile(path); if (xent == null) { Log("Error: could not find GPD"); killachievetab(); tabControl1.Enabled = true; return; } string xOut = VariousFunctions.GetTempFileLocale(); if (!xent.Extract(xOut)) { Log("Extraction error"); killachievetab(); tabControl1.Enabled = true; return; } GameGPD xload = new GameGPD(xOut, x.TitleID); if (!xload.IsValid) { Log("Error when parsing GPD"); xload.Close(); try { VariousFunctions.DeleteFile(xOut); } catch { } xload = null; killachievetab(); tabControl1.Enabled = true; return; } listBox2.Items.Clear(); for (int i = 0; i < xload.Achievements.Length; i++) { listBox2.Items.Add(xload.Achievements[i].Title); } Image xTitleIMGS = xload.GetImageByID(0x8000); if (xTitleIMGS != null) { pictureBox4.Image = xTitleIMGS; } else { pictureBox4.Image = PublicResources.NoImage; } string xTitleStrings = xload.GetStringByID(0x8000); if (xTitleStrings != null) { textBoxX4.Text = xTitleStrings; } else { textBoxX4.Text = "Unknown"; } xLoadedGPD = xload; xLoadedEntry = xent; if (listBox2.Items.Count > 0) { listBox2.SelectedIndex = 0; } listBox2_SelectedIndexChanged(null, null); buttonX11.Enabled = buttonX3.Enabled = buttonX10.Enabled = tabControl1.Enabled = buttonX6.Enabled = tabControlPanel10.Enabled = true; Log("GPD Loaded"); }