コード例 #1
0
        public LocalVarSig.LocalVariable ReadLocalVariable(byte[] data, int pos, out int start)
        {
            start = pos;
            LocalVarSig.LocalVariable lv = new LocalVarSig.LocalVariable();
            lv.ByRef = false;
            int cursor;

            while (true)
            {
                lv.CustomMods = ReadCustomMods(data, start, out start);
                cursor        = start;
                int current = Utilities.ReadCompressedInteger(data, start, out start);
                if (current == (int)ElementType.Pinned) // the only possible constraint
                {
                    lv.Constraint |= Constraint.Pinned;
                }
                else if (current == (int)ElementType.ByRef)
                {
                    lv.ByRef = true;

                    if (lv.CustomMods == null || lv.CustomMods.Length == 0)
                    {
                        lv.CustomMods = ReadCustomMods(data, start, out start);
                    }
                }
                else
                {
                    lv.Type = ReadType(data, cursor, out start);
                    break;
                }
            }
            return(lv);
        }
コード例 #2
0
        private LocalVarSig.LocalVariable[] ReadLocalVariables(int length, byte[] data, int pos)
        {
            int start = pos;

            LocalVarSig.LocalVariable[] types = new LocalVarSig.LocalVariable[length];
            for (int i = 0; i < length; i++)
            {
                types[i] = ReadLocalVariable(data, start, out start);
            }
            return(types);
        }