Esempio n. 1
0
 // Token: 0x06000AF0 RID: 2800 RVA: 0x0003BD6C File Offset: 0x00039F6C
 private void FillFileCheats(container target, file file, string saveFile)
 {
     for (int i = 0; i < file.Cheats.Count; i++)
     {
         cheat cheat = file.Cheats[i];
         int   index = this.dgCheats.Rows.Add(new DataGridViewRow());
         this.dgCheats.Rows[index].Cells[1].Value = cheat.name;
         this.dgCheats.Rows[index].Cells[2].Value = cheat.note;
         if (cheat.id == "-1")
         {
             DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
             dataGridViewCellStyle.ForeColor = Color.Blue;
             this.dgCheats.Rows[index].Cells[1].Style.ApplyStyle(dataGridViewCellStyle);
             this.dgCheats.Rows[index].Cells[0].Tag = "UserCheat";
             this.dgCheats.Rows[index].Cells[1].Tag = Path.GetFileName(saveFile);
             this.dgCheats.Rows[index].Tag          = file.GetParent(target);
         }
         else
         {
             this.dgCheats.Rows[index].Cells[0].Tag = saveFile;
             this.dgCheats.Rows[index].Cells[1].Tag = cheat.id;
         }
     }
     if (file.groups.Count > 0)
     {
         foreach (group current in file.groups)
         {
             this.FillGroupCheats(file, current, saveFile, 0);
         }
     }
 }
Esempio n. 2
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>");
        }