示例#1
0
        public static bool Start()
        {
            int threadCount = ConfigKey.IRCThreads.GetInt();

            if (threadCount == 1)
            {
                IRCThread thread = new IRCThread();
                if (thread.Start(botNick, true))
                {
                    threads = new[] { thread };
                }
            }
            else
            {
                List <IRCThread> threadTemp = new List <IRCThread>();
                for (int i = 0; i < threadCount; i++)
                {
                    IRCThread temp = new IRCThread();
                    if (temp.Start(botNick + (i + 1), (threadTemp.Count == 0)))
                    {
                        threadTemp.Add(temp);
                    }
                }

                threads = threadTemp.ToArray();
            }

            if (threads.Length > 0)
            {
                HookUpHandlers();
                return(true);
            }
            else
            {
                Logger.Log("IRC functionality disabled.", LogType.IRC);
                return(false);
            }
        }
示例#2
0
文件: IRC.cs 项目: fragmer/fCraft
        public static bool Start() {
            if( !IrcNickRegex.IsMatch( botNick ) ) {
                Logger.Log( LogType.Error, "IRC: Unacceptable bot nick." );
                return false;
            }

            int threadCount = ConfigKey.IRCThreads.GetInt();

            if( threadCount == 1 ) {
                IRCThread thread = new IRCThread();
                if( thread.Start( botNick, true ) ) {
                    threads = new[] { thread };
                }

            } else {
                List<IRCThread> threadTemp = new List<IRCThread>();
                for( int i = 0; i < threadCount; i++ ) {
                    IRCThread temp = new IRCThread();
                    if( temp.Start( botNick + (i + 1), (threadTemp.Count == 0) ) ) {
                        threadTemp.Add( temp );
                    }
                }
                threads = threadTemp.ToArray();
            }

            if( threads.Length > 0 ) {
                HookUpHandlers();
                return true;
            } else {
                Logger.Log( LogType.IRCStatus, "IRC: Set IRCThreads to 1." );
                return false;
            }
        }
示例#3
0
文件: IRC.cs 项目: fragmer/fCraft
        public static bool Start() {
            int threadCount = ConfigKey.IRCThreads.GetInt();

            if( threadCount == 1 ) {
                IRCThread thread = new IRCThread();
                if( thread.Start( botNick, true ) ) {
                    threads = new[] { thread };
                }

            } else {
                List<IRCThread> threadTemp = new List<IRCThread>();
                for( int i = 0; i < threadCount; i++ ) {
                    IRCThread temp = new IRCThread();
                    if( temp.Start( botNick + (i + 1), (threadTemp.Count == 0) ) ) {
                        threadTemp.Add( temp );
                    }
                }
                threads = threadTemp.ToArray();
            }

            if( threads.Length > 0 ) {
                HookUpHandlers();
                return true;
            } else {
                Logger.Log( LogType.IRCStatus, "IRC functionality disabled." );
                return false;
            }
        }