Пример #1
0
        public static void SendUserData(StreamCommunication streamCommunication, User user)
        {
            var nameData           = ConversionHandler.ConvertStringToBytes(user.Name, User.UserNameLength);
            var emailData          = ConversionHandler.ConvertStringToBytes(user.Email, User.UserEmailLength);
            var lastConnectionData = ConversionHandler.ConvertLongToBytes(user.LastConnection.ToBinary());

            streamCommunication.Write(nameData);
            streamCommunication.Write(emailData);
            streamCommunication.Write(lastConnectionData);
        }
Пример #2
0
        public static void SendCommentData(StreamCommunication streamCommunication, Comment comment)
        {
            var nameData    = ConversionHandler.ConvertStringToBytes(comment.Commentator.Name, User.UserNameLength);
            var emailData   = ConversionHandler.ConvertStringToBytes(comment.Commentator.Email, User.UserEmailLength);
            var commentData = ConversionHandler.ConvertStringToBytes(comment.Message, Comment.CommentLength);

            streamCommunication.Write(nameData);
            streamCommunication.Write(emailData);
            streamCommunication.Write(commentData);
        }
Пример #3
0
        public static void SendPhotoData(StreamCommunication streamCommunication, Photo photo)
        {
            var email    = ConversionHandler.ConvertStringToBytes(photo.User.Email, User.UserEmailLength);
            var photoId  = ConversionHandler.ConvertLongToBytes(photo.Id);
            var nameData = ConversionHandler.ConvertStringToBytes(photo.Name, Photo.PhotoNameLength);
            var extData  = ConversionHandler.ConvertStringToBytes(photo.Extension, Photo.PhotoExtensionLength);
            var sizeData = ConversionHandler.ConvertLongToBytes(photo.FileSize);

            streamCommunication.Write(email);
            streamCommunication.Write(photoId);
            streamCommunication.Write(nameData);
            streamCommunication.Write(extData);
            streamCommunication.Write(sizeData);
        }
Пример #4
0
 public static void SendMessageCommand(ProtocolConstants.ResponseCommands response, CommunicationClient client, string message)
 {
     SendResponseCommand(response, client.StreamCommunication);
     client.StreamCommunication.Write(ConversionHandler.ConvertStringToBytes(message, ProtocolConstants.ResponseMessageLength));
 }