Example #1
0
 public GPDViewer(GameGPD xin, string file, MainForm parent)
 {
     InitializeComponent();
     xparent = parent;
     xfile = file;
     set(xin);
 }
Example #2
0
        /// <summary>
        /// Reads a GPD from the Titles Played index of the User GPD
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="xEntry"></param>
        /// <returns></returns>
        public GameGPD ReadGame(uint ID, out FileEntry xEntry)
        {
            xEntry = null;
            if (!ParseCheck())
            {
                return(null);
            }
            if (UserGPD == null)
            {
                return(null);
            }
            FileEntry x = GetFile(ID.ToString("X") + ".gpd");

            if (x == null)
            {
                return(null);
            }
            DJsIO y = x.GetTempIO(true);

            if (y == null || !y.Accessed)
            {
                y.Close();
                VariousFunctions.DeleteFile(y.FileNameLong);
                return(null);
            }
            y.Close();
            GameGPD z = new GameGPD(y.FileNameLong, ID);

            if (z.IsValid)
            {
                xEntry = x;
                return(z);
            }
            return(null);
        }
Example #3
0
 public GPDViewer(GameGPD xin, string file, MainForm parent)
 {
     InitializeComponent();
     xparent = parent;
     xfile   = file;
     set(xin);
 }
Example #4
0
 /// <summary>
 /// Adds a game to the User GPD
 /// </summary>
 /// <param name="xTitleGPD"></param>
 /// <returns></returns>
 public bool AddGame(GameGPD xTitleGPD)
 {
     if (!ParseCheck())
     {
         return(false);
     }
     try
     {
         if (xUserGPD == null || !xUserGPD.xIO.Accessed ||
             !xTitleGPD.xIO.Accessed || !xTitleGPD.IsValid)
         {
             return(false);
         }
         if (!UserGPD.AddGameViaGPD(xTitleGPD))
         {
             LoadProfile(false);
             return(false);
         }
         if (!MakeFile(xTitleGPD.TitleID.ToString("X").ToUpper() + ".gpd", xTitleGPD.xIO, AddType.Replace))
         {
             return(false);
         }
         if (!xSaveDash())
         {
             GetFile(xTitleGPD.TitleID.ToString("X").ToLower() + ".gpd").Delete();
             LoadProfile(false);
             return(false);
         }
         return(true);
     }
     catch { return(false); }
 }
Example #5
0
 void killachievetab()
 {
     tabControlPanel10.Enabled = true;
     textBoxX4.Text            = textBoxX5.Text =
         textBoxX6.Text        = textBoxX7.Text = "";
     listBox2.Items.Clear();
     xLoadedEntry      = null;
     xLoadedGPD        = null;
     buttonX6.Enabled  = false;
     pictureBox4.Image = pictureBox3.Image = null;
 }
Example #6
0
 public Game_Orderer(ref GameGPD game)
 {
     InitializeComponent();
     xRef = game;
     for (int i = 0; i < game.Achievements.Length; i++)
     {
         if (game.Achievements[i].Unlocked)
         {
             ListViewItem x = new ListViewItem(game.Achievements[i].Title);
             x.Tag = i;
             listView1.Items.Add(x);
         }
     }
 }
Example #7
0
 public Game_Orderer(ref GameGPD game)
 {
     InitializeComponent();
     xRef = game;
     for (int i = 0; i < game.Achievements.Length; i++)
     {
         if (game.Achievements[i].Unlocked)
         {
             ListViewItem x = new ListViewItem(game.Achievements[i].Title);
             x.Tag = i;
             listView1.Items.Add(x);
         }
     }
 }
Example #8
0
        private void addFilesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog OFD = new OpenFileDialog();

            OFD.Multiselect = true;
            if (OFD.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            menuStrip1.Enabled = buttonX1.Enabled = buttonX2.Enabled = listView1.Enabled = false;
            List <ListViewItem> xItems = new List <ListViewItem>();

            progressBarX1.Value   = 0;
            progressBarX1.Maximum = OFD.FileNames.Length;
            textBoxX1.Text        = "Status: Reading files...";
            textBoxX1.Refresh();
            foreach (string x in OFD.FileNames)
            {
                GameGPD z = null;
                try
                {
                    z = new GameGPD(x, ProfileTools.GPDNameToID(Path.GetFileName(x)));
                    ListViewItem u = new ListViewItem(z.GetStringByID((long)GPDIDs.ThisTitle));
                    if (u.SubItems[0].Text == null || u.SubItems[0].Text == "")
                    {
                        z.Close();
                        continue;
                    }
                    u.SubItems.Add(z.TitleID.ToString("X2"));
                    u.SubItems.Add(x);
                    z.Close();
                    xItems.Add(u);
                }
                catch { if (z != null)
                        {
                            z.Close();
                        }
                }
                progressBarX1.Value++;
                Application.DoEvents();
            }
            listView1.Items.AddRange(xItems.ToArray());
            textBoxX1.Text     = "Status: Idle...";
            menuStrip1.Enabled = buttonX1.Enabled = buttonX2.Enabled = listView1.Enabled = true;
        }
Example #9
0
        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;
        }
Example #10
0
 /// <summary>
 /// Unlocks all achievements either Online or Offline
 /// </summary>
 /// <param name="MinutesBetween"></param>
 /// <returns></returns>
 public bool UnlockAll(uint MinutesBetween)
 {
     if (!ParseCheck())
     {
         return(false);
     }
     if (!HasDashGPD)
     {
         return(false);
     }
     try
     {
         foreach (TitlePlayedEntry xTitle in UserGPD.TitlesPlayed)
         {
             FileEntry flent;
             GameGPD   x = ReadGame(xTitle.TitleID, out flent);
             if (x == null)
             {
                 continue;
             }
             x.UnlockAll(MinutesBetween);
             uint data1 = 0;
             uint data2 = 0;
             x.FixCredAndCount();
             if (flent.Replace(x.xIO))
             {
                 xTitle.EarnedCount   = data1;
                 xTitle.EarnedWorth   = data2;
                 xTitle.PossibleWorth = x.xCalcGSP();
                 xTitle.xUpdate();
             }
         }
         xUserGPD.UpdateGamerScore();
         xSaveDash();
         return(true);
     }
     catch { return(false); }
 }
Example #11
0
 private void addFilesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog OFD = new OpenFileDialog();
     OFD.Multiselect = true;
     if (OFD.ShowDialog() != DialogResult.OK)
         return;
     menuStrip1.Enabled = buttonX1.Enabled = buttonX2.Enabled = listView1.Enabled = false;
     List<ListViewItem> xItems = new List<ListViewItem>();
     progressBarX1.Value = 0;
     progressBarX1.Maximum = OFD.FileNames.Length;
     textBoxX1.Text = "Status: Reading files...";
     textBoxX1.Refresh();
     foreach (string x in OFD.FileNames)
     {
         GameGPD z = null;
         try
         {
             z = new GameGPD(x, ProfileTools.GPDNameToID(Path.GetFileName(x)));
             ListViewItem u = new ListViewItem(z.GetStringByID((long)GPDIDs.ThisTitle));
             if (u.SubItems[0].Text == null || u.SubItems[0].Text == "")
             {
                 z.Close();
                 continue;
             }
             u.SubItems.Add(z.TitleID.ToString("X2"));
             u.SubItems.Add(x);
             z.Close();
             xItems.Add(u);
         }
         catch { if (z != null) z.Close(); }
         progressBarX1.Value++;
         Application.DoEvents();
     }
     listView1.Items.AddRange(xItems.ToArray());
     textBoxX1.Text = "Status: Idle...";
     menuStrip1.Enabled = buttonX1.Enabled = buttonX2.Enabled = listView1.Enabled = true;
 }
Example #12
0
        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;
        }
Example #13
0
        private void buttonX15_Click(object sender, EventArgs e)
        {
            if (!xprof.HasDashGPD)
            {
                return;
            }
            MultiAdder x = new MultiAdder();

            if (x.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            tabControl1.Enabled = false;
            foreach (ListViewItem y in x.listView1.Items)
            {
                try
                {
                    GameGPD z = null;
                    try { z = new GameGPD(y.SubItems[2].Text, Convert.ToUInt32(y.SubItems[1].Text, 16)); }
                    catch { continue; }
                    if (xprof.AddGame(z))
                    {
                        listBox3.Items.Add(y.SubItems[0].Text + " (" + y.SubItems[1].Text + ")");
                    }
                    else
                    {
                        SetList();
                    }
                    z.Close();
                }
                catch { }
                Application.DoEvents();
            }
            SetNmric(GPDIDs.GCardCredit, textBoxX15);
            tabControl1.Enabled = true;
        }
Example #14
0
 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;
 }
Example #15
0
 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");
 }
Example #16
0
 void killachievetab()
 {
     tabControlPanel10.Enabled = true;
     textBoxX4.Text = textBoxX5.Text =
         textBoxX6.Text = textBoxX7.Text = "";
     listBox2.Items.Clear();
     xLoadedEntry = null;
     xLoadedGPD = null;
     buttonX6.Enabled = false;
     pictureBox4.Image = pictureBox3.Image = null;
 }
Example #17
0
 private void buttonX15_Click(object sender, EventArgs e)
 {
     if (!xprof.HasDashGPD)
         return;
     MultiAdder x = new MultiAdder();
     if (x.ShowDialog() != DialogResult.OK)
         return;
     tabControl1.Enabled = false;
     foreach (ListViewItem y in x.listView1.Items)
     {
         try
         {
             GameGPD z = null;
             try { z = new GameGPD(y.SubItems[2].Text, Convert.ToUInt32(y.SubItems[1].Text, 16)); }
             catch { continue; }
             if (xprof.AddGame(z))
                 listBox3.Items.Add(y.SubItems[0].Text + " (" + y.SubItems[1].Text + ")");
             else SetList();
             z.Close();
         }
         catch { }
         Application.DoEvents();
     }
     SetNmric(GPDIDs.GCardCredit, textBoxX15);
     tabControl1.Enabled = true;
 }
 /// <summary>
 /// Reads a GPD from the Titles Played index of the User GPD
 /// </summary>
 /// <param name="ID"></param>
 /// <param name="xEntry"></param>
 /// <returns></returns>
 public GameGPD ReadGame(uint ID, out FileEntry xEntry)
 {
     xEntry = null;
     if (!ParseCheck())
         return null;
     if (UserGPD == null)
         return null;
     FileEntry x = GetFile(ID.ToString("X") + ".gpd");
     if (x == null)
         return null;
     DJsIO y = x.GetTempIO(true);
     if (y == null || !y.Accessed)
     {
         y.Close();
         VariousFunctions.DeleteFile(y.FileNameLong);
         return null;
     }
     y.Close();
     GameGPD z = new GameGPD(y.FileNameLong, ID);
     if (z.IsValid)
     {
         xEntry = x;
         return z;
     }
     return null;
 }
 /// <summary>
 /// Adds a game to the User GPD
 /// </summary>
 /// <param name="xTitleGPD"></param>
 /// <returns></returns>
 public bool AddGame(GameGPD xTitleGPD)
 {
     if (!ParseCheck())
         return false;
     try
     {
         if (xUserGPD == null || !xUserGPD.xIO.Accessed ||
             !xTitleGPD.xIO.Accessed || !xTitleGPD.IsValid)
             return false;
         if (!UserGPD.AddGameViaGPD(xTitleGPD))
         {
             LoadProfile(false);
             return false;
         }
         if (!MakeFile(xTitleGPD.TitleID.ToString("X").ToUpper() + ".gpd", xTitleGPD.xIO, AddType.Replace))
             return false;
         if (!xSaveDash())
         {
             GetFile(xTitleGPD.TitleID.ToString("X").ToLower() + ".gpd").Delete();
             LoadProfile(false);
             return false;
         }
         return true;
     }
     catch { return false; }
 }
Example #20
0
        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");
        }
Example #21
0
 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);
 }
Example #22
0
 public GPDViewer(GameGPD xin)
 {
     InitializeComponent();
     set(xin);
 }
Example #23
0
 /// <summary>
 /// Adds a game via the GPD
 /// </summary>
 /// <param name="xTitle"></param>
 /// <returns></returns>
 public bool AddGameViaGPD(GameGPD xTitle)
 {
     if (!ParseCheck())
         return false;
     if (xTitle.TitleID == 0 ||
         xTitle.TitleID == 0xFFFE07D1 || // Dash
         xTitle.TitleID == 0xFFFE07DE) // Avatar?
         return (xActive = false);
     foreach (TitlePlayedEntry x in xTitlesPlayed)
     {
         if (xTitle.TitleID != x.TitleID)
             continue;
         xActive = false;
         throw GPDExcepts.HasID;
     }
     try
     {
         string xName = xTitle.GetStringByID((long)GPDIDs.ThisTitle);
         if (xName == null)
         {
             xActive = false;
             throw GPDExcepts.NameError;
         }
         if (!xTitle.xErase())
             return (xActive = false);
         int xsize = 0x28 + ((xName.Length + 1) * 2);
         int xPosition = AllocateData(xsize);
         if (xPosition == -1)
             return (xActive = false);
         XDBFEntry xEnt = new XDBFEntry(NameSpace.Title, xTitle.TitleID, xPosition, xsize, this);
         xIO.Position = xPosition + HeaderSize;
         xIO.Write(xTitle.TitleID);
         xIO.Write((uint)xTitle.xAchievements.Count);
         xIO.Write(xTitle.xCalcUT());
         xIO.Write(xTitle.xCalcGSP());
         xIO.Write(xTitle.xCalcGST());
         xIO.Write(new byte[0x14]);
         xIO.Write(xName, StringForm.Unicode);
         xIO.Write((short)0);
         xIO.Flush();
         TitlePlayedEntry z = new TitlePlayedEntry(xEnt);
         if (!z.LoadDetails())
             return (xActive = false);
         xTitlesPlayed.Add(z);
         Setting x = xGetSetting(GPDIDs.GCardTitlesPlayed, SettingType.UInt32);
         if (x == null)
             xAddSetting((long)GPDIDs.GCardTitlesPlayed, xTitlesPlayed.Count, true, SyncType.Locale);
         else
         {
             uint xdata = (uint)x.Data;
             xdata++;
             x.Data = xdata;
             x.xUpdate(SyncType.Locale);
         }
         UpdateSync(NameSpace.Title, xTitle.TitleID, SyncType.Server);
         return (UpdateHeader() &
         !(xActive = false));
     }
     catch { return (xActive = false); }
 }
Example #24
0
 public GPDViewer(GameGPD xin)
 {
     InitializeComponent();
     set(xin);
 }
Example #25
0
 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;
 }
Example #26
0
        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); }
        }
Example #27
0
        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); }
        }
Example #28
0
 /// <summary>
 /// Updates a title from it's GPD
 /// </summary>
 /// <param name="xTitle"></param>
 /// <returns></returns>
 public bool UpdateTitle(GameGPD xTitle)
 {
     if (!ParseCheck())
         return false;
     if (xTitle.TitleID == 0 ||
         xTitle.TitleID == 0xFFFE07D1 || // Dash
         xTitle.TitleID == 0xFFFE07DE) // Avatar?
         return (xActive = false);
     try
     {
         xTitle.FCAC();
         bool xfound = false;
         foreach (TitlePlayedEntry x in xTitlesPlayed)
         {
             if (x.TitleID != xTitle.TitleID)
                 continue;
             x.EarnedCount = xTitle.CalculateUnlockCount();
             x.EarnedWorth = xTitle.CalculateTotalCred();
             x.PossibleWorth = xTitle.CalculatePossibleCred();
             x.xUpdate();
             xfound = true;
             break;
         }
         if (!xfound)
             return (xActive = false);
         return (xUpdateGS(xCalcGST()) & !(xActive = false));
     }
     catch { return false; }
 }
Example #29
0
        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);
        }