Ejemplo n.º 1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main( string[] args )
        {
            string path = Assembly.GetExecutingAssembly().Location;
            path = Path.GetDirectoryName( path );
            Directory.SetCurrentDirectory( path );

            AppDomain.CurrentDomain.UnhandledException += ( sender, e ) =>
            {
                Log.WriteError( "Program", "Unhandled exception (IsTerm: {0}): {1}", e.IsTerminating, e.ExceptionObject );
            };

            var service = new BotService();

            #if SERVICE_BUILD
            ServiceBase.Run( service );
            #else
            service.Start( args );
            ServiceDispatcher.Instance.Wait();
            #endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            string path = Assembly.GetExecutingAssembly().Location;

            path = Path.GetDirectoryName(path);
            Directory.SetCurrentDirectory(path);

            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
            {
                Log.WriteError("Program", "Unhandled exception (IsTerm: {0}): {1}", e.IsTerminating, e.ExceptionObject);
            };

            var service = new BotService();

#if SERVICE_BUILD
            ServiceBase.Run(service);
#else
            service.Start(args);
            ServiceDispatcher.Instance.Wait();
#endif
        }