fCraft.IRC.Start C# (CSharp) Method

Start() public static method

public static Start ( ) : bool
return bool
        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.IRC, "IRC: Set IRCThreads to 1." );
                return false;
            }
        }