public async Task ProcessJob(int simultaniousDownloads) { try { foreach (var item in BlobJobQueue.GetDoneEnumerable()) { if (TaskCount >= simultaniousDownloads) { CheckPrintConsole(); await WaitTaskAndClean(); } AddTasks(Task.Run(item.DoJob)); } CheckPrintConsole(true); while (TaskCount > 0) { await Task.WhenAll(GetTasks()); await WaitTaskAndClean(); } } finally { _sqlLite.Dispose(); _sqlLite = null; CheckPrintConsole(true); } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { var sqlInstance = _sqlLite; if (sqlInstance != null) { sqlInstance.Dispose(); _sqlLite = null; } var runQ = BlobJobQueue; if (runQ != null) { runQ.Dispose(); BlobJobQueue = null; } } ExpectedLocalFiles = null; disposedValue = true; } }
internal FileInfo(FileInfoSqlite sqlite, ILocalFileInfo fi, SQLiteDataReader reader) : this(sqlite) { SrcFileInfo = fi; LocalName = Convert.ToString(reader["LocalName"]); RemPath = Convert.ToString(reader["RemPath"]); LastModifiedTime = Convert.ToDateTime(reader["LastModifiedTime"]); Size = Convert.ToInt64(reader["Size"]); MD5 = Convert.ToString(reader["AzureMD5"]); LastDownloadedTime = GetDateTime(reader["LastDownloadedTime"]); DeleteDetectedTime = GetDateTime(reader["DeleteDetectedTime"]); // if there is local file, than it takes precedence over database values UpdateFromFileInfo(fi); }
public Backup(string localPath, string containerName) { _localPath = localPath; _containerName = containerName; _sqlLite = new FileInfoSqlite(containerName, Path.GetFullPath(Path.Combine(_localPath, "..", "sqllite"))); }
internal FileInfo(FileInfoSqlite sqlite, ILocalFileInfo fi, BlobItem blob) : this(sqlite, blob) { SrcFileInfo = fi; UpdateFromFileInfo(fi); }
private FileInfo(FileInfoSqlite sqlite, BlobItem blob) : this(sqlite) { SrcFileInfo = blob; UpdateFromAzure(blob); }
private FileInfo(FileInfoSqlite sqlite) { _sqlLite = sqlite; }