public void Run() { Thread[] ircThreads = null; rooms = null; var bots = SqlTwitchBot.GetAll(); foreach(var bot in bots) { var connections = SqlTwitchConnection.GetAllAutoConnectingConnections(bot); if(connections != null && connections.Length > 0) { var chatConnection = new TwitchIrcConnection(bot, false); var whisperConnection = new TwitchIrcConnection(bot, true); foreach(var connection in connections) { var room = new TwitchChatRoom(chatConnection, whisperConnection, connection); rooms = rooms.Append(room); } ircThreads = ircThreads.Append(new[] { new Thread(whisperConnection.Run), new Thread(chatConnection.Run) }); } } ircThreads.Run(); }
public void Run() { Thread[] ircThreads = null; rooms = null; var bots = factory.GetAllBots(); foreach (var bot in bots) { var connections = factory.GetAllAutoConnectingConnections(bot); if (connections != null && connections.Length > 0) { var chatConnection = new TwitchIrcConnection(factory, bot, false); var whisperConnection = new TwitchIrcConnection(factory, bot, true); foreach (var connection in connections) { var room = new TwitchChatRoom(factory, chatConnection, whisperConnection, connection); rooms = rooms.Append(room); } ircThreads = ircThreads.Append(new[] { new Thread(whisperConnection.Run), new Thread(chatConnection.Run) }); } } ircThreads.Run(); }
public TwitchChatRoom(TwitchIrcConnection chatConnection, TwitchIrcConnection whisperConnection, SqlTwitchConnection twitchConnection) { this.chatIrcConnection = chatConnection; this.whisperIrcConnection = whisperConnection; this.twitchConnection = twitchConnection; this.pointManager = new ChannelPointManager(twitchConnection.channel); chatConnection.Join(this); commandControllers = GetType().InstantiateEachSubclass<TwitchCommandController, TwitchChatRoom>(false, this); }
public TwitchChatRoom(TwitchIrcConnection chatConnection, TwitchIrcConnection whisperConnection, SqlTwitchConnection twitchConnection) { this.chatIrcConnection = chatConnection; this.whisperIrcConnection = whisperConnection; this.twitchConnection = twitchConnection; this.pointManager = new ChannelPointManager(twitchConnection.channel); chatConnection.Join(this); GetType().InstantiateEachSubclassInMyAssembly<IAutoJoinTwitchRooms, TwitchChatRoom>(false, this); }
public TwitchChatRoom(ITwitchFactory factory, TwitchIrcConnection chatConnection, TwitchIrcConnection whisperConnection, TwitchConnection twitchConnection) { this.factory = factory; this.chatIrcConnection = chatConnection; this.whisperIrcConnection = whisperConnection; this.twitchConnection = twitchConnection; this.pointManager = new ChannelPointManager(factory, twitchConnection.channel); chatConnection.Join(this); TypeHelpers.InstantiateEachSubclass<IAutoJoinTwitchRooms, TwitchChatRoom>(this); }
public TwitchChatRoom(ITwitchFactory factory, TwitchIrcConnection chatConnection, TwitchIrcConnection whisperConnection, TwitchConnection twitchConnection) { this.factory = factory; this.chatIrcConnection = chatConnection; this.whisperIrcConnection = whisperConnection; this.twitchConnection = twitchConnection; this.pointManager = new ChannelPointManager(factory, twitchConnection.channel); chatConnection.Join(this); TypeHelpers.InstantiateEachSubclass <IAutoJoinTwitchRooms, TwitchChatRoom>(this); }