public static List <SyncRecord> LoadRecentSyncJobs(string jobsDbPath) { List <SyncRecord> syncRecords = new List <SyncRecord>(); string conStr = new SQLiteConnectionStringBuilder { DataSource = jobsDbPath }.ToString(); string queryStr = "SELECT * FROM [sync_jobs] ORDER BY [date_time] DESC"; using (SQLiteConnection sqlCon = new SQLiteConnection(conStr)) { sqlCon.Open(); using (SQLiteCommand sqlCmd = new SQLiteCommand(queryStr, sqlCon)) { using (SQLiteDataReader dr = sqlCmd.ExecuteReader()) { while (dr.Read()) { SyncRecord record = new SyncRecord() { Settings = new SyncSetting() }; record.SyncJobId = Convert.ToString(dr["job_id"]); record.SyncDateTime = Convert.ToDateTime(dr["date_time"]); record.Settings.LocalDirectory = Convert.ToString(dr["local_directory"]); record.Settings.TargetBucket = Convert.ToString(dr["target_bucket"]); record.Settings.TargetZoneID = Convert.ToInt32(dr["target_zone_id"]); record.Settings.SyncPrefix = Convert.ToString(dr["sync_prefix"]); record.Settings.SkipPrefixes = Convert.ToString(dr["skip_prefixes"]); record.Settings.SkipSuffixes = Convert.ToString(dr["skip_suffixes"]); record.Settings.CheckNewFiles = Convert.ToBoolean(dr["check_new_files"]); record.Settings.FilenameKind = Convert.ToInt32(dr["file_name_kind"]); record.Settings.OverwriteDuplicate = Convert.ToBoolean(dr["overwrite_duplicate"]); record.Settings.DefaultChunkSize = Convert.ToInt32(dr["default_chunk_size"]); record.Settings.ChunkUploadThreshold = Convert.ToInt32(dr["chunk_upload_threshold"]); record.Settings.SyncThreadCount = Convert.ToInt32(dr["sync_thread_count"]); record.Settings.UploadFromCDN = Convert.ToBoolean(dr["upload_from_cdn"]); record.SyncDateTimeStr = record.SyncDateTime.ToString("yyyy-MM-dd HH:mm:ss"); syncRecords.Add(record); } } } } return(syncRecords); }
public static List <SyncRecord> LoadRecentSyncJobs(string jobsDbPath) { List <SyncRecord> syncRecords = new List <SyncRecord>(); string conStr = new SQLiteConnectionStringBuilder { DataSource = jobsDbPath }.ToString(); string queryStr = "SELECT * FROM [sync_jobs] ORDER BY [sync_date_time] DESC"; using (SQLiteConnection sqlCon = new SQLiteConnection(conStr)) { sqlCon.Open(); using (SQLiteCommand sqlCmd = new SQLiteCommand(queryStr, sqlCon)) { using (SQLiteDataReader dr = sqlCmd.ExecuteReader()) { while (dr.Read()) { SyncRecord record = new SyncRecord(); record.SyncId = Convert.ToString(dr["sync_id"]); record.SyncLocalDir = Convert.ToString(dr["sync_local_dir"]); record.FileType = Convert.ToInt32(dr["file_type"]); record.CheckRemoteDuplicate = Convert.ToBoolean(dr["check_remote_duplicate"]); record.SyncTargetBucket = Convert.ToString(dr["sync_target_bucket"]); record.SyncPrefix = Convert.ToString(dr["sync_prefix"]); record.CheckNewFiles = Convert.ToBoolean(dr["check_new_files"]); record.IgnoreDir = Convert.ToBoolean(dr["ignore_dir"]); record.SkipPrefixes = Convert.ToString(dr["skip_prefixes"]); record.SkipSuffixes = Convert.ToString(dr["skip_suffixes"]); record.SkipDir = Convert.ToString(dr["skip_dir"]); record.OverwriteFile = Convert.ToBoolean(dr["overwrite_file"]); record.DefaultChunkSize = Convert.ToInt32(dr["default_chunk_size"]); record.ChunkUploadThreshold = Convert.ToInt32(dr["chunk_upload_threshold"]); record.SyncThreadCount = Convert.ToInt32(dr["sync_thread_count"]); record.UploadEntryDomain = Convert.ToInt32(dr["upload_entry_domain"]); record.SyncDateTime = Convert.ToDateTime(dr["sync_date_time"]); record.SyncDateTimeStr = record.SyncDateTime.ToString("yyyy-MM-dd HH:mm:ss"); syncRecords.Add(record); } } } } return(syncRecords); }
public static List<SyncRecord> LoadRecentSyncJobs(string jobsDbPath) { List<SyncRecord> syncRecords = new List<SyncRecord>(); string conStr = new SQLiteConnectionStringBuilder { DataSource = jobsDbPath }.ToString(); string queryStr = "SELECT * FROM [sync_jobs] ORDER BY [date_time] DESC"; using (SQLiteConnection sqlCon = new SQLiteConnection(conStr)) { sqlCon.Open(); using (SQLiteCommand sqlCmd = new SQLiteCommand(queryStr, sqlCon)) { using (SQLiteDataReader dr = sqlCmd.ExecuteReader()) { while (dr.Read()) { SyncRecord record = new SyncRecord() { Settings = new SyncSetting() }; record.SyncJobId = Convert.ToString(dr["job_id"]); record.SyncDateTime = Convert.ToDateTime(dr["date_time"]); record.Settings.LocalDirectory = Convert.ToString(dr["local_directory"]); record.Settings.TargetBucket = Convert.ToString(dr["target_bucket"]); record.Settings.TargetZoneID = Convert.ToInt32(dr["target_zone_id"]); record.Settings.SyncPrefix = Convert.ToString(dr["sync_prefix"]); record.Settings.SkipPrefixes = Convert.ToString(dr["skip_prefixes"]); record.Settings.SkipSuffixes = Convert.ToString(dr["skip_suffixes"]); record.Settings.CheckNewFiles = Convert.ToBoolean(dr["check_new_files"]); record.Settings.UseShortFilename = Convert.ToBoolean(dr["use_short_filename"]); record.Settings.OverwriteDuplicate = Convert.ToBoolean(dr["overwrite_duplicate"]); record.Settings.DefaultChunkSize = Convert.ToInt32(dr["default_chunk_size"]); record.Settings.ChunkUploadThreshold = Convert.ToInt32(dr["chunk_upload_threshold"]); record.Settings.SyncThreadCount = Convert.ToInt32(dr["sync_thread_count"]); record.Settings.UploadFromCDN = Convert.ToBoolean(dr["upload_from_cdn"]); record.SyncDateTimeStr = record.SyncDateTime.ToString("yyyy-MM-dd HH:mm:ss"); syncRecords.Add(record); } } } } return syncRecords; }
public static List<SyncRecord> LoadRecentSyncJobs(string jobsDbPath) { List<SyncRecord> syncRecords = new List<SyncRecord>(); string conStr = new SQLiteConnectionStringBuilder { DataSource = jobsDbPath }.ToString(); string queryStr = "SELECT * FROM [sync_jobs] ORDER BY [sync_date_time] DESC"; using (SQLiteConnection sqlCon = new SQLiteConnection(conStr)) { sqlCon.Open(); using (SQLiteCommand sqlCmd = new SQLiteCommand(queryStr, sqlCon)) { using (SQLiteDataReader dr = sqlCmd.ExecuteReader()) { while (dr.Read()) { SyncRecord record = new SyncRecord(); record.SyncId = Convert.ToString(dr["sync_id"]); record.SyncLocalDir = Convert.ToString(dr["sync_local_dir"]); record.CheckRemoteDuplicate = Convert.ToBoolean(dr["check_remote_duplicate"]); record.SyncTargetBucket = Convert.ToString(dr["sync_target_bucket"]); record.SyncPrefix = Convert.ToString(dr["sync_prefix"]); record.CheckNewFiles = Convert.ToBoolean(dr["check_new_files"]); record.IgnoreDir = Convert.ToBoolean(dr["ignore_dir"]); record.SkipPrefixes = Convert.ToString(dr["skip_prefixes"]); record.SkipSuffixes = Convert.ToString(dr["skip_suffixes"]); record.OverwriteFile = Convert.ToBoolean(dr["overwrite_file"]); record.DefaultChunkSize = Convert.ToInt32(dr["default_chunk_size"]); record.ChunkUploadThreshold = Convert.ToInt32(dr["chunk_upload_threshold"]); record.SyncThreadCount = Convert.ToInt32(dr["sync_thread_count"]); record.UploadEntryDomain = Convert.ToInt32(dr["upload_entry_domain"]); record.SyncDateTime = Convert.ToDateTime(dr["sync_date_time"]); record.SyncDateTimeStr = record.SyncDateTime.ToString("yyyy-MM-dd HH:mm:ss"); syncRecords.Add(record); } } } } return syncRecords; }