public void Message_Sent_Appends_To_Log_File() { var listener = new ChatListener(_mockFileSystem.Object, _mockClient.Object, _config); var msg = new MessageEventArgs(false, "#chan1", "NORBERT", "WELCOME"); _mockClient.Raise(m => m.MessageSent += null, msg); const string file = "ChatLogs/#chan1.log"; const string regex = @"^\[.+\]\s<NORBERT>\sWELCOME$"; _mockFileSystem.Verify(m => m.AppendText(file, It.IsRegex(regex))); }
public void Message_Received_Appends_To_Log_File() { var listener = new ChatListener(_mockFileSystem.Object, _mockClient.Object, _config); var msg = new MessageEventArgs(false, "#chan1", "JIM", "HELLO"); _mockClient.Raise(m => m.MessageReceived += null, msg); const string file = "ChatLogs/#chan1.log"; const string regex = @"^\[.+\]\s<JIM>\sHELLO$"; _mockFileSystem.Verify(m => m.AppendText(file, It.IsRegex(regex))); }
public void Message_Sent_Exception_Caught() { _mockFileSystem .Setup(m => m.AppendText(It.IsAny<string>(), It.IsAny<string>())) .Throws(new Exception()); var listener = new ChatListener(_mockFileSystem.Object, _mockClient.Object, _config); var msg = new MessageEventArgs(false, "", "", ""); _mockClient.Raise(m => m.MessageSent += null, msg); _mockFileSystem.Verify(m => m.AppendText(It.IsAny<string>(), It.IsAny<string>())); }
/// <summary> /// Example of using components /// </summary> public ComponentsUsageExample() { var chatListenerComponent = new ChatListener(); var welcomeText = new ShowTextAtBeginning("Welcome. Type -cmd for commands"); var commandTrigger = chatListenerComponent.TriggerOnCommand("-cmd"); commandTrigger.ShowText("The following commands are:"); commandTrigger.ShowText("-help"); var commandHelp = chatListenerComponent.TriggerOnCommand("-help"); var helpShower = new Hint().ShowForDuration("There are no help here! Muhahahaha", Units.SecondsToGameTicks(3)); commandHelp.Execute(helpShower); }
public void Invoke() { var serverListener = new ServerListener(); var listener = new ThreadStart(serverListener.Listen); var receiveClients = new Thread(listener); var displayClients = new DisplayClients(); var display = new Thread(() => { displayClients.Display(serverListener); }); var chat = new ChatListener(); var chatThread = new Thread(() => { chat.StartChat(serverListener.Clients); }); receiveClients.Start(); display.Start(); chatThread.Start(); Console.ReadKey(); }
public void OnMessageReceived(BacktoryListener backtoryListener) { ChatListener chatListener = (ChatListener)backtoryListener; if (SenderId == null && GroupId == null) { chatListener.OnPushMessage(this); } else if (SenderId != null && GroupId == null) { chatListener.OnChatMessage(this); } else if (SenderId == null && GroupId != null) { chatListener.OnGroupPushMessage(this); } else if (SenderId != null && GroupId != null) { chatListener.OnGroupChatMessage(this); } }
public void OnMessageReceived(BacktoryListener backtoryListener) { ChatListener chatListener = (ChatListener)backtoryListener; chatListener.OnChatGroupUserJoinedMessage(this); }
void ChatListenerWork() { ChatListener listenChat = ChatListener.Instance; listenChat.Listener(); }
public void OnMessageReceived(BacktoryListener backtoryListener) { ChatListener chatListener = (ChatListener)backtoryListener; chatListener.OnChatInvitationMessage(this); }
public void Loaded(IConfigLoader configLoader, IChatClient chatClient, IHttpClient httpClient, IFileSystem fileSystem, IRandomiser randomiser) { var config = LoadConfig(configLoader, fileSystem); _chatListener = new ChatListener(fileSystem, chatClient, config); }
public void SetChatListener(ChatListener chatListener) { backtoryConnectivityApi.setChatListener(chatListener); }
public Config() { InitializeComponent(); Reader = new ChatListener(); }
public void setChatListener(ChatListener chatListener) { this.chatListener = chatListener; }