Esempio n. 1
0
        static void Main(string[] args)
        {
            // run as console app
            if (Environment.UserInteractive)
            {
                IRCBotClient ircBot = new IRCBotClient();

                // start it
                ircBot.Start(true);
            }

            // run as windows service
            else
            {
                // set workpath to .exe path (not default for services)
                // very important
                Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);

                // create bot-service wrapper
                ServiceBase serviceWrap =
                    new BotServiceWrapper <GameTick, ResourceManager, DataController, IRCBotConfig, IRCBotClient>();

                // run service
                ServiceBase.Run(serviceWrap);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string configFile    = Config.CONFIGFILE;
            string configFileAlt = Config.CONFIGFILE_ALT;

            // try parse config parameter
            string cmdConfig = Config.GetFilenameFromCmdArgs(args);

            // overwrite with user specified config
            if (cmdConfig != null)
            {
                configFile = configFileAlt = cmdConfig;
            }

            // run as console app
            if (Environment.UserInteractive)
            {
                IRCBotClient ircBot = new IRCBotClient();

                // start it
                ircBot.Start(true, configFile, configFileAlt);
            }

            // run as windows service
            else
            {
                // set workpath to .exe path (not default for services)
                // very important
                Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);

                // create bot-service wrapper
                ServiceBase serviceWrap =
                    new BotServiceWrapper <GameTick, ResourceManager, DataController, IRCBotConfig, IRCBotClient>(
                        configFile, configFileAlt);

                // run service
                ServiceBase.Run(serviceWrap);
            }
        }