Пример #1
0
 public void Read(SerializedFileReader reader)
 {
     Type     = reader.ReadStringZeroTerm();
     Name     = reader.ReadStringZeroTerm();
     ByteSize = reader.ReadInt32();
     Index    = reader.ReadInt32();
     IsArray  = reader.ReadInt32() != 0;
     Version  = reader.ReadInt32();
     MetaFlag = reader.ReadUInt32();
 }
Пример #2
0
        private static string ReadString(SerializedFileReader reader, long stringPosition, uint value)
        {
            bool isCustomType = (value & 0x80000000) == 0;

            if (isCustomType)
            {
                long position = reader.BaseStream.Position;
                reader.BaseStream.Position = stringPosition + value;
                string stringValue = reader.ReadStringZeroTerm();
                reader.BaseStream.Position = position;
                return(stringValue);
            }
            else
            {
                uint         type     = value & 0x7FFFFFFF;
                TreeNodeType nodeType = (TreeNodeType)type;
                if (!Enum.IsDefined(typeof(TreeNodeType), nodeType))
                {
                    throw new Exception($"Unsupported asset class type name '{nodeType}''");
                }
                return(nodeType.ToTypeString());
            }
        }