Exemple #1
0
        public async Task ParseLsxAsync(IProgress <string> progress)
        {
            // update progress
            progress.Report("Loading unpacked savegame.");
            await Task.Delay(1);

            // load xml
            var doc     = new XmlDocument();
            var metaDoc = new XmlDocument();

            doc.Load(UnpackDirectory + Path.DirectorySeparatorChar + "globals.lsx");
            metaDoc.Load(UnpackDirectory + Path.DirectorySeparatorChar + "meta.lsx");
            // update progress
            progress.Report("Analysing savegame.");
            await Task.Delay(1);

            // parse xlml
            Players = LsxParser.ParsePlayer(doc);
            Meta    = LsxParser.ParseMeta(metaDoc);
            // update progress
            progress.Report("Loading data.");
            await Task.Delay(1);

            DataTable.UserGenerationBoosts = LsxParser.GenerationBoostCollector.ToArray();
            DataTable.UserStatsBoosts      = LsxParser.StatsBoostsCollector.ToArray();
        }
        /// <summary>
        /// unpack savegame to UnpackDirectory (lsv->lsx)
        /// </summary>
        public void GetMetaBackgroundWorker(object sender, DoWorkEventArgs e)
        {
            var worker = sender as BackgroundWorker;

            // unpackage
            var packager = new Packager();

            packager.UncompressPackage(SavegameFullFile, UnpackDirectory);
            if (worker?.CancellationPending == true)
            {
                e.Cancel = true;
                return;
            }
            var outputVersion = GameVersion == Game.DivinityOriginalSin2
                ? FileVersion.VerExtendedNodes
                : FileVersion.VerChunkedCompress;

            // uncompress and save meta.lsf
            ResourceUtils.SaveResource(
                ResourceUtils.LoadResource(UnpackDirectory + Path.DirectorySeparatorChar + "meta.lsf"),
                UnpackDirectory + Path.DirectorySeparatorChar + "meta.lsx", ResourceFormat.LSX, outputVersion);
            if (worker?.CancellationPending == true)
            {
                e.Cancel = true;
                return;
            }
            var metaDoc = new XmlDocument();

            metaDoc.Load(UnpackDirectory + Path.DirectorySeparatorChar + "meta.lsx");
            e.Result = LsxParser.ParseMeta(metaDoc);
        }
        public void WriteEditsToLsx()
        {
            // load xml
            var doc = new XmlDocument();

            doc.Load(UnpackDirectory + Path.DirectorySeparatorChar + "globals.lsx");

            doc = LsxParser.WritePlayer(doc, Players);

            doc.Save(UnpackDirectory + Path.DirectorySeparatorChar + "globals.lsx");
        }
        public void ParseLsx()
        {
            // load xml
            var doc = new XmlDocument();

            doc.Load(UnpackDirectory + Path.DirectorySeparatorChar + "globals.lsx");

            Players = LsxParser.ParsePlayer(doc);
            DataTable.UserGenerationBoosts = LsxParser.GenerationBoostCollector.ToArray();
            DataTable.UserStatsBoosts      = LsxParser.StatsBoostsCollector.ToArray();
        }
Exemple #5
0
        public async Task WriteEditsToLsxAsync(IProgress <string> progress)
        {
            // update progress
            progress.Report("Loading package.");
            await Task.Delay(1);

            // load xml
            var doc = new XmlDocument();

            doc.Load(UnpackDirectory + Path.DirectorySeparatorChar + "globals.lsx");

            // update progress
            progress.Report("Applying changes.");
            await Task.Delay(1);

            doc = LsxParser.WritePlayer(doc, Players);

            // update progress
            progress.Report("Saving package.");
            await Task.Delay(1);

            doc.Save(UnpackDirectory + Path.DirectorySeparatorChar + "globals.lsx");
        }