示例#1
0
        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
        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);
        }
示例#3
0
 void Write(LocalVarSig.LocalVariable var)
 {
     Write(var.CustomMods);
     if ((var.Constraint & Constraint.Pinned) != 0)
     {
         Write(ElementType.Pinned);
     }
     if (var.ByRef)
     {
         Write(ElementType.ByRef);
     }
     Write(var.Type);
 }
示例#4
0
 public byte [] CompressLocalVar(LocalVarSig.LocalVariable var)
 {
     m_sigWriter.Empty();
     Write(var);
     return(m_sigWriter.ToArray());
 }