public ChatClient( ITcpWrapper tcpClient, AesEncryption aesEncryption, ICoding coding) { this.tcpClient = tcpClient; this.aesEncryption = aesEncryption; this.coding = coding; rsa = new RSACryptoServiceProvider(4096); serverKey = this.aesEncryption.GetKey(); InitializeHandlers(); }
public ClientInstance(ITcpWrapper tcpClient, ServerInstance serverInstance, ICoding coding) { Id = Guid.NewGuid(); server = serverInstance; this.tcpClient = tcpClient; this.coding = coding; aesEncryption = new AesEncryption(); RequestHandlers = new Dictionary <ClientAction, Action <string> > { { ClientAction.Login, LoginHandler }, { ClientAction.Register, RegisterHandler }, { ClientAction.ShowAllChats, ShowAllChatsHandler }, { ClientAction.CreateChat, CreateChatHandler }, { ClientAction.EnterChat, EnterChatHandler }, { ClientAction.ShowUsersInChat, ShowUsersInChatHandler }, { ClientAction.GoToMainMenu, GoToMainMenuHandler }, { ClientAction.SendMessage, MessageHandler } }; }