示例#1
0
        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);
            }
        }
示例#2
0
        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;
            }
        }
示例#3
0
            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);
            }
示例#4
0
 public Backup(string localPath, string containerName)
 {
     _localPath     = localPath;
     _containerName = containerName;
     _sqlLite       = new FileInfoSqlite(containerName, Path.GetFullPath(Path.Combine(_localPath, "..", "sqllite")));
 }
示例#5
0
 internal FileInfo(FileInfoSqlite sqlite, ILocalFileInfo fi, BlobItem blob)
     : this(sqlite, blob)
 {
     SrcFileInfo = fi;
     UpdateFromFileInfo(fi);
 }
示例#6
0
 private FileInfo(FileInfoSqlite sqlite, BlobItem blob)
     : this(sqlite)
 {
     SrcFileInfo = blob;
     UpdateFromAzure(blob);
 }
示例#7
0
 private FileInfo(FileInfoSqlite sqlite)
 {
     _sqlLite = sqlite;
 }