private static bool Authenticate(IConnection connection, string password)
        {
            Logger.Receive((string)Application.Current.Resources["GetPassword"]);
            connection.BinaryWriter.Write(password);
            Logger.Send(string.Format((string)Application.Current.Resources["SendPassword"],
                                      new string('*', password.Length)));

            return(connection.BinaryReader.ReadByte() == (byte)AuthentificationFeedback.Accepted);
        }
        private ConnectionManager(string ip, int port, string password, IConnection connection)
        {
            DataTransferProtocolFactory = new DtpFactory(SendData);

            Ip       = ip;
            Port     = port;
            Password = password;
            Sender   = new Sender(connection);

            var serializer = new Serializer(new[] { typeof(WelcomePackage) });

            StaticCommander = new StaticCommander(this);

            var welcomePackage = (WelcomePackage)serializer.Deserialize(connection.BaseStream);

            _readByteDelegate += Sender.Connection.BinaryReader.ReadByte;
            _readByteDelegate.BeginInvoke(EndRead, null);

            var data = DataTransferProtocolFactory.ExecuteFunction <LightInformation>("GetAllClientsLight");

            ClientProvider  = new ClientProvider(data, DataTransferProtocolFactory);
            IpAddresses     = welcomePackage.IpAddresses;
            ExceptionsCount = welcomePackage.ExceptionCount;
        }