Пример #1
0
 public void set(ref STFSPackage x)
 {
     xpack = x;
     Log("Package parsed");
     node1.NodeClick += new EventHandler(xReturn_NodeClick);
     SetNodes();
     node1.SetChecked(true, eTreeAction.Expand);
     Log("Contents loaded");
     if (xPackage.FileNameShort.Length < 30)
     {
         this.Text = "Package - " + xPackage.FileNameShort;
     }
     else
     {
         this.Text = "Package - " + xPackage.FileNameShort.Substring(0, 30) + "...";
     }
     textBoxX1.Text = xPackage.FileNameLong;
     textBoxX2.Text = xPackage.Header.Title_Display;
     textBoxX3.Text = xPackage.Header.Description;
     try { pictureBox1.Image = xPackage.Header.ContentImage; }
     catch { pictureBox1.Enabled = false; }
     try { pictureBox2.Image = xPackage.Header.PackageImage; }
     catch { pictureBox2.Enabled = false; }
     comboBoxEx1.SelectedIndex = 0;
     numericUpDown5.Value      = xPackage.Header.SaveConsoleID;
     numericUpDown6.Value      = xPackage.Header.ProfileID;
     textBoxX17.Text           = xPackage.Header.DeviceID.HexString();
     numericUpDown9_ValueChanged(null, null);
     if (xPackage.Header.IDTransfer == TransferLock.NoTransfer)
     {
         checkBoxX1.Checked = false;
     }
     else
     {
         checkBoxX2.Checked = ((byte)xPackage.Header.IDTransfer & 1) == 1;
         checkBoxX3.Checked = (((byte)xPackage.Header.IDTransfer >> 1) & 1) == 1;
     }
     labelX8.Text = "Title ID: " + xpack.Header.TitleID.ToString("X");
     if (xPackage.Header.ThisType != PackageType.Profile)
     {
         tabItem4.Visible = false;
         return;
     }
     xprof = new ProfilePackage(ref x);
     xpack = null;
     xprof.RemovePhDAT();
     if (xprof.HasValidAccount)
     {
         if (xprof.UserFile.IsLiveEnabled)
         {
             textBoxX9.Text             = VariousFunctions.EndianConvert(BitConverter.GetBytes(xprof.UserFile.XUID)).HexString();
             textBoxX9.Enabled          =
                 buttonX4.Enabled       =
                     checkBoxX5.Enabled = true;
             PassCode[] xPass = xprof.UserFile.GetPassCode();
             if (xPass.Length > 0)
             {
                 checkBoxX5.Checked       = true;
                 comboBoxEx3.SelectedItem = xPass[0];
                 comboBoxEx4.SelectedItem = xPass[1];
                 comboBoxEx5.SelectedItem = xPass[2];
                 comboBoxEx6.SelectedItem = xPass[3];
             }
         }
         textBoxX8.Text   = xprof.UserFile.GetGamertag();
         buttonX5.Enabled = true;
         Log("Account loaded");
     }
     if (xprof.HasDashGPD)
     {
         UserInfo xInfo = xprof.GetUserStrings();
         if (xInfo.Bio != null)
         {
             textBoxX10.Text = xInfo.Bio;
         }
         if (xInfo.Motto != null)
         {
             textBoxX11.Text = xInfo.Motto;
         }
         if (xInfo.Name != null)
         {
             textBoxX12.Text = xInfo.Name;
         }
         if (xInfo.Location != null)
         {
             textBoxX13.Text = xInfo.Location;
         }
         Setting temp = xprof.UserGPD.GetSetting(GPDIDs.GCardZone);
         if (temp != null)
         {
             comboBoxEx7.Enabled = true;
             GamerZone[] zones = (GamerZone[])Enum.GetValues(typeof(GamerZone));
             comboBoxEx7.DataSource = zones;
             if (Enum.IsDefined(typeof(GamerZone), temp.Data))
             {
                 comboBoxEx7.SelectedItem = (GamerZone)((uint)temp.Data);
             }
             else
             {
                 comboBoxEx7.SelectedItem = GamerZone.Unknown;
             }
             has1 = buttonX16.Enabled = true;
         }
         temp = xprof.UserGPD.GetSetting(GPDIDs.GCardRep, SettingType.Float);
         if (temp != null)
         {
             numericUpDown1.Enabled = true;
             numericUpDown1.Value   = (decimal)((float)temp.Data);
             has2 = buttonX16.Enabled = true;
         }
         SetList();
         buttonX15.Enabled    =
             listBox3.Enabled = true;
         // groupPanel2.Enabled = true;
         SetNmric(GPDIDs.GCardCredit, textBoxX15);
         Log("Profile loaded");
     }
     if (!xprof.IsValidProfile)
     {
         if (xprof.HasValidAccount && !xprof.HasDashGPD)
         {
             MessageBox.Show("This file does not have valid Dash information, therefore achievement modding is disabled");
         }
         else if (!xprof.HasValidAccount && xprof.HasDashGPD)
         {
             MessageBox.Show("This file does not have a valid user account, therefore, account block editing is disabled");
         }
         else
         {
             tabItem4.Visible = false;
             MessageBox.Show("This file has no valid user information, profile - specific editing is disabled");
         }
     }
 }