예제 #1
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>");
        }