コード例 #1
0
        private void AddTasProjLumps(ZipStateSaver bs, bool isBackup = false)
        {
            var settings = JsonConvert.SerializeObject(TasStateManager.Settings);

            bs.PutLump(BinaryStateLump.StateHistorySettings, tw => tw.WriteLine(settings));
            bs.PutLump(BinaryStateLump.LagLog, tw => LagLog.Save(tw));
            bs.PutLump(BinaryStateLump.Markers, tw => tw.WriteLine(Markers.ToString()));

            if (ClientSettingsForSave != null)
            {
                var clientSettingsJson = ClientSettingsForSave();
                bs.PutLump(BinaryStateLump.ClientSettings, (TextWriter tw) => tw.Write(clientSettingsJson));
            }

            if (VerificationLog.Any())
            {
                bs.PutLump(BinaryStateLump.VerificationLog, tw => tw.WriteLine(VerificationLog.ToInputLog()));
            }

            if (Branches.Any())
            {
                Branches.Save(bs);
            }

            bs.PutLump(BinaryStateLump.Session, tw => tw.WriteLine(JsonConvert.SerializeObject(TasSession)));

            if (!isBackup)
            {
                bs.PutLump(BinaryStateLump.StateHistory, bw => TasStateManager.SaveStateHistory(bw));
            }
        }