Esempio n. 1
0
 public override void Load(Utility utility)
 {
     // NOTE: This is not actually a shift to another object, this is just
     // for convenience since the type is dynamic and my system doesn't
     // really support that.
     Content = MetaDataBase.Load(utility);
 }
Esempio n. 2
0
        public static MetaDataBase Load(Utility utility)
        {
            MetaDataBase result = null;

            // We need to load the TypeId because it tells us what kind of MetaData to expect...
            var typeId = utility.ReadU32();

            if (typeId == 0x80000000u)
            {
                result = new MetaDataSingle();
            }
            else if (typeId == 0x40000000)
            {
                result = new MetaDataColor();
            }
            else if (typeId == 0x20000000)
            {
                result = new MetaDataInteger();
            }
            else if (typeId == 0x10000000)
            {
                result = new MetaDataString();
            }

            if (result == null)
            {
                throw new NotImplementedException($"Unknown MetaData type {typeId.ToString("X8")}!");
            }

            CGFXDebug.LoadStart(result, utility, hasDynamicType: true);

            // Otherwise, proceed...
            result.TypeId = typeId;
            result.Name   = utility.ReadString();
            result.Type   = (MetaDataType)utility.ReadU32();

            result.LoadInternal(utility);

            return(result);
        }