示例#1
0
        private static string GetTypeName(Dictionary <uint, string> customTypes, uint value)
        {
            bool isCustomType = (value & 0x80000000) == 0;

            if (isCustomType)
            {
                return(customTypes[value]);
            }
            else
            {
                uint         offset   = value & ~0x80000000;
                TreeNodeType nodeType = (TreeNodeType)offset;
                if (!Enum.IsDefined(typeof(TreeNodeType), nodeType))
                {
                    throw new Exception($"Unsupported asset class type name '{nodeType}''");
                }
                return(nodeType.ToTypeString());
            }
        }
示例#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());
            }
        }