コード例 #1
0
        private async Task BackupGWCommand()
        {
            XmlDocument xmlParameters = new XmlDocument();

            try
            {
                xmlParameters.Load(FileLocations.gwItemNames());
                xmlParameters.Save(FileLocations.gwItemNamesBackup());

                await ReplyAsync($"XML database file backed up to {FileLocations.gwItemNamesBackup()}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #2
0
        private async Task RestoreAllCommand()
        {
            XmlDocument xmlParameters = new XmlDocument();
            XmlDocument gwItems       = new XmlDocument();
            XmlDocument xmlDB         = new XmlDocument();

            try
            {
                xmlParameters.Load(FileLocations.backupXMLParameters());
                xmlParameters.Save(FileLocations.xmlParameters());
                gwItems.Load(FileLocations.gwItemNamesBackup());
                gwItems.Save(FileLocations.gwItemNames());
                xmlDB.Load(FileLocations.backupXMLDatabase());
                xmlDB.Save(FileLocations.xmlDatabase());

                await ReplyAsync("XML parameters restored");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }