Example #1
0
        public ConvertResult Convert(ref DocumentObject document, ConvertFileType convertType)
        {
            try
            {
                string path = DocumentSettings.GetStorePath(document.FileName);
                _storePolicy.Copy(path, document.StorePath);

                string tmpName     = document.Id + convertType.ToSuffix();
                var    convertPath = DocumentSettings.GetConvertPath(tmpName);
                int    result      = _documentConverter.Convert(path, convertPath, convertType);

                if (File.Exists(tmpName))
                {
                    File.Delete(tmpName);
                }

                return(new ConvertResult {
                    ErrorCode = result,
                    SourcePath = document.StorePath,
                    TargetPath = convertPath
                });
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
                _logger.Error(ex.StackTrace);
                throw;
            }
        }