private int runCount = 0; // number of times run has been called #endregion Fields #region Constructors /// <summary> /// Initializes a new instance of the <see cref="Bot"/> class. /// </summary> /// <param name="client">The client.</param> /// <param name="userInteraction">The user interaction manager..</param> /// <param name="console">The console.</param> /// <param name="settings">The settings.</param> /// <param name="listener">The listener.</param> /// <param name="pluginHandler">The plugin handler.</param> /// <param name="moduleLoader">The module loader.</param> /// <param name="authorization">The authorization manager.</param> public Bot( Client client, IUserInteraction userInteraction, IConsole console, IBotSettings settings, IListener listener, IPluginHandler pluginHandler, IModuleLoader moduleLoader, IAuthorization authorization) { Guard.Against(client.IsNull(), "client"); Guard.Against(userInteraction.IsNull(), "userInteraction"); Guard.Against(console.IsNull(), "console"); Guard.Against(settings.IsNull(), "settings"); Guard.Against(listener.IsNull(), "listener"); Guard.Against(pluginHandler.IsNull(), "pluginHandler"); Guard.Against(moduleLoader.IsNull(), "moduleLoader"); Guard.Against(authorization.IsNull(), "authorization"); this.client = client; this.userInteraction = userInteraction; this.console = console; this.settings = settings; this.listener = listener; this.pluginHandler = pluginHandler; this.moduleLoader = moduleLoader; this.authorization = authorization; this.SessionStart = DateTime.Now; }
/// <summary> /// Initializes a new instance of the <see cref="ChatroomControl"/> class. /// </summary> /// <param name="chatroom">The chatroom.</param> /// <param name="client">The client.</param> public ChatroomControl(ChatRoom chatroom, Client client) { // save the chatroom and tie into events this.chatroom = chatroom; this.chatroom.CollectionChanged += new EventHandler<MultipleNotifyCollectionChangedEventArgs>(chatroom_CollectionChanged); this.chatroom.Logger.OnPacketReceived += new PacketReceived(Logger_OnPacketReceived); // save the client this.client = client; // init the UI from chatroom InitializeMembers(); InitializeComponent(); InitializeChatWindow(); }
/// <summary> /// Initializes a new instance of the <see cref="PluginContext"/> class. /// Is marked as internal so external clients cannot instantiate. /// </summary> /// <param name="client">The client.</param> /// <param name="console">The console.</param> /// <param name="authorizer">The authorizer.</param> /// <param name="chatrooms">The chatrooms.</param> /// <param name="listener">The listener.</param> /// <param name="botSettings">The bot settings.</param> /// <param name="pluginHandler">The plugin handler.</param> /// <param name="dispatcher">The system dispatcher.</param> /// <param name="packet">The current packet to be processed.</param> /// <param name="chatHelper">The chat helper.</param> public PluginContext(Client client, IConsole console, IAuthorization authorizer, IChatRoomContainer chatrooms, IListener listener, IBotSettings botSettings, IPluginHandler pluginHandler, IDispatcher dispatcher, EventPacket packet, IChatHelper chatHelper) { this.Client = client; this.Console = console; this.Authorizer = authorizer; this.ChatRooms = chatrooms; this.Listener = listener; this.BotSettings = botSettings; this.Plugins = pluginHandler; this.Dispatcher = dispatcher; this.ThisRoom = chatHelper; }
/// <summary> /// Joins the chatroom. /// </summary> /// <param name="chatroom">The chatroom.</param> /// <param name="client">The client.</param> public void JoinChatroom(ChatRoom chatroom, Client client) { if (excludedRooms.Contains(chatroom.Name)) return; IsBusy = false; ChatroomControl chatControl = new ChatroomControl(chatroom, client); TabItem tabItem = new TabItem(); tabItem.Header = "#" + chatroom.Name; tabItem.Content = chatControl; tabControl1.Items.Add(tabItem); // if we only have one chatroom select that one if (tabControl1.Items.Count == 1) tabItem.IsSelected = true; }
/// <summary> /// Initializes a new instance of the <see cref="ChatHelper"/> class. /// </summary> /// <param name="client">The client.</param> /// <param name="packet">The packet.</param> public ChatHelper(Client client, EventPacket packet) { this.client = client; this.packet = packet; }
public UIChatHelper(Client client, EventPacket packet) : base(client, packet) { }
/// <summary> /// Initializes a new instance of the <see cref="Listener"/> class. /// </summary> /// <param name="pluginHandler">The dAmn client.</param> public Listener(Client client, IDispatcher dispatcher) { this.client = client; this.dispatcher = dispatcher; this.shutdownPacket = new ServerPacket("shutdown\ne=bot shutdown"); }