CmisSync.Lib.Consumer.SituationSolver.AbstractEnhancedSolver.DownloadCacheFile C# (CSharp) Метод

DownloadCacheFile() защищенный Метод

protected DownloadCacheFile ( IFileInfo target, IDocument remoteDocument, Transmission transmission, IFileSystemInfoFactory fsFactory ) : byte[]
target IFileInfo
remoteDocument IDocument
transmission CmisSync.Lib.FileTransmission.Transmission
fsFactory IFileSystemInfoFactory
Результат byte[]
        protected byte[] DownloadCacheFile(IFileInfo target, IDocument remoteDocument, Transmission transmission, IFileSystemInfoFactory fsFactory) {
            if (!this.LoadCacheFile(target, remoteDocument, fsFactory)) {
                if (target.Exists) {
                    target.Delete();
                }
            }

            using (var hashAlg = new SHA1Reuse()) {
                using (var filestream = target.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None))
                using (var downloader = ContentTaskUtils.CreateDownloader()) {
                    try {
                        downloader.DownloadFile(remoteDocument, filestream, transmission, hashAlg, (byte[] checksumUpdate, long length) => this.SaveCacheFile(target, remoteDocument, checksumUpdate, length, transmission));
                        if (this.TransmissionStorage != null) {
                            this.TransmissionStorage.RemoveObjectByRemoteObjectId(remoteDocument.Id);
                        }
                    } catch (Exception ex) {
                        transmission.FailedException = ex;
                        throw;
                    }
                }

                target.Refresh();
                return hashAlg.Hash;
            }
        }