public void registerListenExecutor(ImMessageType messageType, IClientMessageListenExecutor executor) { if (this.listenExecutors.ContainsKey(messageType)) { this.listenExecutors.Remove(messageType); } this.listenExecutors.Add(messageType, executor); }
public IClientMessageExecutor GetExecutor(ImMessageType type) { if (this.messageExecutors.ContainsKey(type)) { return(this.messageExecutors[type]); } else { return(null); } }
public bool Send(ImMessageType type) { if (this.messageExecutors.ContainsKey(type)) { return(this.Send(this.messageExecutors[type], false)); } else { throw new Exception($"Not found message type of {type.ToString()}, Please register it first."); } }
public void Register(IClientMessageExecutor executor) { if (executor == null) { return; } ImMessageType type = executor.BuildContext().Type; if (this.messageExecutors.ContainsKey(type)) { this.messageExecutors.Remove(type); } this.messageExecutors.Add(type, executor); }
public void Receive(IChannel channel, ImMessageContext messageContext) { this.CurrentChannel = channel; this.MessageType = messageContext.Type; this.MessageHead = messageContext.Head; try { this.CheckParameters(); this.ExecuteCore(messageContext); } catch (SessionInvalidException) { Push(channel, CreateResponseContext(ImStatus.SessionInvalid)); } catch (Exception e) { Push(channel, CreateResponseContext(ImStatus.Failure, e.ToString())); } }
public override void executeCore(ImMessageType messageType, ImChatGroupMessageResponse response) { Console.WriteLine(response.ToString()); }
public override void executeCore(ImMessageType messageType, ImUserValidateResponse response) { Console.WriteLine("UserValidateListen : " + response?.ToString()); }
public abstract void executeCore(ImMessageType messageType, TResponse response);