コード例 #1
0
ファイル: IrbisService.cs プロジェクト: fossabot/ManagedIrbis
        private void _CreateEngine
        (
            string[] args
        )
        {
            if (ReferenceEquals(Engine, null))
            {
                try
                {
                    Engine   = ServerUtility.CreateEngine(args);
                    WorkTask = Task.Factory.StartNew(Engine.MainLoop);
                }
                catch (Exception exception)
                {
                    EventLog.WriteEntry
                    (
                        "Exception: " + exception,
                        EventLogEntryType.Error
                    );

                    Engine   = null;
                    WorkTask = null;
                    Stop();
                }
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.CancelKeyPress += Console_CancelKeyPress;

            try
            {
                Log.ApplyDefaultsForConsoleApplication();

                using (Engine = ServerUtility.CreateEngine(args))
                {
                    ServerUtility.DumpEngineSettings(Engine);
                    Log.Trace("Entering server main loop");
                    Engine.MainLoop();
                    Log.Trace("Leaved server main loop");
                }
            }
            catch (Exception exception)
            {
                Log.TraceException("Program::Main", exception);
            }

            Log.Trace("STOP");
        }