コード例 #1
0
ファイル: Program.cs プロジェクト: GJiin/meridian59-dotnet
        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);
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            // run as console app
            if (Environment.UserInteractive)
            {
                BuffBotClient buffBot = new BuffBotClient();

                // start it
                buffBot.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, BuffBotConfig, BuffBotClient>();

                // run service
                ServiceBase.Run(serviceWrap);
            }
        }
コード例 #3
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);
            }
        }