public ChatHtmlView(IChatStorage storage, IDictionary <string, BotConfig> bots) { ChatHandlers = new ChatHandler(storage, bots); if (!HttpListener.IsSupported) { return; } Listener = new HttpListener(); UserSessions = new Dictionary <string, ClientModel>(); Prefixes = new string[] { Host + IndexPath, Host + LoginPath, Host + PostMessagePath, Host + DeleteMessagePath, Host + LogoutPath }; foreach (var prefix in Prefixes) { Listener.Prefixes.Add(prefix); } }
public ChatConsoleView(IChatStorage storage, IDictionary <string, BotConfig> bots) { ChatHandlers = new ChatHandler(storage, bots); ChatCmd = new CommandsForChat(); OnlineClients = new Dictionary <string, ClientModel>(); var chatInfoBuilder = new StringBuilder(ChatInfoBase); foreach (var(botName, botConfig) in bots) { if (botConfig.Bot == null) { throw new ArgumentNullException(nameof(bots)); } chatInfoBuilder.AppendLine(botName + $" - {botConfig.Discription}"); } ChatInfo = chatInfoBuilder.ToString(); IsWorking = false; }
public ChatHandler(IChatStorage storage, IDictionary <string, BotConfig> bots) { ChatStorage = storage ?? throw new ArgumentNullException(nameof(storage)); Bots = bots ?? throw new ArgumentNullException(nameof(bots)); }