Ejemplo n.º 1
0
        public object Get(SaveBackup saveBackup)
        {
            BackupManager bum     = new BackupManager(_config, _loggerFactory, _fileSystem);
            string        message = bum.SaveBackup();

            return(new List <string> {
                message
            });
        }
Ejemplo n.º 2
0
        private void DisplayBackup(SaveBackup backup)
        {
            var lvi = new ListViewItem {
                Text = backup.Comment
            };

            lvi.SubItems.Add(backup.Saved.ToString());
            lvi.SubItems.Add(backup.BackupLocation);
            lvi.SubItems.Add(backup.SourceLocation);
            lvi.Tag = backup;
            lvBackups.Items.Add(lvi);
        }
Ejemplo n.º 3
0
 private void ExportBackup_Click(object sender, EventArgs e)
 {
     if (Data.IsEmpty)
     {
         "Nothing to save.".ShowAsError("Create passwords first!");
         return;
     }
     if (SaveBackup.ShowDialog() == DialogResult.OK)
     {
         Data.Save(SaveBackup.FileName);
         MessageBox.Show("Backup has been successfully created!", "Backup saved!", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 4
0
        private void BackupSave(string source, string destination)
        {
            try
            {
                File.Copy(source, destination);
                Log($"Backed up {source} to {destination}");
            }

            catch (Exception ex)
            {
                Log(ex.Message);
            }

            var saveBackup = new SaveBackup(destination, source, "", DateTime.Now);

            _saveBackupIndex.Add(saveBackup);
            _saveBackupIndex.Save(BackupIndexName);
        }
Ejemplo n.º 5
0
        public object Get(SaveBackup save_backup)
        {
            AuthorizationInfo user_info = _ac.GetAuthorizationInfo(Request);
            UserPolicy        policy    = _userManager.GetUserPolicy(user_info.User);

            if (!policy.IsAdministrator)
            {
                return(new List <string>()
                {
                    "Not Authorized"
                });
            }

            BackupManager bum     = new BackupManager(_config, _logger, _fileSystem);
            string        message = bum.SaveBackup();

            return(new List <string>()
            {
                message
            });
        }