public static void start(String dir) { Logger m_log = null; String m_watchDirName = dir; String m_watchDirNameIndd = null; String m_watchDirNameInx = null; String m_watchDirNames = null; InDesignApplication m_InDesignApp = null; try { Logger.Initialize(m_watchDirName + @"\AdobeConverter.log"); m_watchDirNameIndd = m_watchDirName + @"\indd"; m_watchDirNameInx = m_watchDirName + @"\inx"; DirectoryInfo watchDirIndd = new DirectoryInfo(m_watchDirNameIndd); DirectoryInfo watchDirInx = new DirectoryInfo(m_watchDirNameInx); watchDirIndd.Create(); watchDirInx.Create(); m_watchDirNames = m_watchDirNameIndd + ";" + m_watchDirNameInx; m_log = Logger.GetLogger(); m_log.EnableDebug = AppConfig.IsDebugEnabled(); m_log.Log("[Indesign]: GlobalSight InDesign CS6 Converter starting up."); m_log.Log("[Indesign]: Creating and starting threads to watch directory " + m_watchDirNames); m_importConverterRunner = new ConverterRunner( new InDesignConverterImpl(InDesignConverterImpl.ConversionType.IMPORT), m_watchDirNames); m_exportConverterRunner = new ConverterRunner( new InDesignConverterImpl(InDesignConverterImpl.ConversionType.EXPORT), m_watchDirNames); m_previewConverterRunner = new ConverterRunner( new InDesignConverterImpl(InDesignConverterImpl.ConversionType.PREVIEW), m_watchDirNames); m_idmlPreviewConverterRunner = new ConverterRunner( new InDesignConverterImpl(InDesignConverterImpl.ConversionType.IDML_PREVIEW), m_watchDirNames); m_inctxrvConverterRunner = new ConverterRunner( new InDesignConverterImpl(InDesignConverterImpl.ConversionType.INCTXRV), m_watchDirNames); m_importConverterRunner.Start(); m_exportConverterRunner.Start(); m_previewConverterRunner.Start(); m_idmlPreviewConverterRunner.Start(); m_inctxrvConverterRunner.Start(); m_InDesignApp = InDesignApplication.getInstance(); } catch (Exception e) { string msg = "GlobalSight InDesign Converter failed to initialize because of: " + e.Message + "\r\n" + e.StackTrace; // EventLog.WriteEntry(msg, EventLogEntryType.Error); Logger.LogWithoutException(msg); throw e; } }
/// <summary> /// Set things in motion so your service can do its work. /// </summary> protected override void OnStart(string[] args) { if (m_alreadyStarted == true) { return; } m_alreadyStarted = true; try { m_watchDirName = RegistryUtil.GetGlobalSightRegistryValue( "InDesignConvDir") + @"\indd"; DirectoryInfo watchDir = new DirectoryInfo(m_watchDirName); watchDir.Create(); Logger.Initialize(m_watchDirName + @"\InDesignConverter.log"); m_log = Logger.GetLogger(); m_log.Log("GlobalSight InDesign Converter starting up."); m_log.Log("Creating and starting threads to watch directory " + m_watchDirName); m_importConverterRunner = new ConverterRunner( new InDesignConverterImpl(InDesignConverterImpl.ConversionType.IMPORT), m_watchDirName); m_exportConverterRunner = new ConverterRunner( new InDesignConverterImpl(InDesignConverterImpl.ConversionType.EXPORT), m_watchDirName); m_importConverterRunner.Start(); m_exportConverterRunner.Start(); if (AllowInteractWithDesktop()) { m_InDesignApp = InDesignApplication.getInstance(); } else { throw new Exception("InDesign Converter Service needs to interact with desktop." + " The properties of InDesign Converter Service needs to " + "be changed to allow sevice to interact with desktop."); } } catch (Exception e) { string msg = "GlobalSight InDesign Converter failed to initialize because of: " + e.Message + "\r\n" + e.StackTrace; EventLog.WriteEntry(msg, EventLogEntryType.Error); Logger.LogWithoutException(msg); throw e; } }
/// <summary> /// Set things in motion so your service can do its work. /// </summary> protected override void OnStart(string[] args) { if (m_alreadyStarted == true) { return; } else { m_alreadyStarted = true; } try { m_watchDirName = RegistryUtil.GetGlobalSightRegistryValue( "MsOfficeConvDir") + @"\word"; DirectoryInfo watchDir = new DirectoryInfo(m_watchDirName); watchDir.Create(); Logger.Initialize(m_watchDirName + @"\wordxpConverter.log"); m_log = Logger.GetLogger(); m_log.Log("GlobalSight Word XP Converter starting up."); m_log.Log("Creating and starting threads to watch directory " + m_watchDirName); m_importConverterRunner = new ConverterRunner( new WordXPConverterImpl(WordXPConverterImpl.ConversionType.IMPORT), m_watchDirName); m_exportConverterRunner = new ConverterRunner( new WordXPConverterImpl(WordXPConverterImpl.ConversionType.EXPORT), m_watchDirName); m_importConverterRunner.Start(); m_exportConverterRunner.Start(); } catch (Exception e) { string msg = "GlobalSight Word XP Converter failed to initialize because of: " + e.Message + "\r\n" + e.StackTrace; EventLog.WriteEntry(msg, EventLogEntryType.Error); Logger.LogWithoutException(msg); throw e; } }
public static void start(String dir) { Logger m_log = null; String m_watchDirName = dir; String m_watchDirNameIndd = null; String m_watchDirNames = null; InDesignApplication m_InDesignApp = null; try { m_watchDirNameIndd = m_watchDirName + @"\idml"; DirectoryInfo watchDirIndd = new DirectoryInfo(m_watchDirNameIndd); watchDirIndd.Create(); Logger.Initialize(m_watchDirNameIndd + @"\IdmlConverter.log"); m_watchDirNames = m_watchDirNameIndd; m_log = Logger.GetLogger(); m_log.EnableDebug = AppConfig.IsDebugEnabled(); m_log.Log("[Idml]: GlobalSight Idml Converter starting up."); m_log.Log("[Idml]: Creating and starting threads to watch directory " + m_watchDirNames); m_importConverterRunner = new ConverterRunner( new InDesignConverterImpl(InDesignConverterImpl.ConversionType.IMPORT), m_watchDirNames); m_importConverterRunner.Start(); m_InDesignApp = InDesignApplication.getInstance(); } catch (Exception e) { string msg = "GlobalSight Idml Converter failed to initialize because of: " + e.Message + "\r\n" + e.StackTrace; Logger.LogWithoutException(msg); throw e; } }