private void ExecuteFileProcessing(string exePath, string inputFileName, string outputPath, string format) { Process fileConvertor = new Process(); try { ProcessStartInfo startInfo = new ProcessStartInfo(exePath); startInfo.Arguments = "-f \"" + Path.Combine(outputPath, inputFileName) + "\"" + " -O " + "\"" + Path.Combine(outputPath, inputFileName.Split('.')[0] + "." + format.Split('|')[0]) + "\"" + " -T " + format.Split('|')[1] + " -L 10 -G"; startInfo.RedirectStandardOutput = true; startInfo.CreateNoWindow = true; startInfo.UseShellExecute = false; startInfo.ErrorDialog = true; fileConvertor = Process.Start(startInfo); fileConvertor.WaitForExit(); CloudBlockBlob fileBlob = outputDocumentsContainer.GetBlockBlobReference(inputFileName.Split('.')[0] + "." + format.Split('|')[0]); fileBlob.UploadFromFile(Path.Combine(outputPath, inputFileName.Split('.')[0] + "." + format.Split('|')[0])); OutgoingClient.Send(new BrokeredMessage(inputFileName.Split('.')[0] + "." + format.Split('|')[0], new DataContractSerializer(typeof(string)))); File.Delete(Path.Combine(outputPath, inputFileName)); File.Delete(Path.Combine(outputPath, inputFileName.Split('.')[0] + "." + format.Split('|')[0])); } catch (Exception ex) { LogError(ex); } }
public override void OnStop() { // Close the connection to Service Bus Queue IncomingClient.Close(); OutgoingClient.Close(); CompletedEvent.Set(); base.OnStop(); }
public ActionResult GetConvertedFiles() { if (OutgoingClient.Peek() != null) { var message = OutgoingClient.Receive(); OutputBlobUrls.Add(message.GetBody <string>(new DataContractSerializer(typeof(string)))); message.Complete(); } return(PartialView("_ConvertedFiles", OutputBlobUrls)); }