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();
                }
            }
        }
Exemple #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");
        }