Esempio n. 1
0
        public Client(string username, IPAddress serverAddress, int serverPort,
                      string encryption, bool logging)
        {
            messageOutput = new ClientMessageOutput(username, logging);
            var tcpClient = new TcpClient();

            tcpClient.Connect(serverAddress, serverPort);
            server = new ConnectionToServer(tcpClient,
                                            messageOutput,
                                            encryption);
            this.username = username;
        }
Esempio n. 2
0
        public Client(string configPath = @".\settings.json")
        {
            var settings = new SettingsJsonReader(configPath);

            username      = settings.GetValue("username");
            messageOutput = new ClientMessageOutput(username,
                                                    Convert.ToBoolean(settings.GetValue("logging")));
            var tcpClient = new TcpClient();

            tcpClient.Connect(settings.GetValue("address"),
                              Convert.ToInt32(settings.GetValue("port")));
            server = new ConnectionToServer(tcpClient,
                                            messageOutput,
                                            settings.GetValue("encryption"));
        }