コード例 #1
0
        private void InitializeClassList()
        {
            var reader        = AssetReader;
            var baseCount     = reader.ReadInt32();
            var stringBuilder = new StringBuilder();

            for (var i = 0; i < baseCount; ++i)
            {
                if (FormatSignature < 14)
                {
                    var classID  = reader.ReadInt32();
                    var baseType = reader.ReadAsciiStringToNull();
                    var baseName = reader.ReadAsciiStringToNull();
                    reader.Position += 20;
                    var memberCount = reader.ReadInt32();

                    for (var m = 0; m < memberCount; ++m)
                    {
                        stringBuilder.Clear();
                        ReadClassStructure(stringBuilder, 1);
                    }

                    var clazz = new ClassDescriptor {
                        ID      = classID,
                        Text    = baseType + " " + baseName,
                        Members = stringBuilder.ToString()
                    };
                    ClassStructures.Add(classID, clazz);
                }
                else
                {
                    ReadClassStructure5();
                }
            }
        }
コード例 #2
0
ファイル: AssetsFile.cs プロジェクト: statementreply/DereTore
        private void ReadClassStructure5()
        {
            var reader  = AssetReader;
            var classID = reader.ReadInt32();

            if (classID < 0)
            {
                reader.Position += 16;
            }
            reader.Position += 16;

            if (!HasBaseDefinitions)
            {
                return;
            }

            var varCount   = reader.ReadInt32();
            var stringSize = reader.ReadInt32();

            reader.Position += varCount * 24;
            var varStrings  = Encoding.UTF8.GetString(reader.ReadBytes(stringSize));
            var className   = string.Empty;
            var classVarStr = new StringBuilder();

            //build Class Structures
            reader.Position -= varCount * 24 + stringSize;
            for (var i = 0; i < varCount; ++i)
            {
                var num0    = reader.ReadUInt16();
                var level   = reader.ReadByte();
                var isArray = reader.ReadBoolean();

                var    varTypeIndex = reader.ReadUInt16();
                var    test         = reader.ReadUInt16();
                string varTypeStr;
                if (test == 0)
                {
                    //varType is an offset in the string block
                    varTypeStr = varStrings.Substring(varTypeIndex, varStrings.IndexOf('\0', varTypeIndex) - varTypeIndex);
                }
                else
                {
                    //varType is an index in an internal strig array
                    varTypeStr = BaseIDReference.GetName(varTypeIndex) ?? varTypeIndex.ToString();
                }

                var varNameIndex = reader.ReadUInt16();
                test = reader.ReadUInt16();
                string varNameStr;
                if (test == 0)
                {
                    varNameStr = varStrings.Substring(varNameIndex, varStrings.IndexOf('\0', varNameIndex) - varNameIndex);
                }
                else
                {
                    varNameStr = BaseIDReference.GetName(varNameIndex) ?? varNameIndex.ToString();
                }

                var size  = reader.ReadInt32();
                var index = reader.ReadInt32();
                var num1  = reader.ReadInt32();

                if (index == 0)
                {
                    className = varTypeStr + " " + varNameStr;
                }
                else
                {
                    classVarStr.AppendFormat("{0}{1} {2} {3}\r", new string('\t', level), varTypeStr, varNameStr, size);
                }
            }
            reader.Position += stringSize;

            var aClass = new ClassDescriptor {
                ID      = classID,
                Text    = className,
                Members = classVarStr.ToString()
            };

            ClassStructures.Add(classID, aClass);
        }