示例#1
0
        private void WriteDebugStructDescriptions(PapyrusTypeDebugInfo debug)
        {
            var ms = debug.StructDescriptions;

            pexWriter.Write((short)ms.Count);
            foreach (var strct in ms)
            {
                pexWriter.Write(strct.DeclaringTypeName);
                pexWriter.Write(strct.Name);
                pexWriter.Write((short)strct.FieldNames.Count);
                foreach (var l in strct.FieldNames)
                {
                    pexWriter.Write(l);
                }
            }
        }
示例#2
0
        private void WriteDebugMethodDescriptions(PapyrusTypeDebugInfo debug)
        {
            var ms = debug.MethodDescriptions;

            pexWriter.Write((short)ms.Count);
            foreach (var method in ms)
            {
                pexWriter.Write(method.DeclaringTypeName);
                pexWriter.Write(method.StateName);
                pexWriter.Write(method.Name);
                pexWriter.Write((byte)method.MethodType);
                pexWriter.Write((short)method.BodyLineNumbers.Count);
                foreach (var l in method.BodyLineNumbers)
                {
                    pexWriter.Write(l);
                }
            }
        }
示例#3
0
        private void WriteDebugPropertyGroupDescriptions(PapyrusTypeDebugInfo debug)
        {
            var ms = debug.PropertyDescriptions;

            pexWriter.Write((short)ms.Count);
            foreach (var prop in ms)
            {
                pexWriter.Write(prop.ObjectName);
                pexWriter.Write(prop.GroupName);
                pexWriter.Write(prop.GroupDocumentation);
                pexWriter.Write(prop.Userflags);
                pexWriter.Write((short)prop.PropertyNames.Count);
                foreach (var l in prop.PropertyNames)
                {
                    pexWriter.Write(l);
                }
            }
        }
示例#4
0
        public PapyrusTypeDebugInfo ReadDebugInfo(PapyrusAssemblyDefinition asm)
        {
            var debugTable = new PapyrusTypeDebugInfo();

            var debugTime = pexReader.ReadInt64();

            debugTable.DebugTime = debugTime;

            var functionCount = pexReader.ReadInt16();

            var methodDescriptions = new List <PapyrusMethodDecription>();

            for (var i = 0; i < functionCount; i++)
            {
                var dbgfunc = new PapyrusMethodDecription();
                dbgfunc.DeclaringTypeName = pexReader.ReadStringRef();
                dbgfunc.StateName         = pexReader.ReadStringRef();
                dbgfunc.Name            = pexReader.ReadStringRef();
                dbgfunc.MethodType      = (PapyrusMethodTypes)pexReader.ReadByte();
                dbgfunc.BodyLineNumbers = new List <short>();
                var lineNumberCount = pexReader.ReadInt16();
                for (var j = 0; j < lineNumberCount; j++)
                {
                    dbgfunc.BodyLineNumbers.Add(pexReader.ReadInt16());
                }
                methodDescriptions.Add(dbgfunc);
            }
            debugTable.MethodDescriptions = methodDescriptions;

            if (asm.VersionTarget == PapyrusVersionTargets.Fallout4)
            {
                var propertyGroupCount   = pexReader.ReadInt16();
                var propertyDescriptions = new List <PapyrusStatePropertyDescriptions>();
                for (var i = 0; i < propertyGroupCount; i++)
                {
                    var groupInfo = new PapyrusStatePropertyDescriptions();
                    groupInfo.ObjectName         = pexReader.ReadStringRef();
                    groupInfo.GroupName          = pexReader.ReadStringRef();
                    groupInfo.GroupDocumentation = pexReader.ReadStringRef();
                    groupInfo.Userflags          = pexReader.ReadInt32();
                    var propertyNameCount = pexReader.ReadInt16();
                    for (var j = 0; j < propertyNameCount; j++)
                    {
                        groupInfo.PropertyNames.Add(pexReader.ReadStringRef());
                    }
                    propertyDescriptions.Add(groupInfo);
                }
                debugTable.PropertyDescriptions = propertyDescriptions;

                var structureOrderCount = pexReader.ReadInt16();

                var structDescriptions = new List <PapyrusStructDescription>();
                for (var i = 0; i < structureOrderCount; i++)
                {
                    var structDescription = new PapyrusStructDescription();
                    structDescription.DeclaringTypeName = pexReader.ReadStringRef();
                    structDescription.Name = pexReader.ReadStringRef();
                    var fieldCount = pexReader.ReadInt16();
                    for (var j = 0; j < fieldCount; j++)
                    {
                        structDescription.FieldNames.Add(pexReader.ReadStringRef());
                    }
                    structDescriptions.Add(structDescription);
                }
                debugTable.StructDescriptions = structDescriptions;
            }
            return(debugTable);
        }