Esempio n. 1
0
        private void ButtonBackupServer_Click(object sender, RoutedEventArgs e)
        {
            if (ListServers.SelectedItem == null)
            {
                return;
            }

            var server = ListServers.SelectedItem as Server;

            var files = FtpManager.DownloadWorldFiles(server);

            var backups = DataManager.BackupFtpFiles(server, files);

            // replace backups in memory
            App.Backups.Clear();
            foreach (var b in backups)
            {
                App.Backups.Add(b);
            }

            // save files to backup location
            BackupDataManager.SaveData(backups);

            // associate the backups and servers with one another from the new backup
            App.AssociateCollections();

            return;
        }
Esempio n. 2
0
        private void OnTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            Server server = ((ServerBackupTimer)sender).Server;

            ModalMessage("backing up server: " + server.NameAndDescription);

            //download file from ftp server
            var files = FtpManager.DownloadWorldFiles(server);

            //Write downloaded world files to disk, also cleans up old files and backup entries
            var backups = DataManager.BackupFtpFiles(server, files);

            //save backup metadata to disk
            BackupDataManager.SaveData(backups);

            ModalMessage("backup complete - " + backups.Count + " backups added");
        }