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); }
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); }
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); }
public byte [] CompressLocalVar(LocalVarSig.LocalVariable var) { m_sigWriter.Empty(); Write(var); return(m_sigWriter.ToArray()); }