private BlobJob GetBlobJob(BlobItem blob) { var itemCount = Interlocked.Increment(ref TotalItems); if (itemCount % 5000 == 0) { // set progress JobChar for next console update AddJobChar('.'); CheckPrintConsole(); } if (blob == null) { Interlocked.Increment(ref IgnoredItems); return(null); } Interlocked.Add(ref TotalSize, blob.Size); var localFileName = blob.GetLocalFileName(); var bJob = new BlobJob(this, blob, Path.Combine(_localPath, localFileName)); if (localFileName == null) { throw new NullReferenceException(); } lock (ExpectedLocalFilesLock) ExpectedLocalFiles.Add(localFileName); bJob.FileInfo = _sqlLite.GetFileInfo(blob, bJob.LocalFilePath); bJob.AddDownloaded = AddDownloaded; return(bJob); }
internal void UpdateFromAzure(BlobItem blob) { LocalName = blob.GetLocalFileName(); RemPath = blob.Uri.AbsolutePath; LastModifiedTime = blob.LastModifiedUtc.UtcDateTime; Size = blob.Size; MD5 = blob.MD5; }
public ILocalFileInfo GetFileInfo(BlobItem blob, string localFilename = null) { ILocalFileInfo lfi = localFilename == null ? null : new LocalFileInfoDisk(localFilename); var fi = GetFileInfo(lfi, blob.GetLocalFileName()); if (fi != null) { return(fi); } // create new instance ((LocalFileInfoDisk)lfi)?.GetMd5(); fi = new FileInfo(this, lfi, blob); // make sure we insert item when there is nothing found ExecuteNonQuery("INSERT INTO " + SQL_TABLENAME + " (LocalName, RemPath, LastModifiedTime, Size, AzureMD5, LastDownloadedTime, DeleteDetectedTime)" + " VALUES (@1, @2, @3, @4, @5, @6, @7)", fi.LocalName, fi.RemPath, fi.LastModifiedTime, fi.Size, fi.MD5, fi.LastDownloadedTime, fi.DeleteDetectedTime); return(fi); }