示例#1
0
        private void Received(Socket handler, byte[] data)
        {
            //if (_fileIsUploading)
            //{
            //    var client = AddNotExistClientToCollection(handler);
            //    _currentUploadingFile.CurrentBytes.AddRange(data);
            //    var percents = _currentUploadingFile.GetLoadingPercentage();
            //    Console.WriteLine("Percents: {0}%", percents);
            //    client.SendMessage("OK");
            //    if (_currentUploadingFile.CurrentBytes.Count >= _currentUploadingFile.Size)
            //    {
            //        _fileManager.SaveFile(_currentUploadingFile);
            //        UploadingFiles.Remove(_currentUploadingFile);
            //        _fileIsUploading = false;
            //    }
            //}
            //else
            //{
            var client        = AddNotExistClientToCollection(handler);
            var dataStr       = _dataConverter.GetString(data);
            var clientMessage = _dataToClientMessageConverter.ConvertDataToClientMessage(dataStr);
            var serverMessage = _messageManager.Interpret(this, client, clientMessage);

            client.SendMessage(serverMessage);
            //}
        }