public ProgressUpdateWrapper(IProgressUpdateInterface wrappedInterface)
 {
     if (wrappedInterface != null)
     {
         _wrappedInterfacePtr = Marshal.GetIUnknownForObjectInContext(wrappedInterface);
     }
 }
Example #2
0
 public ProgressUpdateWrapper(IProgressUpdateInterface wrappedInterface)
 {
     if (wrappedInterface != null)
     {
         _wrappedInterfacePtr = Marshal.GetIUnknownForObjectInContext(wrappedInterface);
     }
 }
Example #3
0
        public void ConvertXml(XDocument doc, string outFileName, IProgressUpdateInterface progress)
        {
            LoadSettings();
            _processorSettings.DeleteSource = false;

            var progressReporter = new ProgressUpdateWrapper(_processorSettings.ProgressCallbacks);

            progressReporter.ConvertStarted(1);


            IFb2EPubConverterEngine converter = CreateConverterEngine(_processorSettings.Settings);

            try
            {
                progressReporter.ProcessingStarted(outFileName);
                converter.LoadFB2FileFromXML(doc);
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex);
                return;
            }
            progressReporter.ProcessingSaving(outFileName);
            SaveAndCleanUp(converter, outFileName, "");
            progressReporter.Processed(outFileName);
            progressReporter.ConvertFinished(0);
        }
Example #4
0
 public void ConvertList(string[] files, string outputFolder, IProgressUpdateInterface progress)
 {
     LoadSettings();
     ProcessorSettings.Settings.OutPutPath    = outputFolder;
     ProcessorSettings.ProgressCallbacks      = progress;
     ProcessorSettings.Settings.ResourcesPath = GetResourcesPath();
     PerformConvertOperation(files, null);
 }
 public void SkippedDueError(string fileName)
 {
     if (_wrappedInterfacePtr != IntPtr.Zero)
     {
         IProgressUpdateInterface wrappedInterface =
             (IProgressUpdateInterface)Marshal.GetUniqueObjectForIUnknown(_wrappedInterfacePtr);
         wrappedInterface.SkippedDueError(fileName);
     }
 }
 public void ProcessingSaving(string fileName)
 {
     if (_wrappedInterfacePtr != IntPtr.Zero)
     {
         IProgressUpdateInterface wrappedInterface =
             (IProgressUpdateInterface)Marshal.GetUniqueObjectForIUnknown(_wrappedInterfacePtr);
         wrappedInterface.ProcessingSaving(fileName);
     }
 }
 public void ConvertFinished(int total)
 {
     if (_wrappedInterfacePtr != IntPtr.Zero)
     {
         IProgressUpdateInterface wrappedInterface =
             (IProgressUpdateInterface)Marshal.GetUniqueObjectForIUnknown(_wrappedInterfacePtr);
         wrappedInterface.ConvertFinished(total);
     }
 }
Example #8
0
        public void ConvertSingleFile(string inputPath, string outputName, IProgressUpdateInterface progress)
        {
            LoadSettings();
            ProcessorSettings.ProgressCallbacks      = progress;
            ProcessorSettings.Settings.ResourcesPath = GetResourcesPath();
            ProcessorSettings.SingleFile             = true;
            var filesInMask = new List <string> {
                inputPath
            };
            bool conversionSucceeded = PerformConvertOperation(filesInMask, outputName);

            if (!conversionSucceeded)
            {
                throw new COMException("file conversion failed");
            }
        }
Example #9
0
        public void ConvertPath(string inputPath, string outputFolder, IProgressUpdateInterface progress)
        {
            LoadSettings();
            ProcessorSettings.ProgressCallbacks   = progress;
            ProcessorSettings.Settings.OutPutPath = outputFolder;
            var fileParams = new List <string> {
                inputPath
            };

            ProcessorSettings.LookInSubFolders       = true;
            ProcessorSettings.Settings.ResourcesPath = GetResourcesPath();
            var filesInMask = new List <string>();

            DetectFilesToProcess(fileParams, ref filesInMask);
            PerformConvertOperation(filesInMask, null);
        }
Example #10
0
        public void ConvertXml(XDocument doc, string outFileName, IProgressUpdateInterface progress)
        {
            LoadSettings();
            _processorSettings.DeleteSource = false;

            var progressReporter = new ProgressUpdateWrapper(_processorSettings.ProgressCallbacks);
            progressReporter.ConvertStarted(1);


            IFb2EPubConverterEngine converter = CreateConverterEngine(_processorSettings.Settings);

            try
            {
                progressReporter.ProcessingStarted(outFileName);
                converter.LoadFB2FileFromXML(doc);
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex);
                return;
            }
            progressReporter.ProcessingSaving(outFileName);
            SaveAndCleanUp(converter, outFileName, "");
            progressReporter.Processed(outFileName);
            progressReporter.ConvertFinished(0);
        }
Example #11
0
        public void ConvertSingleFile(string inputPath, string outputName, IProgressUpdateInterface progress)
        {
            LoadSettings();
            ProcessorSettings.ProgressCallbacks = progress;
            ProcessorSettings.Settings.ResourcesPath = GetResourcesPath();
            ProcessorSettings.SingleFile = true;
            var filesInMask = new List<string> {inputPath};
            bool conversionSucceeded = PerformConvertOperation(filesInMask, outputName);
            if (!conversionSucceeded)
            {
                throw new COMException("file conversion failed");
            }

        }
Example #12
0
        public void ConvertList(string[] files, string outputFolder, IProgressUpdateInterface progress)
        {
            LoadSettings();
            ProcessorSettings.Settings.OutPutPath = outputFolder;
            ProcessorSettings.ProgressCallbacks = progress;
            ProcessorSettings.Settings.ResourcesPath = GetResourcesPath();
            PerformConvertOperation(files, null);

        }
Example #13
0
 public void ConvertPath(string inputPath, string outputFolder, IProgressUpdateInterface progress)
 {
     LoadSettings();
     ProcessorSettings.ProgressCallbacks = progress;
     ProcessorSettings.Settings.OutPutPath = outputFolder;
     var fileParams = new List<string> {inputPath};
     ProcessorSettings.LookInSubFolders = true;
     ProcessorSettings.Settings.ResourcesPath = GetResourcesPath();
     var filesInMask = new List<string>();
     DetectFilesToProcess(fileParams, ref filesInMask);
     PerformConvertOperation(filesInMask, null);
 }