static CustomMod [] CombineCustomMods(CustomMod [] original, CustomMod [] next) { if (next == null || next.Length == 0) { return(original); } CustomMod [] mods = new CustomMod [original.Length + next.Length]; Array.Copy(original, mods, original.Length); Array.Copy(next, 0, mods, original.Length, next.Length); return(mods); }
void Write(CustomMod cm) { switch (cm.CMOD) { case CustomMod.CMODType.OPT: Write(ElementType.CModOpt); break; case CustomMod.CMODType.REQD: Write(ElementType.CModReqD); break; } Write((int)Utilities.CompressMetadataToken( CodedIndex.TypeDefOrRef, cm.TypeDefOrRef)); }
CustomMod ReadCustomMod(byte [] data, int pos, out int start) { CustomMod cm = new CustomMod(); start = pos; ElementType cmod = (ElementType)Utilities.ReadCompressedInteger(data, start, out start); if (cmod == ElementType.CModOpt) { cm.CMOD = CustomMod.CMODType.OPT; } else if (cmod == ElementType.CModReqD) { cm.CMOD = CustomMod.CMODType.REQD; } else { cm.CMOD = CustomMod.CMODType.None; } cm.TypeDefOrRef = Utilities.GetMetadataToken(CodedIndex.TypeDefOrRef, (uint)Utilities.ReadCompressedInteger(data, start, out start)); return(cm); }