public int Marshal(IAttributedInstance symbol, object val, byte[] bValue, int offset)
        {
            Encoding encoding = null;

            EncodingAttributeConverter.TryGetEncoding(symbol.Attributes, out encoding);
            return(this.Marshal(symbol.DataType, encoding, val, bValue, offset));
        }
        internal void InitializeInstanceValue(IAttributedInstance symbol, ref object targetInstance, byte[] data, int offset)
        {
            Encoding encoding = null;

            EncodingAttributeConverter.TryGetEncoding(symbol.Attributes, out encoding);
            this.InitializeInstanceValue(symbol.DataType, encoding, ref targetInstance, data, offset);
        }
Beispiel #3
0
        private bool TryGetEncoding(IAttributedInstance symbol, out Encoding encoding)
        {
            bool flag = EncodingAttributeConverter.TryGetEncoding(symbol.Attributes, out encoding);

            if (!flag && (symbol.DataType.Category == DataTypeCategory.String))
            {
                IStringType dataType = (IStringType)symbol.DataType;
                encoding = dataType.Encoding;
                flag     = true;
            }
            return(flag);
        }
Beispiel #4
0
        public int Unmarshal(IAttributedInstance symbol, byte[] data, int offset, out object value)
        {
            Encoding encoding = null;

            EncodingAttributeConverter.TryGetEncoding(symbol.Attributes, out encoding);
            IDataType       dataType = symbol.DataType;
            IResolvableType type2    = symbol.DataType as IResolvableType;

            if (type2 != null)
            {
                dataType = type2.ResolveType(DataTypeResolveStrategy.AliasReference);
            }
            return(this._typeMarshaller.Unmarshal(dataType, encoding, data, offset, out value));
        }