protected override void Process()

in Powershell/XblConfig/SaveDocuments.cs [76:128]


        protected override void Process()
        {
            if (!Enum.TryParse<DocumentType>(this.DocumentType, out DocumentType documentType))
            {
                throw new ArgumentException("Invalid DocumentType. Must be either 'Sandbox' or 'Account'.", nameof(this.DocumentType));
            }

            if (documentType == Microsoft.Xbox.Services.DevTools.XblConfig.DocumentType.Sandbox && string.IsNullOrEmpty(this.Sandbox))
            {
                throw new ArgumentException("Sandbox must be specified when committing sandbox documents.");
            }

            if (documentType == Microsoft.Xbox.Services.DevTools.XblConfig.DocumentType.Account)
            {
                this.Sandbox = null;
            }

            IEnumerable<string> files = this.Glob(this.Files);
            int fileCount = files.Count();
            if (fileCount == 0)
            {
                throw new ArgumentException("There are no files selected to commit.", nameof(this.Files));
            }

            this.WriteVerbose($"Committing {fileCount} file(s) to Xbox Live.");

            string eTag = this.ETag ?? this.GetETag(files, this.Sandbox);
            if (this.Force)
            {
                eTag = null;
            }

            Task<ConfigResponse<ValidationResponse>> documentsTask;
            if (documentType == Microsoft.Xbox.Services.DevTools.XblConfig.DocumentType.Sandbox)
            {
                this.WriteVerbose("Committing sandbox documents.");
                documentsTask = ConfigurationManager.CommitSandboxDocumentsAsync(files, this.Scid, this.Sandbox, eTag, this.ValidateOnly, this.Message);
            }
            else
            {
                this.WriteVerbose("Committing account documents.");
                documentsTask = ConfigurationManager.CommitAccountDocumentsAsync(files, this.AccountId, eTag, this.ValidateOnly, this.Message);
            }

            ConfigResponse<ValidationResponse> result = documentsTask.Result;

            this.SaveETag(result.Result.ETag, Path.GetDirectoryName(files.First()), this.Sandbox);

            this.WriteVerbose($"Can Commit: {result.Result.CanCommit}");
            this.WriteVerbose($"Committed:  {result.Result.Committed}");

            this.PrintValidationInfo(result.Result.ValidationInfo);
        }