private void BackupStart(BackupSetInfo SettingsInfoOf) { response = backup.BackupFiles(SettingsInfoOf); if (_Info == true) { this.Invoke(new BackupFinishedDelegate(BackupFinished)); } }
public frmProgress(BackupSetInfo SettingsInfoOf, Boolean Info) { _Info = Info; InitializeComponent(); settingsInfo = SettingsInfoOf; if (Info == false) { t = new Thread(delegate() { BackupStart(this.settingsInfo); }); t.Start(); } }
public void LoadBackupSets() { this.ListOfBackupSetInfo.Clear(); foreach (string fullFile in Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory)) { string[] fileArray = fullFile.Split(new char[] { '\\' }); string file = fileArray[fileArray.GetUpperBound(0)]; if (file.EndsWith(".backupset")) { BackupSetInfo si = (BackupSetInfo)DeserializeXml(file, typeof(BackupSetInfo)); this.ListOfBackupSetInfo.Add(si); } } }
public void Update(BackupSetInfo BackupSetInfoOf) { bool isUpdate = false; for (int i = 0; i < this.ListOfBackupSetInfo.Count; i++) { if (this.ListOfBackupSetInfo[i].BackupName == BackupSetInfoOf.BackupName) { this.ListOfBackupSetInfo[i] = BackupSetInfoOf; isUpdate = true; } } if (!isUpdate) { this.ListOfBackupSetInfo.Add(BackupSetInfoOf); } SerializeXml(BackupSetInfoOf.BackupName.Replace(" ", "") + ".backupset", typeof(BackupSetInfo), BackupSetInfoOf); }
public frmOptions(BackupSetInfo SettingsInfoOf) { InitializeComponent(); bs = SettingsInfoOf; tbxName.Text = bs.BackupName; #region Snr if (bs.BackupSnr == "" || bs.BackupUSB == "false") { label6.Text = "nicht aktiviert"; } else { label6.Text = bs.BackupSnr; } #endregion tbxDescription.Text = bs.BackupDescription; tbxBackupTo.Text = bs.BackupToDirectory; tbxAlternative.Text = bs.BackupToAlternative; maskedTextBox1.Text = bs.BackupStunde + ":" + bs.BackupMin; #region zip if (bs.BackupZip == "true") { checkBox13.Checked = true; } else { checkBox13.Checked = false; } #endregion #region Shadow if (bs.BackupShadow == "true") { checkBox4.Checked = true; } else { checkBox4.Checked = false; } #endregion #region Löschen if (bs.BackupDel == "true") { cbLöschen.Checked = true; } else { cbLöschen.Checked = false; } #endregion #region usb if (bs.BackupUSB == "true") { checkBox1.Checked = true; } else { checkBox1.Checked = false; } #endregion #region Wend if (bs.BackupWend == "true") { checkBox3.Checked = true; } else { checkBox3.Checked = false; } #endregion #region Wstart if (bs.BackupWstart == "true") { checkBox2.Checked = true; } else { checkBox2.Checked = false; } #endregion #region Schedule if (bs.BackupSchedule == "true") { checkBox5.Checked = true; } else { checkBox5.Checked = false; } #endregion #region So if (bs.BackupSo == "true") { checkBox12.Checked = true; } else { checkBox12.Checked = false; } #endregion #region Mo if (bs.BackupMo == "true") { checkBox6.Checked = true; } else { checkBox6.Checked = false; } #endregion #region Di if (bs.BackupDi == "true") { checkBox7.Checked = true; } else { checkBox7.Checked = false; } #endregion #region Mi if (bs.BackupMi == "true") { checkBox8.Checked = true; } else { checkBox8.Checked = false; } #endregion #region Do if (bs.BackupDo == "true") { checkBox9.Checked = true; } else { checkBox9.Checked = false; } #endregion #region Fr if (bs.BackupFr == "true") { checkBox10.Checked = true; } else { checkBox10.Checked = false; } #endregion #region Sa if (bs.BackupSa == "true") { checkBox11.Checked = true; } else { checkBox11.Checked = false; } #endregion if (bs.BackupDirectories != null) { foreach (string s in bs.BackupDirectories) { lbDirs.Items.Add(s); } } }
public frmOptions() { InitializeComponent(); bs = new BackupSetInfo(); }
public BackupResponseInfo BackupFiles(BackupSetInfo BackupSetInfoOf) { Stopwatch watch = new Stopwatch(); watch.Start(); string backupLocation = ""; BackupResponseInfo response = new BackupResponseInfo(); foreach (string sS in BackupSetInfoOf.BackupDirectories) { if (!Directory.Exists(sS)) { response.IsSuccess = false; response.Message += "Fehler im Backup. Verzeichniss " + sS + " existiert nicht.\r\n"; } if (!Directory.Exists(BackupSetInfoOf.BackupToDirectory)) { response.IsSuccess = false; response.Message += "Fehler im Backup. Verzeichniss " + BackupSetInfoOf.BackupToDirectory + " existiert nicht.\r\n"; } } if (BackupSetInfoOf.BackupZip == "true") { backupLocation = BackupSetInfoOf.BackupToDirectory + BackupSetInfoOf.BackupName; mZip = "true"; } else { backupLocation = BackupSetInfoOf.BackupToDirectory + BackupSetInfoOf.BackupName + "_" + DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss") + "\\"; } if (response.Message.Length < 1) { // Zählen foreach (string sS in BackupSetInfoOf.BackupDirectories) { if (BackupSetInfoOf.BackupZip == "false") { DirectoryInfo dD = new DirectoryInfo(backupLocation + sS.Replace(":", "")); dD.Create(); CopyDirectory(new DirectoryInfo(sS), dD, true); } //else //{ // DirectoryInfo zD = new DirectoryInfo(backupLocation); // ZipDirectory(new DirectoryInfo(sS), zD, false); //} } // Kopieren int _z = 0; string _backupLocation = backupLocation; foreach (string sS in BackupSetInfoOf.BackupDirectories) { if (BackupSetInfoOf.BackupZip == "false") { DirectoryInfo dD = new DirectoryInfo(backupLocation + sS.Replace(":", "")); dD.Create(); CopyDirectory(new DirectoryInfo(sS), dD, false); } else { _z = _z + 1; backupLocation = _backupLocation + "_" + Convert.ToString(_z) + "--" + Convert.ToString(BackupSetInfoOf.BackupDirectories.Count) + "_" + DateTime.Now.ToString("dd-MM-yyyy hh-mm-ss") + ".zip"; DirectoryInfo zD = new DirectoryInfo(backupLocation); ZipDirectory(new DirectoryInfo(sS), zD, false);; } } // Fertig watch.Stop(); response.IsSuccess = true; response.Message += "Backup erfolgreich beendet. Time spent: " + watch.Elapsed; } return(response); }