コード例 #1
0
        //static void main()
        //{

        //}

        public void start()
        {
            try
            {
                DirectoryInfo watchDir = new DirectoryInfo(m_watchDirName);
                watchDir.Create();

                Logger.Initialize(m_watchDirName + @"\powerpoint2007Converter.log");
                m_log = Logger.GetLogger();
                m_log.Log("PowerPoint 2007 Converter starting up.");
                m_log.Log("Creating and starting threads to watch directory " +
                          m_watchDirName);


                m_importConverterRunner = new ConverterRunner(
                    new PowerPointConverterImpl(PowerPointConverterImpl.ConversionType.IMPORT), m_watchDirName);
                m_exportConverterRunner = new ConverterRunner(
                    new PowerPointConverterImpl(PowerPointConverterImpl.ConversionType.EXPORT), m_watchDirName);

                m_importConverterRunner.Start();
                m_exportConverterRunner.Start();
            }
            catch (Exception e)
            {
                string msg = "PowerPoint 2007 Converter failed to initialize because of: " +
                             e.Message + "\r\n" + e.StackTrace;
                Logger.LogWithoutException(msg);
                throw e;
            }
        }
コード例 #2
0
        public void start(String dir)
        {
            try
            {
                String        winpeDir = dir + "\\winpe";
                DirectoryInfo watchDir = new DirectoryInfo(winpeDir);
                watchDir.Create();

                if (m_log == null)
                {
                    m_log = Logger.Initialize(winpeDir + @"\WindowsPEConverter.log");
                }

                m_log.Log("WindowsPEConverter starting up.");
                m_log.Log("Creating and starting threads to watch directory " +
                          dir);

                m_importConverterRunner = new ConverterRunner(
                    new WinPEConverterImpl(WinPEConverterImpl.ConversionType.IMPORT),
                    winpeDir, m_log);
                m_exportConverterRunner = new ConverterRunner(
                    new WinPEConverterImpl(WinPEConverterImpl.ConversionType.EXPORT),
                    winpeDir, m_log);

                m_importConverterRunner.Start();
                m_exportConverterRunner.Start();
            }
            catch (Exception e)
            {
                string msg = "WindowsPEConverter failed to initialize because of: " +
                             e.Message + "\r\n" + e.StackTrace;
                Logger.LogWithoutException(m_log, msg);
                throw e;
            }
        }
コード例 #3
0
ファイル: Service1.cs プロジェクト: tilde-nlp/GlobalSight
        /// <summary>
        /// Set things in motion so your service can do its work.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            // TODO: Add code here to start your service.
            // Get the value of the watch Dir from the registry
            try
            {
                m_watchDirName = RegistryUtil.GetGlobalSightRegistryValue("PdfConvDir") + @"\pdf";
                DirectoryInfo watchDir = new DirectoryInfo(m_watchDirName);
                watchDir.Create();
                Logger.Initialize(m_watchDirName + @"\pdfConverter.log");
                m_log = Logger.GetLogger();
                m_log.Log("GlobalSight PDF Converter starting up.");
                m_log.Log("Creating and starting thread to watch directory " + m_watchDirName);

                m_converterRunner = new ConverterRunner(new PdfConverterImpl(), m_watchDirName);
                m_converterRunner.Start();
            }
            catch (Exception e)
            {
                string msg = "PdfConverter failed to initialize because of: " + e.Message + "\r\n" + e.StackTrace;
                EventLog.WriteEntry(msg, EventLogEntryType.Error);
                Logger.LogWithoutException(msg);
                throw e;
            }
        }
コード例 #4
0
        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.Log("[Indesign]: GlobalSight InDesign 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_importConverterRunner.Start();
                m_exportConverterRunner.Start();
                m_previewConverterRunner.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.");
                //}
                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;
            }
        }
コード例 #5
0
        public void start(String dir, String fmExePath)
        {
            try
            {
                closeThread = new Thread(new ThreadStart(CloseFrameMakerWindow));
                closeThread.Start();

                String        inputDir = dir + "\\FrameMaker9";
                DirectoryInfo watchDir = new DirectoryInfo(inputDir);
                watchDir.Create();

                if (m_log == null)
                {
                    Logger.Initialize(inputDir + @"\FrameMakerConverter.log");
                    m_log = Logger.GetLogger();
                }

                m_log.Log("FrameMaker Converter starting up.");
                m_log.Log("Creating and starting threads to watch directory " +
                          dir);

                m_ConverterRunner = new ConverterRunner(
                    new FrameMakerConverterImpl(fmExePath), inputDir);

                m_ConverterRunner.Start();
            }
            catch (Exception e)
            {
                string msg = "FrameMaker Converter failed to initialize because of: " +
                             e.Message + "\r\n" + e.StackTrace;
                Logger.LogWithoutException(msg);
                throw e;
            }
        }
コード例 #6
0
        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 CS5.5 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;
            }
        }
コード例 #7
0
ファイル: Service1.cs プロジェクト: tingley/globalsight
        /// <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;
            }
        }
コード例 #8
0
        /// <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;
            }
        }
コード例 #9
0
        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;
            }
        }