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"); }
void set(GameGPD xin) { xgame = xin; for (int i = 0; i < xin.Achievements.Length; i++) listBox2.Items.Add(xin.Achievements[i].Title); if (listBox2.Items.Count > 0) listBox2.SelectedIndex = 0; Image xTitleIMGS = xin.GetImageByID(0x8000); if (xTitleIMGS != null) pictureBox4.Image = xTitleIMGS; else pictureBox4.Image = PublicResources.NoImage; string xTitleStrings = xin.GetStringByID(0x8000); if (xTitleStrings != null) textBoxX4.Text = xTitleStrings; else textBoxX4.Text = "Unknown"; for (int i = 0; i < xin.SyncRecords.Length; i++) listBox1.Items.Add(i); for (int i = 0; i < xin.IndexRecords.Length; i++) listBox3.Items.Add(i); foreach (Setting x in xin.UserSettings) { ListViewItem y = new ListViewItem(x.ID.ToString("X")); y.SubItems.Add(((GPDIDs)x.ID).ToString()); listView2.Items.Add(y); } foreach (ImageEntry x in xin.Images) listBox4.Items.Add(x.ID); if (listBox4.Items.Count > 0) listBox4.SelectedIndex = 0; if (listView2.Items.Count > 0) listView2.Items[0].Selected = true; //Setting x1 = xin.GetSettingByType(GPDIDs.GCardPictureKey); //Setting x2 = xin.GetSettingByType(GPDIDs.GCardPersonalPicture); //x1.Data = x2.Data; //x1.Update(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"); }
void set(GameGPD xin) { xgame = xin; for (int i = 0; i < xin.Achievements.Length; i++) { listBox2.Items.Add(xin.Achievements[i].Title); } if (listBox2.Items.Count > 0) { listBox2.SelectedIndex = 0; } Image xTitleIMGS = xin.GetImageByID(0x8000); if (xTitleIMGS != null) { pictureBox4.Image = xTitleIMGS; } else { pictureBox4.Image = PublicResources.NoImage; } string xTitleStrings = xin.GetStringByID(0x8000); if (xTitleStrings != null) { textBoxX4.Text = xTitleStrings; } else { textBoxX4.Text = "Unknown"; } for (int i = 0; i < xin.SyncRecords.Length; i++) { listBox1.Items.Add(i); } for (int i = 0; i < xin.IndexRecords.Length; i++) { listBox3.Items.Add(i); } foreach (Setting x in xin.UserSettings) { ListViewItem y = new ListViewItem(x.ID.ToString("X")); y.SubItems.Add(((GPDIDs)x.ID).ToString()); listView2.Items.Add(y); } foreach (ImageEntry x in xin.Images) { listBox4.Items.Add(x.ID); } if (listBox4.Items.Count > 0) { listBox4.SelectedIndex = 0; } if (listView2.Items.Count > 0) { listView2.Items[0].Selected = true; } //Setting x1 = xin.GetSettingByType(GPDIDs.GCardPictureKey); //Setting x2 = xin.GetSettingByType(GPDIDs.GCardPersonalPicture); //x1.Data = x2.Data; //x1.Update(true); }