protected override byte[] InternalConvert(byte[] sourceBytes, string fileExtension)
        {
            List <CustomAttribute> customAttributes = null;

            if (this.CustomAttributes != null)
            {
                customAttributes = new List <CustomAttribute>();

                foreach (var p in this.CustomAttributes.Keys)
                {
                    customAttributes.Add(new CustomAttribute {
                        Name  = p.ToString(),
                        Value = this.CustomAttributes[p].ToString()
                    });
                }
            }

            ConvertMessage message = new ConvertMessage()
            {
                FileBytes        = sourceBytes,
                FileExtension    = fileExtension,
                CustomAttributes = customAttributes
            };

            return(client.Convert(message).FileBytes);
        }
Exemple #2
0
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="ip">Ip adress</param>
        /// <param name="port">Port</param>
        public Client(string ip, UInt16 port) : base(ip, port)
        {
            ReciveMessage reciveMessage = delegate(string message)
            {
                TextConverter.ConvertMessage convert = new ConvertMessage();
                History.Add(message, convert.Convert(message));
            };

            ReciveMessageEvent += reciveMessage;
        }
        public void CreatingServer_WithWrongArguments_ThrowsException()
        {
            ConvertMessage converter = new ConvertMessage();

            Assert.Throws <Exception>(() => converter.Convert("影"));
        }
        public void Various_Text_Convertions_Creation(string original, string expected)
        {
            ConvertMessage convert = new ConvertMessage();

            Assert.Equal(expected, convert.Convert(original));
        }