public async Task ProcessArguments()

in src/PatchOrchestrationApplication/NodeAgentSFUtility/src/CommandProcessor.cs [57:113]


        public async Task<NodeAgentSfUtilityExitCodes> ProcessArguments(String[] args)
        {
            if (!args.Any())
                return NodeAgentSfUtilityExitCodes.InvalidArgument;

            switch (args[0])
            {
                case "GetWuOperationState":
                    return await this.GetWuOperationStateAsync(args[1], TimeSpan.FromSeconds(int.Parse(args[2])), this.cancellationTokenSource.Token);

                case "UpdateSearchAndDownloadStatus":
                    return
                        await
                         this.UpdateSearchAndDownloadStatusAsync(
                             args[1],
                             new Uri(args[2]),
                             (NodeAgentSfUtilityExitCodes)Enum.Parse(typeof(NodeAgentSfUtilityExitCodes), (args[3])),
                             (args.Count() == 7) ? WindowsUpdateOperationResult.Deserialize(args[6]) : null,
                             int.Parse(args[4]), 
                             new TimeSpan(0, 0, int.Parse(args[5])),
                             this.cancellationTokenSource.Token);

                case "UpdateInstallationStatus":
                    return
                        await
                         this.UpdateInstallationStatusAsync(
                             args[1],
                             new Uri(args[2]), 
                             (NodeAgentSfUtilityExitCodes)Enum.Parse(typeof(NodeAgentSfUtilityExitCodes), (args[3])),
                             (args.Count() == 6) ? WindowsUpdateOperationResult.Deserialize(args[5]) : null,
                             new TimeSpan(0, 0, int.Parse(args[4])),
                             this.cancellationTokenSource.Token);

                case "ReportHealth":
                    return
                        this.ReportHealth(
                            new Uri(args[1]),
                            args[2],
                            args[3],
                            (HealthState)Enum.Parse(typeof(HealthState), (args[4])),
                            long.Parse(args[5]),
                            TimeSpan.FromSeconds(int.Parse(args[6])),
                            this.cancellationTokenSource.Token);

                case "GetApplicationDeployedStatus":
                    return
                        await this.GetApplicationDeployedStatusAsync(new Uri(args[1]), TimeSpan.FromSeconds(int.Parse(args[2])),
                            this.cancellationTokenSource.Token);

                default:
                {
                    string errorMessage = String.Format("Unknown command = {0} recieved", args[0]);
                    ServiceEventSource.Current.ErrorMessage(errorMessage);
                    return NodeAgentSfUtilityExitCodes.InvalidArgument;
                }
            }
        }