private void GetAbbyOutFile(String tempPath, AttachmentUnit unit, String fullAbbyOutPath) { String fileName = Path.GetFileName(unit.AbbyFilePath); String format = Path.GetExtension(fileName) ?? String.Empty; if (fileName != null) { var newFileName = fileName.Replace(format, ".docx"); var fullNamePath = String.Format("{0}\\{1}", fullAbbyOutPath, newFileName); DateTime maxTime = DateTime.UtcNow.AddMinutes(_settingsService.AbbyMaxWaitTimeMinutes); while (DateTime.UtcNow < maxTime) { if (File.Exists(fullNamePath)) { String phisicalName = String.Format("{0}\\{1}", tempPath, newFileName); File.Move(fullNamePath, phisicalName); unit.CurrentType = FileType.Docx; unit.PhisicalName = phisicalName; if (File.Exists(unit.AbbyFilePath)) { File.Delete(unit.AbbyFilePath); } break; } else { Thread.Sleep(_settingsService.AbbySleepTimeMilliseconds); } } } }
private void ConvertPresentToText(AttachmentUnit unit, IProgress <EstimatorBaseProgress> progress) { ProgressLogTask(progress, "Convert a Presentation file to a text file"); WaitTask(); var newpath = _presentService.ConvertToWordDocument(unit.PhisicalName); unit.PhisicalName = newpath; unit.CurrentType = FileType.Docx; }
private void SetAbbyInFile(SalesEstimator model, AttachmentUnit unit, String fullAbbyInPath) { String fileName = Path.GetFileNameWithoutExtension(unit.PhisicalName); String extension = Path.GetExtension(unit.PhisicalName); if (!String.IsNullOrWhiteSpace(fileName)) { unit.AbbyFilePath = String.Format("{0}\\{1}{2}{3}", fullAbbyInPath, fileName, DateTime.UtcNow.Ticks, extension); File.Move(unit.PhisicalName, unit.AbbyFilePath); } else { model.AddError(String.Format("Incorect file name: {0}\n file:{1}", fileName, unit.PhisicalName)); } }