Ejemplo n.º 1
0
        public static Halo3.MetaValue GetMetaValue(XmlNode node, Halo3.MetaContext context, long baseAddress)
        {
            using (var reader = context.CreateReader())
            {
                reader.Seek(baseAddress, SeekOrigin.Begin);

                var def = FieldDefinition.GetHalo3Definition(node);

                if (def.Components > 1 && (def.ValueType == MetaValueType.Float32 || def.ValueType == MetaValueType.Angle))
                {
                    return(new Halo3.MultiValue(node, context, reader, baseAddress));
                }

                switch (def.ValueType)
                {
                case MetaValueType.Structure:
                    return(new Halo3.StructureValue(node, context, reader, baseAddress));

                case MetaValueType.String:
                    return(new Halo3.StringValue(node, context, reader, baseAddress));

                case MetaValueType.StringId:
                    return(new Halo3.StringIdValue(node, context, reader, baseAddress));

                case MetaValueType.TagReference:
                    return(new Halo3.TagReferenceValue(node, context, reader, baseAddress));

                case MetaValueType.Revisions:
                case MetaValueType.Comment:
                    return(new Halo3.CommentValue(node, context, reader, baseAddress));

                case MetaValueType.Bitmask8:
                case MetaValueType.Bitmask16:
                case MetaValueType.Bitmask32:
                    return(new Halo3.BitmaskValue(node, context, reader, baseAddress));

                case MetaValueType.Enum8:
                case MetaValueType.Enum16:
                case MetaValueType.Enum32:
                    return(new Halo3.EnumValue(node, context, reader, baseAddress));

                case MetaValueType.BlockIndex8:
                case MetaValueType.BlockIndex16:
                case MetaValueType.BlockIndex32:
                    return(new Halo3.BlockIndexValue(node, context, reader, baseAddress));

                default: return(new Halo3.SimpleValue(node, context, reader, baseAddress));
                }
            }
        }
Ejemplo n.º 2
0
 public SimpleValue(XmlNode node, MetaContext context, EndianReader reader, long baseAddress)
     : base(node, context, reader, baseAddress)
 {
     ReadValue(reader);
 }