/// <summary>
        /// Converts the file from one format to another.
        /// </summary>
        /// <param name="p_filename">The command file
        /// (.im_command, .ex_command, .pv_command)</param>
        /// <param name="p_language">the language of the directory
        /// the file was written in</param>
        public void Convert(string p_fileName, string p_language)
        {
            try
            {
                ResetState();
                m_statusFileName = p_fileName.Substring(
                    0, p_fileName.Length - FILE_EXT_LEN) + "status";
                DetermineConversionValues(p_fileName);

                m_log.Log("[Indesign]: The converter will process file: " + m_originalFileName + "\r\n");

                InDesignApplication indesignApp = InDesignApplication.getInstance();
                if (m_conversionType == ConversionType.EXPORT)
                {
                    indesignApp.ConvertXmlToIndd(m_originalFileName, m_newFileName, m_masterTranslated);
                }
                else if (m_conversionType == ConversionType.PREVIEW)
                {
                    //The status name will be changed to *.pv_status from *.status
                    //when execute the preview command(*.pv_command) file
                    m_statusFileName = m_statusFileName.Substring(0,
                                                                  m_statusFileName.LastIndexOf(".")) + ".pv_status";
                    indesignApp.ConvertInddToPDF(m_originalFileName, m_newFileName, m_masterTranslated);
                }
                else
                {
                    indesignApp.ConvertInddToXml(m_originalFileName, m_newFileName, m_masterTranslated);
                }

                StatusFile.WriteSuccessStatus(m_statusFileName,
                                              m_originalFileName + " was converted successfully.");

                m_log.Log("[Indesign]: Converted successfully to: " + m_newFileName);
            }
            catch (Exception e)
            {
                Logger.LogError("[Indesign]: InDesign Conversion Failed", e);
                StatusFile.WriteErrorStatus(m_statusFileName, e, (int)1);
            }
            finally
            {
                DeleteInputFile(p_fileName);
            }
        }
Пример #2
0
        /// <summary>
        /// Converts the file from one format to another.
        /// </summary>
        /// <param name="p_filename">The command file
        /// (.im_command, .ex_command)</param>
        /// <param name="p_language">the language of the directory
        /// the file was written in</param>
        public void Convert(string p_fileName, string p_language)
        {
            try
            {
                ResetState();
                m_statusFileName = p_fileName.Substring(
                    0, p_fileName.Length - FILE_EXT_LEN) + "status";
                DetermineConversionValues(p_fileName);

                m_log.Log("The converter will process file: " + m_originalFileName + "\r\n");

                InDesignApplication indesignApp = InDesignApplication.getInstance();
                if (m_conversionType == ConversionType.EXPORT)
                {
                    indesignApp.ConvertXmlToIndd(m_originalFileName, m_newFileName);
                }
                else
                {
                    indesignApp.ConvertInddToXml(m_originalFileName, m_newFileName);
                }

                StatusFile.WriteSuccessStatus(m_statusFileName,
                                              m_originalFileName + " was converted successfully.");

                m_log.Log("Converted successfully to: " + m_newFileName);
            }
            catch (Exception e)
            {
                Logger.LogError("InDesign Conversion Failed", e);
                StatusFile.WriteErrorStatus(m_statusFileName, e, (int)1);
            }
            finally
            {
                DeleteInputFile(p_fileName);
            }
        }