FullNameCreator(bool isReflection, IFullNameCreatorHelper helper, StringBuilder sb) { this.sb = sb ?? new StringBuilder(); this.isReflection = isReflection; this.helper = helper; this.genericArguments = null; this.recursionCounter = new RecursionCounter(); }
CustomAttributeReader(ModuleDef module, IBinaryReader reader, bool ownRerader) { this.module = module; this.reader = reader; this.ownReader = ownRerader; this.genericArguments = null; this.recursionCounter = new RecursionCounter(); this.verifyReadAllBytes = false; }
CustomAttributeReader(ModuleDefMD readerModule, uint offset) { this.module = readerModule; this.reader = readerModule.BlobStream.CreateStream(offset); this.ownReader = true; this.genericArguments = null; this.recursionCounter = new RecursionCounter(); this.verifyReadAllBytes = false; }
CustomAttributeReader(ModuleDef module, IBinaryReader reader, GenericParamContext gpContext) { this.module = module; this.reader = reader; this.ownReader = false; this.genericArguments = null; this.recursionCounter = new RecursionCounter(); this.verifyReadAllBytes = false; this.gpContext = gpContext; }
void BuildNodeMap(BamlBlockNode node, RecursionCounter counter) { if (node == null || !counter.Increment()) return; NodeMap[node.Header] = node; foreach (var child in node.Children) { var childBlock = child as BamlBlockNode; if (childBlock != null) BuildNodeMap(childBlock, counter); } counter.Decrement(); }
/// <summary> /// Initializes a new instance of the <see cref="GenericArgumentResolver"/> class. /// </summary> public GenericArgumentResolver() { genericArguments = new GenericArguments(); recursionCounter = new RecursionCounter(); }
CustomAttributeReader(ModuleDef module, IImageStream reader, ICustomAttributeType ctor) { this.module = module; this.reader = reader; this.ownReader = false; this.ctor = ctor; this.genericArguments = null; this.recursionCounter = new RecursionCounter(); this.verifyReadAllBytes = false; }
/// <summary> /// Constructor /// </summary> /// <param name="module">The module that will own all references</param> public Importer(ModuleDef module) { this.module = module; this.recursionCounter = new RecursionCounter(); this.options = 0; }
/// <summary> /// Constructor /// </summary> /// <param name="module">The module that will own all references</param> /// <param name="options">Importer options</param> public Importer(ModuleDef module, ImporterOptions options) { this.module = module; this.recursionCounter = new RecursionCounter(); this.options = options; }
/// <summary> /// Constructor /// </summary> /// <param name="readerModule">Reader module</param> /// <param name="sig">#Blob stream offset of signature</param> SignatureReader(ModuleDefMD readerModule, uint sig) { this.readerModule = readerModule; this.reader = readerModule.BlobStream.CreateStream(sig); this.recursionCounter = new RecursionCounter(); }
static void CreateDisplayName(StringBuilder sb, RecursionCounter recu, TypeSig sig, bool fullName) { if (sig == null) { sb.Append("<<<NULL>>>"); return; } if (!recu.Increment()) { sb.Append("<<<INFRECURSION>>>"); return; } switch (sig.ElementType) { case ElementType.Void: case ElementType.Boolean: case ElementType.Char: case ElementType.I1: case ElementType.U1: case ElementType.I2: case ElementType.U2: case ElementType.I4: case ElementType.U4: case ElementType.I8: case ElementType.U8: case ElementType.R4: case ElementType.R8: case ElementType.String: case ElementType.TypedByRef: case ElementType.I: case ElementType.U: case ElementType.Object: case ElementType.ValueType: case ElementType.Class: var type = ((TypeDefOrRefSig)sig).TypeDefOrRef; if (fullName) sb.Append(type.ReflectionFullName); else sb.Append(type.Name ?? "<<<NULL>>>"); break; case ElementType.Ptr: CreateDisplayName(sb, recu, sig.Next, fullName); sb.Append('*'); break; case ElementType.ByRef: CreateDisplayName(sb, recu, sig.Next, fullName); sb.Append('&'); break; case ElementType.Array: { CreateDisplayName(sb, recu, sig.Next, fullName); var arraySig = (ArraySig)sig; sb.Append('['); uint rank = arraySig.Rank; if (rank == 0) sb.Append("<RANK0>"); // Not allowed else if (rank == 1) sb.Append('*'); else for (int i = 0; i < (int)rank; i++) { if (i != 0) sb.Append(", "); const int NO_LOWER = int.MinValue; const uint NO_SIZE = uint.MaxValue; int lower = arraySig.LowerBounds.Get(i, NO_LOWER); uint size = arraySig.Sizes.Get(i, NO_SIZE); if (lower != NO_LOWER) { sb.Append(lower); sb.Append(".."); if (size != NO_SIZE) sb.Append(lower + (int)size - 1); else sb.Append('.'); } } sb.Append(']'); break; } case ElementType.SZArray: CreateDisplayName(sb, recu, sig.Next, fullName); sb.Append("[]"); break; case ElementType.CModReqd: CreateDisplayName(sb, recu, sig.Next, fullName); sb.Append(" modreq("); sb.Append(((ModifierSig)sig).Modifier.Name ?? "<<<NULL>>>"); sb.Append(")"); break; case ElementType.CModOpt: CreateDisplayName(sb, recu, sig.Next, fullName); sb.Append(" modopt("); sb.Append(((ModifierSig)sig).Modifier.Name ?? "<<<NULL>>>"); sb.Append(")"); break; case ElementType.Pinned: CreateDisplayName(sb, recu, sig.Next, fullName); break; case ElementType.ValueArray: CreateDisplayName(sb, recu, sig.Next, fullName); var valueArraySig = (ValueArraySig)sig; sb.Append(" ValueArray("); sb.Append(valueArraySig.Size); sb.Append(')'); break; case ElementType.Module: CreateDisplayName(sb, recu, sig.Next, fullName); var moduleSig = (ModuleSig)sig; sb.Append(" Module("); sb.Append(moduleSig.Index); sb.Append(')'); break; case ElementType.GenericInst: { var genericInstSig = (GenericInstSig)sig; var typeGenArgs = genericInstSig.GenericArguments; CreateDisplayName(sb, recu, genericInstSig.GenericType, fullName); sb.Append('<'); int i = -1; foreach (var genArg in typeGenArgs.GetSafeEnumerable()) { i++; if (i != 0) sb.Append(", "); CreateDisplayName(sb, recu, genArg, false); } sb.Append('>'); } break; case ElementType.Var: case ElementType.MVar: var gs = (GenericSig)sig; var gp = gs.GenericParam; if (gp == null || UTF8String.IsNullOrEmpty(gp.Name)) { sb.Append(gs.IsMethodVar ? "!!" : "!"); sb.Append(gs.Number); } else sb.Append(gp.Name); break; case ElementType.FnPtr: sb.Append("(fnptr)"); break; case ElementType.Sentinel: break; case ElementType.End: case ElementType.R: case ElementType.Internal: default: break; } recu.Decrement(); }