Exemplo n.º 1
0
 public FieldMetaData(EncodingOptions options)
 {
     Options         = options;
     Name            = new String();
     Description     = new LocalizedText();
     Flags           = new DataSetFieldFlags(options);
     Type            = BuiltinType.ExtensionObject;
     ValueRank       = -1;
     MaxStringLength = 0;
 }
Exemplo n.º 2
0
        public static FieldMetaData Decode(Stream inputStream, EncodingOptions options)
        {
            FieldMetaData instance = new FieldMetaData(options);

            // 1. Name
            instance.Name = String.Decode(inputStream);

            // 2. Description
            instance.Description = LocalizedText.Decode(inputStream);

            // 3. Field Flags
            instance.Flags = DataSetFieldFlags.Decode(inputStream, options);

            // 4. Built-in Type
            instance.Type = (BuiltinType)inputStream.ReadByte();

            // 5. DataType
            instance.DataType = NodeID.Decode(inputStream);

            // 6. Value Rank
            int?valueRank = BaseType.ReadInt32(inputStream);

            if (valueRank.HasValue)
            {
                instance.ValueRank = valueRank.Value;
            }

            // 7. Array Dimension
            instance.ArrayDimension = SimpleArray <uint> .Decode(inputStream, BaseType.ReadUInt32);

            // 8. Size
            uint?readUInt32 = BaseType.ReadUInt32(inputStream);

            if (readUInt32 != null)
            {
                instance.MaxStringLength = readUInt32.Value;
            }

            // 9. Field ID
            byte[] guidAsByte = Common.ReadBytes(inputStream, 16);
            if (guidAsByte != null && guidAsByte.Length == 16)
            {
                instance.FieldID = new Guid(guidAsByte);
            }

            // 10. Properties
            instance.Properties = ParseProperties(inputStream);
            return(instance);
        }
        public new static DataSetFieldFlags Decode(Stream inputStream, EncodingOptions options)
        {
            DataSetFieldFlags instance = new DataSetFieldFlags(options);

            if (options.LegacyFieldFlagEncoding)
            {
                inputStream.Position += 4;
                instance.Value        = new[] { (byte)inputStream.ReadByte() };
                inputStream.Position += 4;
                instance.ValidBits    = new[] { (byte)inputStream.ReadByte() };
                return(instance);
            }
            instance.Value     = new[] { (byte)inputStream.ReadByte() };
            instance.ValidBits = new[] { (byte)inputStream.ReadByte() };
            return(instance);
        }