LoadFrom() public method

public LoadFrom ( Stream stream ) : bool
stream Stream
return bool
Ejemplo n.º 1
0
        public override bool LoadFrom(Stream stream)
        {
            base.LoadFrom(stream);
            Attribute.LoadFrom(stream);
            BaseTypeName = stream.ReadString();

            //types
            uint typeCount = stream.ReadUInt();

            for (int i = 0; i < typeCount; i++)
            {
                byte isClass = (byte)stream.ReadByte();
                if (isClass == 1)
                {
                    SirenCustomClass type = new SirenCustomClass();
                    type.LoadFrom(stream);
                    type.Parent = this;
                    Types.Add(type.Name, type);
                }
                else
                {
                    SirenCustomEnum type = new SirenCustomEnum();
                    type.LoadFrom(stream);
                    type.Parent = this;
                    Types.Add(type.Name, type);
                }
            }
            //fields
            uint fieldCount = stream.ReadUInt();

            for (int i = 0; i < fieldCount; i++)
            {
                SirenField field = new SirenField();
                field.LoadFrom(stream);
                field.ParentType = this;
                FieldNameDict.Add(field.Name, field);
                field.Index = (ushort)(FieldNameDict.Count - 1);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public override bool LoadFrom(Stream stream)
        {
            base.LoadFrom(stream);
            Attribute.LoadFrom(stream);
            BaseTypeName = stream.ReadString();

            //types
            uint typeCount = stream.ReadUInt();
            for (int i = 0; i < typeCount; i++)
            {
                byte isClass = (byte)stream.ReadByte();
                if (isClass == 1)
                {
                    SirenCustomClass type = new SirenCustomClass();
                    type.LoadFrom(stream);
                    type.Parent = this;
                    Types.Add(type.Name, type);
                }
                else
                {
                    SirenCustomEnum type = new SirenCustomEnum();
                    type.LoadFrom(stream);
                    type.Parent = this;
                    Types.Add(type.Name, type);
                }
            }
            //fields
            uint fieldCount = stream.ReadUInt();
            for (int i = 0; i < fieldCount; i++)
            {
                SirenField field = new SirenField();
                field.LoadFrom(stream);
                field.ParentType = this;
                FieldNameDict.Add(field.Name, field);
                field.Index = (ushort)(FieldNameDict.Count - 1);
            }

            return true;
        }