示例#1
0
        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);
            }
        }
示例#2
0
 public override void OnStop()
 {
     // Close the connection to Service Bus Queue
     IncomingClient.Close();
     OutgoingClient.Close();
     CompletedEvent.Set();
     base.OnStop();
 }
示例#3
0
        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));
        }