コード例 #1
0
ファイル: SoulHunt_XmlCore.cs プロジェクト: angel2230/ZZZ
        public void SaveDialogs()
        {
            if (Dialogs.LoadingFailed)
            {
                return;
            }

            CreateBackupDirectory();

            SHDialogStringSaver stringSaver = new SHDialogStringSaver();

            stringSaver.Save(Dialogs, ref LocalXml.DialogString);

            // Backup
            File.Copy(SHGlobal.GetServerSystemFolder() + "\\dialog.xml", Directory.GetCurrentDirectory() + "\\Backup\\dialog." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true);

            SHDialogStringReplacer replacer = new SHDialogStringReplacer();

            replacer.ReplaceStringToKey(ref Dialogs);

            // Save
            SHGlobal.Serialize <SHDialogsXml>(SHGlobal.GetClientSystemFolder() + "\\dialog.xml", Dialogs, Encoding.UTF8);
            SHGlobal.Serialize <SHDialogsXml>(SHGlobal.GetServerSystemFolder() + "\\dialog.xml", Dialogs, Encoding.UTF8);

            // 복구
            replacer.ReplaceKeyToString(ref Dialogs, ref LocalXml.DialogString, false);
        }
コード例 #2
0
ファイル: SoulHunt_XmlCore.cs プロジェクト: angel2230/ZZZ
        public void LoadDialogs()
        {
            Dialogs = SHGlobal.Deserialize <SHDialogsXml>(SHGlobal.GetServerSystemFolder() + "\\dialog.xml", Encoding.UTF8);
            if (Dialogs == null)
            {
                Dialogs = new SHDialogsXml();
                Dialogs.LoadingFail();
            }

            SHDialogStringReplacer replacer = new SHDialogStringReplacer();

            replacer.ReplaceKeyToString(ref Dialogs, ref LocalXml.DialogString, true);

            Dialogs.Compile();
        }