Esempio n. 1
0
        public static void SaveEncrypted(SpiritDataOptions spiritData, string fileLocation, string fileName)
        {
            fileLocation = FixFolderEndPath(fileLocation);

            Directory.CreateDirectory(fileLocation);
            SaveToEncryptedFile(ConvertDataToXDocument(spiritData), fileLocation + fileName);
        }
Esempio n. 2
0
        public static void SaveUnencrypted(SpiritDataOptions spiritData, string fileLocation, string fileName)
        {
            fileLocation = FixFolderEndPath(fileLocation);

            // Save the version for local editing.
            Directory.CreateDirectory(fileLocation);

            SaveToFile(ConvertDataToXDocument(spiritData), fileLocation + fileName);
        }
Esempio n. 3
0
        public static XDocument BuildXml(SpiritDataOptions dataList)
        {
            XDocument doc =
                new XDocument(new XDeclaration("1.0", "utf-8", null),
                              new XElement("struct",
                                           new XElement("uint",
                                                        new XAttribute("hash", "data_version"), 8),
                                           // <list hash="db_root">	// <*DataList.Type* hash="*DataTbl.Type*">
                                           new XElement("list",
                                                        new XAttribute("hash", "db_root"),
                                                        //<struct index="0">	// <struct index="*DataListItem.GetIndex*">
                                                        dataList.GetData().Select(data =>
                                                                                  ((DataTbl)data).GetAsXElement(dataList.GetItemIndex(data))
                                                                                  )
                                                        )
                                           )
                              );

            return(doc);
        }
Esempio n. 4
0
        public static void Save(BattleDataOptions battleData, FighterDataOptions fighterData, string fileLocation, string fileName, SpiritDataOptions spiritData = null, bool unencrypted = true, bool encrypted = true, bool useFolderStructure = false, bool saveSpiritTitles = true)
        {
            fileLocation += @"\";

            if (unencrypted)
            {
                var pathMod = useFolderStructure ? "" : config.unencr_sub;
                SaveUnencrypted(battleData, fighterData, fileLocation + pathMod, fileName);
            }
            if (encrypted)
            {
                SaveEncrypted(battleData, fighterData, fileLocation, fileName, useFolderStructure);
                if (spiritData?.HasData() ?? false)
                {
                    var loc = MiscDbsToSave();
                    SaveEncrypted(spiritData, Path.GetDirectoryName(loc), Path.GetFileName(loc));
                }
            }

            if (saveSpiritTitles)
            {
                SaveSpiritTitles(battleData.GetBattles(), config.file_directory_preload);
            }
        }
Esempio n. 5
0
 public static XDocument ConvertDataToXDocument(SpiritDataOptions spiritData)
 {
     return(XmlHelper.BuildXml(spiritData));
 }