private void SignAFile(IAzureContainer container, SourceToDestinationMap <IIoItem> file, bool strongName, CancellationTokenSource tokenSource) { var blob = IoItemFactory.Create(container.GetBlob(file.Source.Name.ToLower())); var copyToTime = CopyTo(file.Source, blob); if (tokenSource != null && tokenSource.IsCancellationRequested) { return; } SendMessage(new Message { Contents = "Starting signing for {0}".format(file.Destination.FullName), MessageType = MessageType.Info }); var r = Client.Post(new SetCodeSignatureRequest { Container = container.Name, Path = blob.Name, StrongName = strongName }); ThrowErrors(r.Errors); var statusResult = KeepGettingStatus(container.Name, blob.Name, copyToTime, tokenSource); if (statusResult.TimedOut) { throw new TimeoutException("The signing job has timed out and probably failed. If you'd like to check the status in the future for this job," + "you can call get-status again with Container={0} and Path={1}".format(container.Name, blob.Name)); } if (statusResult.Exception != null) { throw statusResult.Exception; } if (statusResult.Status == StatusCode.Failed) { throw new Exception("The signing job for {0}/{1} has failed.".format(container.Name, blob.Name)); } if (tokenSource != null && tokenSource.IsCancellationRequested) { return; } SendMessage(new Message { Contents = "Finished signing for {0}".format(file.Destination.FullName), MessageType = MessageType.Info }); CopyTo(blob, file.Destination); }
private void SignEachFile(IAzureContainer container, SourceToDestinationMap<IIoItem> file, bool strongName) { var blob = IoItemFactory.Create(container.GetBlob(file.Source.Name.ToLower())); CopyTo(file.Source, blob); SendMessage(new Message { Contents = "Starting signing for {0}".format(file.Destination.FullName), MessageType = MessageType.Info }); var r = Client.Post(new SetCodeSignatureRequest { Container = container.Name, Path = blob.Name, StrongName = strongName }); ThrowErrors(r.Errors); SendMessage(new Message { Contents = "Finished signing for {0}".format(file.Destination.FullName), MessageType = MessageType.Info }); CopyTo(blob, file.Destination); }
private void SignAFile(IAzureContainer container, SourceToDestinationMap<IIoItem> file, bool strongName, CancellationTokenSource tokenSource) { var blob = IoItemFactory.Create(container.GetBlob(file.Source.Name.ToLower())); var copyToTime = CopyTo(file.Source, blob); if (tokenSource != null && tokenSource.IsCancellationRequested) { return; } SendMessage(new Message { Contents = "Starting signing for {0}".format(file.Destination.FullName), MessageType = MessageType.Info }); var r = Client.Post(new SetCodeSignatureRequest { Container = container.Name, Path = blob.Name, StrongName = strongName }); ThrowErrors(r.Errors); var statusResult = KeepGettingStatus(container.Name, blob.Name, copyToTime, tokenSource); if (statusResult.TimedOut) { throw new TimeoutException("The signing job has timed out and probably failed. If you'd like to check the status in the future for this job," + "you can call get-status again with Container={0} and Path={1}".format(container.Name, blob.Name)); } if (statusResult.Exception != null) { throw statusResult.Exception; } if (statusResult.Status == StatusCode.Failed) { throw new Exception("The signing job for {0}/{1} has failed.".format(container.Name, blob.Name)); } if (tokenSource != null && tokenSource.IsCancellationRequested) { return; } SendMessage(new Message { Contents = "Finished signing for {0}".format(file.Destination.FullName), MessageType = MessageType.Info }); CopyTo(blob, file.Destination); }