Пример #1
0
        public string Convert(string payload)
        {
            string result;

            // convert from to base type
            if (_from.IsType(payload))
            {
                var rawBytes = _from.NeutralizeToCommon(payload);

                // convert to expected type
                result = _to.ConvertToBase(rawBytes);
            }
            else
            {
                //throw new ConversionException - wrong base format
                throw new BaseTypeException(string.Format(ErrorResource.BrokerConversionInvalid, _from.HandlesType()));
            }

            return(result);
        }
        public string Convert(string payload)
        {
            string result;

            // convert from to base type
            if (_from.IsType(payload))
            {
                byte[] rawBytes = _from.NeutralizeToCommon(payload);

                // convert to expected type
                result = _to.ConvertToBase(rawBytes);
            }
            else
            {
                //throw new ConversionException - wrong base format
                throw new BaseTypeException("Base Conversion Broker was expecting [ " + _from.HandlesType() + " ] but the data was not in this format");
            }

            return(result);
        }