public static VhdUploadContext Upload(UploadParameters uploadParameters) { Program.SyncOutput = new PSSyncOutputEvents(uploadParameters.Cmdlet); BlobCreatorBase blobCreator; if (uploadParameters.BaseImageUri != null) { blobCreator = new PatchingBlobCreator(uploadParameters.LocalFilePath, uploadParameters.DestinationUri, uploadParameters.BaseImageUri, uploadParameters.BlobObjectFactory, uploadParameters.OverWrite); } else { blobCreator = new BlobCreator(uploadParameters.LocalFilePath, uploadParameters.DestinationUri, uploadParameters.BlobObjectFactory, uploadParameters.OverWrite); } using (var uploadContext = blobCreator.Create()) { var synchronizer = new BlobSynchronizer(uploadContext, uploadParameters.NumberOfUploaderThreads); if (synchronizer.Synchronize()) { return(new VhdUploadContext { LocalFilePath = uploadParameters.LocalFilePath, DestinationUri = uploadParameters.DestinationUri.Uri }); } return(null); } }
public static VhdUploadContext Upload(UploadParameters uploadParameters) { Program.SyncOutput = new PSSyncOutputEvents(uploadParameters.Cmdlet); BlobCreatorBase blobCreator; if (uploadParameters.BaseImageUri != null) { blobCreator = new PatchingBlobCreator(uploadParameters.LocalFilePath, uploadParameters.DestinationUri, uploadParameters.BaseImageUri, uploadParameters.BlobObjectFactory, uploadParameters.OverWrite); } else { blobCreator = new BlobCreator(uploadParameters.LocalFilePath, uploadParameters.DestinationUri, uploadParameters.BlobObjectFactory, uploadParameters.OverWrite); } using (var uploadContext = blobCreator.Create()) { var synchronizer = new BlobSynchronizer(uploadContext, uploadParameters.NumberOfUploaderThreads); if (synchronizer.Synchronize()) { return new VhdUploadContext {LocalFilePath = uploadParameters.LocalFilePath, DestinationUri = uploadParameters.DestinationUri.Uri}; } return null; } }