Example #1
0
 // Token: 0x06000AF2 RID: 2802 RVA: 0x0003C1AC File Offset: 0x0003A3AC
 private bool ContainsGameFile(List <file> allGameFile, file @internal)
 {
     foreach (file current in allGameFile)
     {
         if (current.id == @internal.id)
         {
             return(true);
         }
     }
     return(false);
 }
Example #2
0
        // Token: 0x06000AFC RID: 2812 RVA: 0x0003CC18 File Offset: 0x0003AE18
        private void editCodeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int   index    = this.dgCheats.SelectedRows[0].Index;
            file  gameFile = this.m_game.GetGameFile(this.m_game.GetTargetGameFolder(), this.dgCheats.Rows[index].Cells[0].Tag.ToString());
            cheat cheat    = null;

            foreach (cheat current in gameFile.Cheats)
            {
                if (current.name == this.dgCheats.Rows[index].Cells[1].Value.ToString())
                {
                    cheat = current;
                    break;
                }
            }
            if (cheat == null)
            {
                return;
            }
            List <string> list             = new List <string>();
            container     targetGameFolder = this.m_game.GetTargetGameFolder();

            foreach (file current2 in targetGameFolder.files._files)
            {
                foreach (cheat current3 in current2.Cheats)
                {
                    if (current3.name != this.dgCheats.Rows[index].Cells[1].Value.ToString())
                    {
                        list.Add(current3.name);
                    }
                }
            }
            AddCode addCode = new AddCode(cheat, list);

            if (addCode.ShowDialog() == DialogResult.OK)
            {
                cheat cheat2 = new cheat("-1", addCode.Description, addCode.Comment);
                cheat2.code = addCode.Code;
                for (int i = 0; i < gameFile.Cheats.Count; i++)
                {
                    if (gameFile.Cheats[i].name == this.dgCheats.Rows[index].Cells[1].Value.ToString())
                    {
                        gameFile.Cheats[i] = cheat2;
                    }
                }
                this.SaveUserCheats();
                this.m_bCheatsModified = true;
            }
            this.FillCheats(addCode.Description);
        }
Example #3
0
        // Token: 0x06000AFF RID: 2815 RVA: 0x0003D050 File Offset: 0x0003B250
        private void deleteCodeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int index = this.dgCheats.SelectedRows[0].Index;

            if (index >= 0 && MessageBox.Show(Resources.msgConfirmDelete, Resources.warnTitle, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                container targetGameFolder = this.m_game.GetTargetGameFolder();
                file      gameFile         = this.m_game.GetGameFile(targetGameFolder, this.dgCheats.Rows[index].Cells[0].Tag.ToString());
                for (int i = 0; i < gameFile.Cheats.Count; i++)
                {
                    if (gameFile.Cheats[i].name == this.dgCheats.Rows[index].Cells[1].Value.ToString())
                    {
                        gameFile.Cheats.RemoveAt(i);
                        break;
                    }
                }
                this.SaveUserCheats();
                this.FillCheats(null);
                this.m_bCheatsModified = true;
            }
        }
Example #4
0
 // Token: 0x06000105 RID: 261 RVA: 0x00009AAC File Offset: 0x00007CAC
 public file GetParent(container gamefolder)
 {
     foreach (file current in gamefolder.files._files)
     {
         if (current.id == this.id)
         {
             file result = null;
             return(result);
         }
         if (current.internals != null)
         {
             foreach (file current2 in current.internals.files)
             {
                 if (current2.id == this.id)
                 {
                     file result = current;
                     return(result);
                 }
             }
         }
     }
     return(null);
 }
Example #5
0
        // Token: 0x06000AEF RID: 2799 RVA: 0x0003B6BC File Offset: 0x000398BC
        private void FillCheats(string highlight)
        {
            this.dgCheats.Rows.Clear();
            container targetGameFolder = this.m_game.GetTargetGameFolder();

            if (targetGameFolder != null)
            {
                this.Select.Visible = true;
                List <cheat> allCheats = this.m_game.GetAllCheats();
                if (allCheats.Count == 0)
                {
                    int index = this.dgCheats.Rows.Add(new DataGridViewRow());
                    DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
                    dataGridViewCellStyle.ForeColor        = Color.Gray;
                    this.dgCheats.Rows[index].Cells[0].Tag = "NoCheats";
                    dataGridViewCellStyle.Font             = new Font(this.dgCheats.Font, FontStyle.Italic);
                    this.dgCheats.Rows[index].Cells[1].Style.ApplyStyle(dataGridViewCellStyle);
                    this.dgCheats.Rows[index].Cells[1].Value = Resources.lblNoCheats;
                }
                if (targetGameFolder.preprocess == 1 && this.m_gameFiles != null && this.m_gameFiles.Count > 0)
                {
                    container   container = container.Copy(targetGameFolder);
                    List <file> arg_132_0 = container.files._files;
                    targetGameFolder.files._files = new List <file>();
                    foreach (string current in this.m_gameFiles)
                    {
                        file file = file.GetGameFile(container, this.m_game.LocalSaveFolder, current);
                        if (file != null)
                        {
                            file          = file.Copy(file);
                            file.filename = current;
                            targetGameFolder.files._files.Add(file);
                        }
                    }
                }
                using (List <file> .Enumerator enumerator2 = targetGameFolder.files._files.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        file current2 = enumerator2.Current;
                        if (targetGameFolder.files._files.Count > 1)
                        {
                            int index2 = this.dgCheats.Rows.Add(new DataGridViewRow());
                            this.dgCheats.Rows[index2].Cells[1].Value = current2.VisibleFileName;
                            this.dgCheats.Rows[index2].Cells[2].Value = "";
                            this.dgCheats.Rows[index2].Cells[1].Tag   = current2.id;
                            this.dgCheats.Rows[index2].Cells[0].Tag   = "GameFile";
                        }
                        foreach (cheat current3 in current2.cheats._cheats)
                        {
                            int index2 = this.dgCheats.Rows.Add(new DataGridViewRow());
                            this.dgCheats.Rows[index2].Cells[1].Value = current3.name;
                            this.dgCheats.Rows[index2].Cells[2].Value = current3.note;
                            this.dgCheats.Rows[index2].Cells[1].Tag   = current3.id;
                            this.dgCheats.Rows[index2].Cells[0].Tag   = current2.filename;
                            if (current3.id == "-1")
                            {
                                this.dgCheats.Rows[index2].Tag          = "UserCheat";
                                this.dgCheats.Rows[index2].Cells[1].Tag = current3.code;
                            }
                        }
                        foreach (group current4 in current2.groups)
                        {
                            this.FillGroupCheats(current2, current4, current2.filename, 0);
                        }
                    }
                    goto IL_5D8;
                }
            }
            if (this.m_bShowOnly)
            {
                this.Select.Visible   = false;
                this.btnApply.Enabled = false;
                foreach (container current5 in this.m_game.containers._containers)
                {
                    foreach (file current6 in current5.files._files)
                    {
                        foreach (cheat current7 in current6.cheats._cheats)
                        {
                            int index3 = this.dgCheats.Rows.Add();
                            this.dgCheats.Rows[index3].Cells[1].Value = current7.name;
                            this.dgCheats.Rows[index3].Cells[2].Value = current7.note;
                        }
                        foreach (group current8 in current6.groups)
                        {
                            this.FillGroupCheats(current6, current8, current6.filename, 0);
                        }
                    }
                }
            }
IL_5D8:
            this.RefreshValue();
        }
        // Token: 0x0600003E RID: 62 RVA: 0x000055A0 File Offset: 0x000037A0
        private void cbSaveFiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!this.m_bTextMode && this.provider != null && this.provider.Length > 0L)
            {
                this.provider.ApplyChanges();
            }
            container targetGameFolder = this.m_game.GetTargetGameFolder();

            if (!string.IsNullOrEmpty(this.m_cursaveFile) && this.m_saveFilesData.ContainsKey(this.m_cursaveFile))
            {
                file gameFile = this.m_game.GetGameFile(targetGameFolder, this.m_cursaveFile);
                if (gameFile.TextMode == 0)
                {
                    this.m_saveFilesData[this.m_cursaveFile] = this.provider.Bytes.ToArray();
                }
                else if (gameFile.TextMode == 2)
                {
                    this.m_saveFilesData[this.m_cursaveFile] = Encoding.ASCII.GetBytes(this.txtSaveData.Text);
                }
                else if (gameFile.TextMode == 3)
                {
                    this.m_saveFilesData[this.m_cursaveFile] = Encoding.Unicode.GetBytes(this.txtSaveData.Text);
                }
                else
                {
                    this.m_saveFilesData[this.m_cursaveFile] = Encoding.UTF8.GetBytes(this.txtSaveData.Text);
                }
            }
            this.lstCheats.Items.Clear();
            this.lstValues.Items.Clear();
            this.m_cursaveFile = this.cbSaveFiles.SelectedItem.ToString();
            List <cheat> cheats = this.m_game.GetCheats(this.m_game.LocalSaveFolder.Substring(0, this.m_game.LocalSaveFolder.Length - 4), this.m_cursaveFile);

            if (cheats != null)
            {
                foreach (cheat current in cheats)
                {
                    if (current.id == "-1")
                    {
                        this.lstCheats.Items.Add(current.name);
                    }
                }
            }
            if (this.lstCheats.Items.Count > 0)
            {
                this.lstCheats.SelectedIndex = 0;
            }
            file gameFile2 = this.m_game.GetGameFile(targetGameFolder, this.m_cursaveFile);

            if (gameFile2 != null && gameFile2.TextMode > 0)
            {
                this.txtSaveData.Visible = true;
                this.hexBox1.Visible     = false;
                if (gameFile2.TextMode == 1)
                {
                    this.txtSaveData.Text = Encoding.UTF8.GetString(this.m_saveFilesData[this.m_cursaveFile]);
                }
                if (gameFile2.TextMode == 3)
                {
                    this.txtSaveData.Text = Encoding.Unicode.GetString(this.m_saveFilesData[this.m_cursaveFile]);
                }
                else
                {
                    this.txtSaveData.Text = Encoding.ASCII.GetString(this.m_saveFilesData[this.m_cursaveFile]);
                }
                this.m_bTextMode               = true;
                this.txtSaveData.TextChanged  += new EventHandler(this.txtSaveData_TextChanged);
                this.lblAddress.Visible        = false;
                this.lblOffset.Visible         = false;
                this.txtSaveData.HideSelection = false;
                return;
            }
            this.hexBox1.Visible           = true;
            this.lblAddress.Visible        = true;
            this.lblOffset.Visible         = true;
            this.txtSaveData.HideSelection = true;
            this.txtSaveData.Visible       = false;
            this.provider                       = new DynamicByteProvider(this.m_saveFilesData[this.m_cursaveFile]);
            this.provider.Changed              += new EventHandler(this.provider_Changed);
            this.provider.LengthChanged        += new EventHandler(this.provider_LengthChanged);
            this.hexBox1.ByteProvider           = this.provider;
            this.hexBox1.BytesPerLine           = 16;
            this.hexBox1.UseFixedBytesPerLine   = true;
            this.hexBox1.VScrollBarVisible      = true;
            this.hexBox1.LineInfoVisible        = true;
            this.hexBox1.StringViewVisible      = true;
            this.hexBox1.SelectionStartChanged += new EventHandler(this.hexBox1_SelectionStartChanged);
        }
        // Token: 0x0600002F RID: 47 RVA: 0x00004A08 File Offset: 0x00002C08
        private void btnApply_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(Resources.warnOverwriteAdv, Resources.warnTitle, MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }
            if (!this.m_bTextMode)
            {
                this.provider.ApplyChanges();
                if (this.m_cursaveFile == null)
                {
                    this.m_cursaveFile = this.cbSaveFiles.SelectedItem.ToString();
                }
                this.m_saveFilesData[this.m_cursaveFile] = this.provider.Bytes.ToArray();
            }
            else
            {
                container targetGameFolder = this.m_game.GetTargetGameFolder();
                file      gameFile         = this.m_game.GetGameFile(targetGameFolder, this.m_cursaveFile);
                if (gameFile.TextMode == 1)
                {
                    this.m_saveFilesData[this.m_cursaveFile] = Encoding.UTF8.GetBytes(this.txtSaveData.Text);
                }
                else if (gameFile.TextMode == 3)
                {
                    this.m_saveFilesData[this.m_cursaveFile] = Encoding.Unicode.GetBytes(this.txtSaveData.Text);
                }
                else
                {
                    this.m_saveFilesData[this.m_cursaveFile] = Encoding.ASCII.GetBytes(this.txtSaveData.Text);
                }
            }
            if (this.m_game.GetTargetGameFolder() == null)
            {
                MessageBox.Show(Resources.errSaveData, Resources.msgError);
                return;
            }
            this.m_game.GetTargetGameFolder();
            List <string> dirtyFiles = this.m_DirtyFiles;
            List <string> list       = new List <string>();

            foreach (string current in dirtyFiles)
            {
                string text = Path.Combine(ZipUtil.GetPs3SeTempFolder(), "_file_" + Path.GetFileName(current));
                File.WriteAllBytes(text, this.m_saveFilesData[Path.GetFileName(current)]);
                if (list.IndexOf(text) < 0)
                {
                    list.Add(text);
                }
            }
            List <string> containerFiles = this.m_game.GetContainerFiles();
            string        text2          = this.m_game.LocalSaveFolder.Substring(0, this.m_game.LocalSaveFolder.Length - 4);
            string        hash           = Util.GetHash(text2);
            bool          cache          = Util.GetCache(hash);
            string        text3          = this.m_game.ToString(list, "encrypt");

            if (cache)
            {
                containerFiles.Remove(text2);
                text3 = text3.Replace("<pfs><name>" + Path.GetFileNameWithoutExtension(this.m_game.LocalSaveFolder) + "</name></pfs>", string.Concat(new string[]
                {
                    "<pfs><name>",
                    Path.GetFileNameWithoutExtension(this.m_game.LocalSaveFolder),
                    "</name><md5>",
                    hash,
                    "</md5></pfs>"
                }));
            }
            list.AddRange(containerFiles);
            string tempFolder = Util.GetTempFolder();
            string text4      = tempFolder + "ps4_list.xml";

            File.WriteAllText(text4, text3);
            list.Add(text4);
            string profile = (string)this.cbProfile.SelectedItem;
            AdvancedSaveUploaderForEncrypt advancedSaveUploaderForEncrypt = new AdvancedSaveUploaderForEncrypt(list.ToArray(), this.m_game, profile, "encrypt");

            advancedSaveUploaderForEncrypt.ShowDialog();
            File.Delete(text4);
            Directory.Delete(ZipUtil.GetPs3SeTempFolder(), true);
            base.DialogResult = DialogResult.OK;
            base.Close();
        }
Example #8
0
        // Token: 0x060000A3 RID: 163 RVA: 0x00007A94 File Offset: 0x00005C94
        public string ToString(bool bSelectedCheatFilesOnly, List <string> lstSaveFiles)
        {
            container     targetGameFolder = this.GetTargetGameFolder();
            List <string> containerFiles   = this.GetContainerFiles();
            string        text             = string.Format("<game id=\"{0}\" mode=\"{1}\"><key><name>{2}</name></key><pfs><name>{3}</name></pfs><files>", new object[]
            {
                this.id,
                "patch",
                Path.GetFileName(containerFiles[0]),
                Path.GetFileName(containerFiles[1])
            });

            this.GetSaveFiles();
            if (targetGameFolder != null)
            {
                Dictionary <string, string> dictionary = new Dictionary <string, string>();
                foreach (string current in lstSaveFiles)
                {
                    file gameFile = file.GetGameFile(targetGameFolder, this.LocalSaveFolder, current);
                    if (gameFile != null)
                    {
                        bool flag = false;
                        if (!bSelectedCheatFilesOnly)
                        {
                            flag = true;
                        }
                        else
                        {
                            for (int i = 0; i < gameFile.Cheats.Count; i++)
                            {
                                if (gameFile.Cheats[i].Selected)
                                {
                                    flag = true;
                                }
                            }
                            if (gameFile.groups != null)
                            {
                                foreach (group current2 in gameFile.groups)
                                {
                                    if (current2.CheatsSelected)
                                    {
                                        flag = true;
                                    }
                                }
                            }
                        }
                        if (flag)
                        {
                            string text2 = current;
                            if (dictionary.ContainsKey(text2))
                            {
                                text = text.Replace(string.Concat(new string[]
                                {
                                    "<file><fileid>",
                                    gameFile.id,
                                    "</fileid><name>",
                                    text2,
                                    "</name></file>"
                                }), "");
                                dictionary.Remove(text2);
                            }
                            if (!dictionary.ContainsKey(text2) && gameFile.GetParent(targetGameFolder) == null)
                            {
                                text += "<file>";
                                text  = text + "<name>" + text2 + "</name>";
                                dictionary.Add(text2, gameFile.id);
                                if (gameFile.GetAllCheats().Count > 0)
                                {
                                    text += "<cheats>";
                                    foreach (cheat current3 in gameFile.Cheats)
                                    {
                                        if (current3.Selected)
                                        {
                                            text += current3.ToString(targetGameFolder.quickmode > 0);
                                        }
                                    }
                                    if (gameFile.groups != null)
                                    {
                                        foreach (group current4 in gameFile.groups)
                                        {
                                            text += current4.SelectedCheats;
                                        }
                                    }
                                    text += "</cheats>";
                                }
                                text += "</file>";
                            }
                            if (gameFile.GetParent(targetGameFolder) != null)
                            {
                                file parent = gameFile.GetParent(targetGameFolder);
                                if (parent.internals != null)
                                {
                                    foreach (file current5 in parent.internals.files)
                                    {
                                        if (!dictionary.ContainsValue(current5.id))
                                        {
                                            if (current.IndexOf(current5.filename) > 0)
                                            {
                                                text += "<file>";
                                                text  = text + "<fileid>" + gameFile.id + "</fileid>";
                                                text  = text + "<name>" + Path.GetFileName(text2) + "</name>";
                                                dictionary.Add(Path.GetFileName(text2), gameFile.id);
                                                if (gameFile.Cheats.Count > 0)
                                                {
                                                    text += "<cheats>";
                                                    foreach (cheat current6 in gameFile.Cheats)
                                                    {
                                                        text += current6.ToString(targetGameFolder.quickmode > 0);
                                                    }
                                                    text += "</cheats>";
                                                }
                                                text += "</file>";
                                            }
                                            else
                                            {
                                                string path = Path.Combine(this.LocalSaveFolder, current5.filename);
                                                text = text + "<file><fileid>" + current5.id + "</fileid>";
                                                text = text + "<name>" + current5.filename + "</name></file>";
                                                dictionary.Add(Path.GetFileName(path), current5.id);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            text = text.Replace("<cheats></cheats>", "");
            return(text += "</files></game>");
        }