Beispiel #1
0
        private void GatherInformation(string Location)
        {
            try {
                this.STFSP = new STFSPackage(Location, this.Log);
                if (this.STFSP.ParseSuccess)
                {
                    try {
                        pb_content.Image = this.STFSP.Header.ContentImage;
                        pb_package.Image = this.STFSP.Header.PackageImage;
                    } catch { }

                    tb_display.Text   = this.STFSP.Header.Title_Display;
                    tb_titleName.Text = this.STFSP.Header.Title_Package;
                    tb_deviceID.Text  = Conversion.BytesToHexString(this.STFSP.Header.DeviceID);
                    tb_titleID.Text   = this.STFSP.Header.TitleID.ToString("X2").ToUpper();
                    this.STFSP.CloseIO();
                    // Now we'll do our own shit to get the location of where this package goes.
                    List <byte> fileBytes = FileEx.ReadBytes(Location, 0, 0x9725).ToList();
                    string[]    accepted  = { "LIVE", "PIRS", "CON " };
                    string      fileType  = Encoding.UTF8.GetString(fileBytes.GetRange(0, 0x4).ToArray());
                    if (accepted.Contains(fileType))
                    {
                        tb_consoleID.Text = Conversion.BytesToHexString(fileBytes.GetRange(0x36C, 0x4).ToArray());
                        tb_profileID.Text = Conversion.BytesToHexString(fileBytes.GetRange(0x371, 0x4).ToArray());
                        string SubFolder   = Conversion.BytesToHexString(fileBytes.GetRange(0x344, 0x4).ToArray());
                        string TitleFolder = Conversion.BytesToHexString(fileBytes.GetRange(0x360, 0x4).ToArray());
                        string ContentRoot = this.STFSP.Header.ThisType != PackageType.Profile ? Conversion.BytesToHexString(fileBytes.GetRange(0x364, 0x8).ToArray()) : this.STFSP.Header.Title_Display;
                        string Revision    = Convert.ToInt32(fileBytes.GetRange(0x9724, 0x1).ToArray()[0]).ToString();
                        lbl_rootFolder.Text   = ContentRoot;
                        lbl_titleFolder.Text  = TitleFolder;
                        lbl_subFolder.Text    = SubFolder;
                        tb_fullDirectory.Text = String.Format("HDD:\\Content\\{0}\\{1}\\{2}", ContentRoot, TitleFolder, SubFolder);
                        this.Text             = String.Format("Game Info - {0}: TU {1}", (tb_titleName.Text != "" ? tb_titleName.Text : Xbox.HexTitleToName(Convert.ToUInt32(tb_titleID.Text, 16))), Revision);
                    }
                    else
                    {
                        if (MessageBox.Show(Location + "\r\n\r\nInvalid file format! " + fileType, "Invalid Format", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK)
                        {
                            return;
                        }
                    }
                }
            } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message, "Error Loading File", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
Beispiel #2
0
        private void frm_game_info_multiple_Load(object sender, EventArgs e)
        {
            new Thread(new ThreadStart(delegate {
                for (int i = 0; i < Files.Count(); i++)
                {
                    Image Content  = null, Package = null;
                    bool Error     = false, HasImage = true;
                    string Display = "", Title = "", DeviceID = "", TitleID = "", ConsoleID = "", ProfileID = "", SubFolder = "", TitleFolder = "", ContentRoot = "", FullDirectory = "", Hash = "", Revision = "";

                    STFSP = new STFSPackage(this.Files[i], Logs);
                    if (STFSP.ParseSuccess)
                    {
                        try {
                            try {
                                Content = this.STFSP.Header.ContentImage;
                                Package = this.STFSP.Header.PackageImage;
                            } catch { HasImage = false; }

                            Display  = this.STFSP.Header.Title_Display;
                            Title    = this.STFSP.Header.Title_Package;
                            DeviceID = Conversion.BytesToHexString(this.STFSP.Header.DeviceID);
                            TitleID  = this.STFSP.Header.TitleID.ToString("X2").ToUpper();
                            this.STFSP.CloseIO();

                            List <byte> fileBytes = FileEx.ReadBytes(this.Files[i], 0, 0x9725 /*0x450*/).ToList();
                            string[] accepted     = { "LIVE", "PIRS", "CON " };
                            string fileType       = Encoding.UTF8.GetString(fileBytes.GetRange(0, 0x4).ToArray());
                            if (accepted.Contains(fileType))
                            {
                                ConsoleID     = Conversion.BytesToHexString(fileBytes.GetRange(0x36C, 0x4).ToArray());
                                ProfileID     = Conversion.BytesToHexString(fileBytes.GetRange(0x371, 0x4).ToArray());
                                SubFolder     = Conversion.BytesToHexString(fileBytes.GetRange(0x344, 0x4).ToArray());
                                TitleFolder   = Conversion.BytesToHexString(fileBytes.GetRange(0x360, 0x4).ToArray());
                                Revision      = Convert.ToInt32(fileBytes.GetRange(0x9724, 0x1).ToArray()[0]).ToString();
                                ContentRoot   = this.STFSP.Header.ThisType != PackageType.Profile ? Conversion.BytesToHexString(fileBytes.GetRange(0x364, 0x8).ToArray()) : this.STFSP.Header.Title_Display;
                                FullDirectory = String.Format("HDD:\\Content\\{0}\\{1}\\{2}", ContentRoot, TitleFolder, SubFolder);
                                Hash          = Hashing.MD5(fileBytes.ToArray()).Substring(0, 12).ToUpper();
                            }
                        } catch { Invoke(new MethodInvoker(() => { Error = true; this.Text = String.Format("Game Info - {0}/{1} | Errors: {2}", this.Successes, this.Files.Count(), this.Errors++); })); }
                        Info.Add(new STFSInfo {
                            Display = Display, Title = TitleFolder, DeviceID = DeviceID, TitleID = TitleID, ConsoleID = ConsoleID, ProfileID = ProfileID, Sub = SubFolder, TitleName = Title,
                            Content = Content, FullDirectory = FullDirectory, Package = Package, Root = ContentRoot, Local = this.Files[i], Error = Error, Hash = Hash, HasImage = HasImage, Revision = Revision
                        });
                        Invoke(new MethodInvoker(() => {
                            this.Text = String.Format("Game Info - {0}/{1}{2}{3}", this.Successes++, this.Files.Count(), (Error ? " | Errors: " : ""), (Error ? this.Errors.ToString() : ""));
                            if (!Error)
                            {
                                FormE.ListViews.addToListView(lv_main, TitleID, (Title == "" ? Xbox.HexTitleToName(Convert.ToUInt32(TitleID, 16)) : Title), "Loaded", Hash, Revision);
                            }
                        }));
                    }
                    else
                    {
                        this.Errors++;
                    }
                }
                Invoke(new MethodInvoker(() => { this.Text = "Game Info - Finished Loading Files"; this.Finished = true; Info.ForEach(s => Console.WriteLine(s.ToString())); }));
            })).Start();
        }