private void SaveGridData() { try { if (this.dataGridView.Rows != null) { foreach (DataGridViewRow row in this.dataGridView.Rows) { FolderInfo fi = new FolderInfo(); fi.FolderSourcePath = (string)row.Cells["Folder"].Value; fi.NumberOfSubFolderInSource = (long)row.Cells["NumOfSubs"].Value; fi.NumberOfSubFoldersInDestination = (long)row.Cells["NumSubFoldersInBackup"].Value; fi.NumberOfFilesInSource = (long)row.Cells["NumOfFiles"].Value; fi.NumberOfSubFoldersInDestination = (long)row.Cells["NumFilesInBackup"].Value; fi.SizeOfFolderInSource = (long)row.Cells["SizeMb"].Value; fi.SizeOfFolderInDestination = (long)row.Cells["SizeInMbInBackup"].Value; fi.IsDeleted = (bool)row.Cells["IsDeleted"].Value; m_FI.Add(fi.GetUnitKey(), fi); } m_FI.SaveData(); } } catch (Exception exp) { Logger.WriteErrorLogOnly(exp, "9723c66b-45b6-4a8a-b000-f27afd28f1c1"); Logger.ShowErrorMessageBox(exp, "Failed to save folder list."); } }
public void f1() { try { //SettingsConfigDict s = new SettingsConfigDict(InitSettingDictObjecForDebugModeSettingFileCreationDelegate); Settings _tSettings = null; _tSettings = new Settings(); _tSettings.BackupDestinationRootPath = @"C:\Development"; _tSettings.BackupTime = new DateTime(1, 1, 1, 5, 0, 0); _tSettings.BackupDays = (int)(enumWeekdays.Monday | enumWeekdays.Tuesday | enumWeekdays.Wednesday | enumWeekdays.Thursday | enumWeekdays.Friday); m_Settings.Add(_tSettings.GetUnitKey(), _tSettings); m_Settings.SaveData(); // if(_tSettings.BackupDays & (int)enumWeekdays.Friday == (int)enumWeekdays.Friday) // if( _tSettings.BackupDays & (int)enumWeekdays.Friday > 0) FolderInfo fi = null; foreach (string path in Directory.GetDirectories(@"C:\Development")) { fi = new FolderInfo(); fi.FolderSourcePath = path; fi.NumberOfFilesInSource = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Count(); fi.NumberOfSubFolderInSource = Directory.GetDirectories(path, "*", SearchOption.AllDirectories).Count(); m_FI.Add(fi.GetUnitKey(), fi); } m_FI.SaveData(); } catch (Exception exp) { Logger.WriteError(exp, "cb720904-ae44-4536-9c72-e1d0828ef0bd"); } }