protected override void Execute(CodeActivityContext context) { #region Workflow Arguments var switchInvokePowerShell = SwitchInvokePowerShell.Get(context); var powerShellScriptPath = PowerShellScriptPath.Get(context); var nuGetExeFilePath = NuGetExeFilePath.Get(context); var nuSpecFilePath = NuSpecFilePath.Get(context); var basePath = BasePath.Get(context); var outputDirectory = OutputDirectory.Get(context); var version = Version.Get(context); var switchInvokePush = SwitchInvokePush.Get(context); var apiKey = ApiKey.Get(context); var pushDestination = PushDestination.Get(context); var additionalOptions = AdditionalOptions.Get(context); #endregion var resultMessages = SummarizePropertyValues(switchInvokePowerShell, powerShellScriptPath, nuGetExeFilePath, nuSpecFilePath, basePath, outputDirectory, version, switchInvokePush, apiKey, pushDestination, additionalOptions); for (var i = 0; i < resultMessages.Length - 1; i++) { // Write to the log context.WriteBuildMessage(resultMessages[i], BuildMessageImportance.High); } }
protected override void Execute(CodeActivityContext executionContext) { string basePath = BasePath.Get(executionContext).ToString(); string method = Method.Get(executionContext).ToString(); string action = Action.Get(executionContext)?.ToString(); string parameters = Parameters.Get(executionContext)?.ToString(); string _webAddress = basePath + "/" + method; string json = CallService(_webAddress); }
protected override void Execute(CodeActivityContext context) { #region Extract Workflow Argument Values // The file path of the nuget.exe - if null or empty then // assume nuget is "installed" on the build server and in the path var nuGetExeFilePath = NuGetExeFilePath.Get(context); // The path of the nuspec file var nuSpecFilePath = NuSpecFilePath.Get(context); // The folder location of the files to be packed var basePath = BasePath.Get(context); // The folder location of the files to be packed var outputDirectory = OutputDirectory.Get(context); // The destination location if deployment is to be done var versionNumber = VersionNumber.Get(context); // command line options to append (as is) to the nuget command line var additionalOptions = AdditionalOptions.Get(context); #endregion context.WriteBuildMessage(string.Format("In CallNuGetPackageCommandLine:"), BuildMessageImportance.High); context.WriteBuildMessage(string.Format("nuGetExeFilePath: {0}", nuGetExeFilePath), BuildMessageImportance.High); context.WriteBuildMessage(string.Format("basePath: {0}", basePath), BuildMessageImportance.High); context.WriteBuildMessage(string.Format("outputDirectory: {0}", outputDirectory), BuildMessageImportance.High); context.WriteBuildMessage(string.Format("versionNumber: {0}", versionNumber), BuildMessageImportance.High); context.WriteBuildMessage(string.Format("additionalOptions: {0}", additionalOptions), BuildMessageImportance.High); // Don't assume that DI will have happened. If the value is null then create the default object.);) if (NuGetProcess == null) { NuGetProcess = new NuGetProcess(); } // Call the method that will do the work var results = NuGetPackaging(nuGetExeFilePath, nuSpecFilePath, outputDirectory, basePath, versionNumber, additionalOptions, context); // Send the result back to the workflow NuGetPackagingResult.Set(context, results); }
Task <HttpResponseMessage> ExecuteAsync(CodeActivityContext context) { MultipartFormDataContent formData = new MultipartFormDataContent(); FileStream fs = null; var basePath = BasePath.Get(context); var request = new HttpRequestMessage() { RequestUri = new Uri(basePath + "/parseDocument"), Method = HttpMethod.Post, }; var apiKey = APIKey.Get(context); request.Headers.Add("X-Auth-Key", apiKey); var documentURL = DocumentURL.Get(context); if (documentURL != null && !documentURL.Equals("")) { formData.Add(new StringContent(documentURL, Encoding.UTF8), "url"); } var template = Template.Get(context); if (template != null && !template.Equals("")) { formData.Add(new StringContent(template, Encoding.UTF8), "template"); } var pdfTextExtraction = PDFTextExtraction.Get(context); if (pdfTextExtraction == PDFTextExtractionType.Fast) { formData.Add(new StringContent("fast", Encoding.UTF8), "pdf_text_extraction"); } else if (pdfTextExtraction == PDFTextExtractionType.Full) { formData.Add(new StringContent("full", Encoding.UTF8), "pdf_text_extraction"); } var userData = UserData.Get(context); if (userData != null && !userData.Equals("")) { formData.Add(new StringContent(userData, Encoding.UTF8), "user_data"); } var userDataSetExternalID = UserDataSetExternalID.Get(context); if (userDataSetExternalID != null && !userDataSetExternalID.Equals("")) { formData.Add(new StringContent(userDataSetExternalID, Encoding.UTF8), "user_data_set_external_id"); } var documentFilename = DocumentFilename.Get(context); var documentBytes = DocumentBytes.Get(context); var documentPath = DocumentPath.Get(context); var documentStream = DocumentStream.Get(context); if (documentBytes != null && documentBytes.Length > 0) { formData.Add(new ByteArrayContent(documentBytes), "document", documentFilename); } else if (documentPath != null && !documentPath.Equals("")) { fs = File.OpenRead(documentPath); formData.Add(new StreamContent(fs), "document", Path.GetFileName(documentPath)); } else if (documentStream != null && documentStream.Length > 0) { formData.Add(new StreamContent(documentStream), "document", documentFilename); } request.Content = formData; request.Properties["RequestTimeout"] = TimeSpan.FromSeconds(600); return(httpClient.SendAsync(request)); }