Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("\r\nsymbol-upload -oOUTPATH <files>");
                return;
            }

            var    files   = new List <string>();
            string outPath = null;

            foreach (var arg in args)
            {
                if (arg.StartsWith("-o"))
                {
                    outPath = arg.Substring(2);
                    continue;
                }

                files.Add(arg);
            }

            if (outPath == null)
            {
                Console.WriteLine("No output path specified.");
                return;
            }

            var inputFiles = files.SelectMany(file =>
            {
                string directoryName = Path.GetDirectoryName(file);
                string fileName      = Path.GetFileName(file);
                return(Directory.EnumerateFiles(string.IsNullOrWhiteSpace(directoryName) ? "." : directoryName, fileName, SearchOption.TopDirectoryOnly));
            });

            if (!inputFiles.Any())
            {
                Console.WriteLine("Input files not found.");
                return;
            }

            var po = new PublishOperation(new Tracer()
            {
                Enabled = true
            });

            var publishFiles = po.GetPublishFileInfo(inputFiles, false);

            foreach (var file in publishFiles)
            {
                var outName = Path.Combine(outPath, file.Index);
                Directory.CreateDirectory(Path.GetDirectoryName(outName));
                File.Copy(file.FileName, outName, true);
            }
        }
Ejemplo n.º 2
0
        public override async Task Invoke(IOutgoingPublishContext context, Func <Task> next)
        {
            var sendOperation = new PublishOperation
            {
                SenderEndpoint  = endpointName,
                MessageId       = context.MessageId,
                MessageType     = context.Message.MessageType,
                MessageInstance = context.Message.Instance,
                MessageHeaders  = context.Headers
            };

            integrationContext.AddOutogingOperation(sendOperation);
            try
            {
                await next();
            }
            catch (Exception sendError)
            {
                sendOperation.OperationError = sendError;
                throw;
            }
        }
Ejemplo n.º 3
0
        public void Retry()
        {
            if (savedEndpointOperation != null)
            {
                switch (Operation)
                {
                case PNOperationType.PNAccessManagerAudit:
                    if (savedEndpointOperation is AuditOperation)
                    {
                        AuditOperation endpoint = savedEndpointOperation as AuditOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNAccessManagerGrant:
                    if (savedEndpointOperation is GrantOperation)
                    {
                        GrantOperation endpoint = savedEndpointOperation as GrantOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNAddChannelsToGroupOperation:
                    if (savedEndpointOperation is AddChannelsToChannelGroupOperation)
                    {
                        AddChannelsToChannelGroupOperation endpoint = savedEndpointOperation as AddChannelsToChannelGroupOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNRemoveGroupOperation:
                    if (savedEndpointOperation is DeleteChannelGroupOperation)
                    {
                        DeleteChannelGroupOperation endpoint = savedEndpointOperation as DeleteChannelGroupOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.ChannelGroupAllGet:
                    if (savedEndpointOperation is ListAllChannelGroupOperation)
                    {
                        ListAllChannelGroupOperation endpoint = savedEndpointOperation as ListAllChannelGroupOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.ChannelGroupGet:
                    if (savedEndpointOperation is ListChannelsForChannelGroupOperation)
                    {
                        ListChannelsForChannelGroupOperation endpoint = savedEndpointOperation as ListChannelsForChannelGroupOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNRemoveChannelsFromGroupOperation:
                    if (savedEndpointOperation is RemoveChannelsFromChannelGroupOperation)
                    {
                        RemoveChannelsFromChannelGroupOperation endpoint = savedEndpointOperation as RemoveChannelsFromChannelGroupOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNGetStateOperation:
                    if (savedEndpointOperation is GetStateOperation)
                    {
                        GetStateOperation endpoint = savedEndpointOperation as GetStateOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNHereNowOperation:
                    if (savedEndpointOperation is HereNowOperation)
                    {
                        HereNowOperation endpoint = savedEndpointOperation as HereNowOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNSetStateOperation:
                    if (savedEndpointOperation is SetStateOperation)
                    {
                        SetStateOperation endpoint = savedEndpointOperation as SetStateOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNWhereNowOperation:
                    if (savedEndpointOperation is WhereNowOperation)
                    {
                        WhereNowOperation endpoint = savedEndpointOperation as WhereNowOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNFireOperation:
                    if (savedEndpointOperation is FireOperation)
                    {
                        FireOperation endpoint = savedEndpointOperation as FireOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNPublishOperation:
                    if (savedEndpointOperation is PublishOperation)
                    {
                        PublishOperation endpoint = savedEndpointOperation as PublishOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PushRegister:
                    if (savedEndpointOperation is AddPushChannelOperation)
                    {
                        AddPushChannelOperation endpoint = savedEndpointOperation as AddPushChannelOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PushGet:
                    if (savedEndpointOperation is AuditPushChannelOperation)
                    {
                        AuditPushChannelOperation endpoint = savedEndpointOperation as AuditPushChannelOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PushUnregister:
                    if (savedEndpointOperation is RemovePushChannelOperation)
                    {
                        RemovePushChannelOperation endpoint = savedEndpointOperation as RemovePushChannelOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNHistoryOperation:
                    if (savedEndpointOperation is HistoryOperation)
                    {
                        HistoryOperation endpoint = savedEndpointOperation as HistoryOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNFetchHistoryOperation:
                    if (savedEndpointOperation is FetchHistoryOperation)
                    {
                        FetchHistoryOperation endpoint = savedEndpointOperation as FetchHistoryOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNMessageCountsOperation:
                    if (savedEndpointOperation is MessageCountsOperation)
                    {
                        MessageCountsOperation endpoint = savedEndpointOperation as MessageCountsOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNTimeOperation:
                    if (savedEndpointOperation is TimeOperation)
                    {
                        TimeOperation endpoint = savedEndpointOperation as TimeOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNSetUuidMetadataOperation:
                    if (savedEndpointOperation is SetUuidMetadataOperation)
                    {
                        SetUuidMetadataOperation endpoint = savedEndpointOperation as SetUuidMetadataOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNSetChannelMetadataOperation:
                    if (savedEndpointOperation is SetChannelMetadataOperation)
                    {
                        SetChannelMetadataOperation endpoint = savedEndpointOperation as SetChannelMetadataOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNDeleteUuidMetadataOperation:
                    if (savedEndpointOperation is RemoveUuidMetadataOperation)
                    {
                        RemoveUuidMetadataOperation endpoint = savedEndpointOperation as RemoveUuidMetadataOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNDeleteChannelMetadataOperation:
                    if (savedEndpointOperation is RemoveChannelMetadataOperation)
                    {
                        RemoveChannelMetadataOperation endpoint = savedEndpointOperation as RemoveChannelMetadataOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNGetUuidMetadataOperation:
                    if (savedEndpointOperation is GetUuidMetadataOperation)
                    {
                        GetUuidMetadataOperation endpoint = savedEndpointOperation as GetUuidMetadataOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNGetChannelMetadataOperation:
                    if (savedEndpointOperation is GetChannelMetadataOperation)
                    {
                        GetChannelMetadataOperation endpoint = savedEndpointOperation as GetChannelMetadataOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNGetAllUuidMetadataOperation:
                    if (savedEndpointOperation is GetAllUuidMetadataOperation)
                    {
                        GetAllUuidMetadataOperation endpoint = savedEndpointOperation as GetAllUuidMetadataOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNGetAllChannelMetadataOperation:
                    if (savedEndpointOperation is GetAllChannelMetadataOperation)
                    {
                        GetAllChannelMetadataOperation endpoint = savedEndpointOperation as GetAllChannelMetadataOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNManageMembershipsOperation:
                    if (savedEndpointOperation is ManageMembershipsOperation)
                    {
                        ManageMembershipsOperation endpoint = savedEndpointOperation as ManageMembershipsOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNSetMembershipsOperation:
                    if (savedEndpointOperation is SetMembershipsOperation)
                    {
                        SetMembershipsOperation endpoint = savedEndpointOperation as SetMembershipsOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNRemoveMembershipsOperation:
                    if (savedEndpointOperation is RemoveMembershipsOperation)
                    {
                        RemoveMembershipsOperation endpoint = savedEndpointOperation as RemoveMembershipsOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNManageChannelMembersOperation:
                    if (savedEndpointOperation is ManageChannelMembersOperation)
                    {
                        ManageChannelMembersOperation endpoint = savedEndpointOperation as ManageChannelMembersOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNSetChannelMembersOperation:
                    if (savedEndpointOperation is SetChannelMembersOperation)
                    {
                        SetChannelMembersOperation endpoint = savedEndpointOperation as SetChannelMembersOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNRemoveChannelMembersOperation:
                    if (savedEndpointOperation is RemoveChannelMembersOperation)
                    {
                        RemoveChannelMembersOperation endpoint = savedEndpointOperation as RemoveChannelMembersOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNGetMembershipsOperation:
                    if (savedEndpointOperation is GetMembershipsOperation)
                    {
                        GetMembershipsOperation endpoint = savedEndpointOperation as GetMembershipsOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNGetChannelMembersOperation:
                    if (savedEndpointOperation is GetChannelMembersOperation)
                    {
                        GetChannelMembersOperation endpoint = savedEndpointOperation as GetChannelMembersOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNAddMessageActionOperation:
                    if (savedEndpointOperation is AddMessageActionOperation)
                    {
                        AddMessageActionOperation endpoint = savedEndpointOperation as AddMessageActionOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                case PNOperationType.PNRemoveMessageActionOperation:
                    if (savedEndpointOperation is RemoveMessageActionOperation)
                    {
                        RemoveMessageActionOperation endpoint = savedEndpointOperation as RemoveMessageActionOperation;
                        if (endpoint != null)
                        {
                            endpoint.Retry();
                        }
                    }
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        public static async System.Threading.Tasks.Task PublishAsync(
            TaskLoggingHelper log,
            string symbolServerPath,
            string personalAccessToken,
            IEnumerable <string> inputPackages,
            IEnumerable <string> inputFiles,
            HashSet <string> packageExcludeFiles,
            int expirationInDays,
            bool convertPortablePdbsToWindowsPdbs,
            bool publishSpecialClrFiles,
            HashSet <int> pdbConversionTreatAsWarning,
            bool treatPdbConversionIssuesAsInfo,
            bool dryRun,
            bool timer,
            bool verboseLogging)
        {
            var tracer = new Tracer(log, verboseLogging);

            PublishOperation publishOperation = new PublishOperation(tracer)
            {
                SymbolServerPath            = symbolServerPath,
                PersonalAccessToken         = personalAccessToken,
                PdbConversionTreatAsWarning = pdbConversionTreatAsWarning,
                PublishSpecialClrFiles      = publishSpecialClrFiles,
                Timer = timer,
                TreatPdbConversionIssuesAsInfo = treatPdbConversionIssuesAsInfo
            };

            using (publishOperation)
            {
                if (expirationInDays != 0)
                {
                    publishOperation.ExpirationInDays = (uint)expirationInDays;
                }

                IEnumerable <PublishFileInfo> fileInfos = new PublishFileInfo[0];
                if (inputFiles != null)
                {
                    fileInfos = fileInfos.Concat(
                        publishOperation.GetPublishFileInfo(inputFiles, convertPortablePdbsToWindowsPdbs));
                }

                if (inputPackages != null)
                {
                    fileInfos = fileInfos.Concat(
                        publishOperation.GetPublishFileInfoFromPackages(inputPackages,
                                                                        convertPortablePdbsToWindowsPdbs));
                }

                if (packageExcludeFiles != null)
                {
                    publishOperation.PackageExcludeFiles = packageExcludeFiles;
                }

                if (dryRun)
                {
                    publishOperation.StartTimer();
                    try
                    {
                        foreach (PublishFileInfo fileInfo in fileInfos)
                        {
                            fileInfo.Dispose();
                        }
                    }
                    catch (Exception ex)
                    {
                        tracer.Error("Dry Run FAILED: {0}", ex.Message);
                        tracer.Information(ex.ToString());
                    }

                    publishOperation.StopTimer();
                }
                else
                {
                    try
                    {
                        await publishOperation.PublishFiles(fileInfos);
                    }
                    catch (Exception ex)
                    {
                        tracer.Error("Publishing symbols failed : ", ex.Message);
                        tracer.Information(ex.ToString());
                    }
                }
            }
        }