internal static void AcceptAnalysers(this IDnlibDef def, RenamerContext ctx, IEnumerable <IAnalyser> analysers) { foreach (var analyser in analysers) { analyser.Analyse(def, ctx); } }
public void Analyse(IDnlibDef def, RenamerContext ctx) { if (def is AssemblyDef || def is ModuleDef) { return; } def.AcceptAnalysers(ctx, _analysers); }
public void Analyse(IDnlibDef def, RenamerContext ctx) { if (!(def is MethodDef method) || !method.IsConstructor) { return; } ctx.Remove(def); }
public void Analyse(IDnlibDef def, RenamerContext ctx) { if (!(def is TypeDef type)) { return; } if (type.IsGlobalModuleType) { ctx.Remove(def); } }
public void Analyse(IDnlibDef def, RenamerContext ctx) { if (!(def is IMemberDef member) || def is PropertyDef || def is EventDef) { return; } dynamic real = member; //There is no interface that would allow us to `member.IsPublic` :/ if (real.IsPublic) { ctx.Remove(def); } }
public void Analyse(IDnlibDef def, RenamerContext ctx) { if (!(def is TypeDef type) || type.BaseType is null) { return; } if (type.BaseType.FullName != "System.Windows.Forms.Form") { return; } //We definitely have a Form class that could have a resource linked to it //that has to be renamed as well. var resource = FindResource(type); if (resource is null) { return; } //Link the form to its resource, so they will get the same name. ctx.Link(type, resource); }
public void Analyse(IDnlibDef def, RenamerContext ctx) { if (!(def is TypeDef type) || !type.HasInterfaces) { return; } foreach (var inf in type.Interfaces.Select(i => i.Interface)) { var resolved = inf.ResolveTypeDefThrow(); if (resolved.Module != type.Module) { foreach (var method in resolved.Methods) { var impl = TryGetImplementation(type, method); if (impl is null) { continue; } ctx.Remove(impl); } foreach (var prop in resolved.Properties) { var impl = TryGetImplementation(type, prop); if (impl is null) { continue; } ctx.Remove(impl); } foreach (var ev in resolved.Events) { var impl = TryGetImplementation(type, ev); if (impl is null) { continue; } ctx.Remove(impl); } continue; } //Link all properties, methods and events that are implemented foreach (var method in resolved.Methods) { var impl = TryGetImplementation(type, method); if (impl is null) { continue; } ctx.Link(impl, method); } foreach (var ev in resolved.Events) { var impl = TryGetImplementation(type, ev); if (impl is null) { continue; } ctx.Link(impl, ev); } //Although technically we don't need to link the properties themselves, //only their getter and setter methods //but sshhhhhh, let's be good guys and do it anyway foreach (var prop in resolved.Properties) { var impl = TryGetImplementation(type, prop); if (impl is null) { continue; } ctx.Link(impl, prop); } } }
public void Analyse(IDnlibDef def, RenamerContext ctx) { // }