Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        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");
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 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");
        }