void RegisterRenamers(ConfuserContext context, NameService service) { bool wpf = false, caliburn = false; foreach (var module in context.Modules) { foreach (var asmRef in module.GetAssemblyRefs()) { if (asmRef.Name == "WindowsBase" || asmRef.Name == "PresentationCore" || asmRef.Name == "PresentationFramework" || asmRef.Name == "System.Xaml") { wpf = true; } else if (asmRef.Name == "Caliburn.Micro") { caliburn = true; } } } if (wpf) { var wpfAnalyzer = new WPFAnalyzer(); context.Logger.Debug("WPF found, enabling compatibility."); service.Renamers.Add(wpfAnalyzer); if (caliburn) { context.Logger.Debug("Caliburn.Micro found, enabling compatibility."); service.Renamers.Add(new CaliburnAnalyzer(wpfAnalyzer)); } } }
void RegisterRenamers(ConfuserContext context, NameService service) { bool wpf = false, caliburn = false, winforms = false, json = false; foreach (var module in context.Modules) { foreach (var asmRef in module.GetAssemblyRefs()) { if (asmRef.Name == "WindowsBase" || asmRef.Name == "PresentationCore" || asmRef.Name == "PresentationFramework" || asmRef.Name == "System.Xaml") { wpf = true; } else if (asmRef.Name == "Caliburn.Micro") { caliburn = true; } else if (asmRef.Name == "System.Windows.Forms") { winforms = true; } else if (asmRef.Name == "Newtonsoft.Json") { json = true; } } } if (wpf) { var wpfAnalyzer = new WPFAnalyzer(); context.Logger.Debug("发现WPF,兼容性。"); service.Renamers.Add(wpfAnalyzer); if (caliburn) { context.Logger.Debug("Caliburn.Micro发现,兼容性。"); service.Renamers.Add(new CaliburnAnalyzer(wpfAnalyzer)); } } if (winforms) { var winformsAnalyzer = new WinFormsAnalyzer(); context.Logger.Debug("发现WinForms,兼容性。"); service.Renamers.Add(winformsAnalyzer); } if (json) { var jsonAnalyzer = new JsonAnalyzer(); context.Logger.Debug("发现Newtonsoft.Json,兼容性。"); service.Renamers.Add(jsonAnalyzer); } }
void RegisterRenamers(ConfuserContext context, NameService service) { bool wpf = false; bool caliburn = false; bool winforms = false; bool json = false; bool visualBasic = false; bool vsComposition = false; foreach (var module in context.Modules) { foreach (var asmRef in module.GetAssemblyRefs()) { if (asmRef.Name == "WindowsBase" || asmRef.Name == "PresentationCore" || asmRef.Name == "PresentationFramework" || asmRef.Name == "System.Xaml") { wpf = true; } else if (asmRef.Name == "Caliburn.Micro") { caliburn = true; } else if (asmRef.Name == "System.Windows.Forms") { winforms = true; } else if (asmRef.Name == "Newtonsoft.Json") { json = true; } else if (asmRef.Name == "Microsoft.VisualStudio.Composition") { vsComposition = true; } } var vbEmbeddedAttribute = module.FindNormal("Microsoft.VisualBasic.Embedded"); if (vbEmbeddedAttribute != null && vbEmbeddedAttribute.BaseType.FullName.Equals("System.Attribute")) { visualBasic = true; } } if (wpf) { var wpfAnalyzer = new WPFAnalyzer(); context.Logger.Debug("WPF found, enabling compatibility."); service.Renamers.Add(wpfAnalyzer); if (caliburn) { context.Logger.Debug("Caliburn.Micro found, enabling compatibility."); service.Renamers.Add(new CaliburnAnalyzer(wpfAnalyzer)); } } if (winforms) { var winformsAnalyzer = new WinFormsAnalyzer(); context.Logger.Debug("WinForms found, enabling compatibility."); service.Renamers.Add(winformsAnalyzer); } if (json) { var jsonAnalyzer = new JsonAnalyzer(); context.Logger.Debug("Newtonsoft.Json found, enabling compatibility."); service.Renamers.Add(jsonAnalyzer); } if (visualBasic) { var vbAnalyzer = new VisualBasicRuntimeAnalyzer(); context.Logger.Debug("Visual Basic Embedded Runtime found, enabling compatibility."); service.Renamers.Add(vbAnalyzer); } if (vsComposition) { var analyzer = new VsCompositionAnalyzer(); context.Logger.Debug("Visual Studio Composition found, enabling compatibility."); service.Renamers.Add(analyzer); } }
void RegisterRenamers(ConfuserContext context, NameService service) { bool wpf = false, caliburn = false, winforms = false, json = false; foreach (ModuleDefMD module in context.Modules) { foreach (AssemblyRef asmRef in module.GetAssemblyRefs()) { switch (asmRef.Name) { case "WindowsBase": case "PresentationCore": case "PresentationFramework": case "System.Xaml": wpf = true; break; case "Caliburn.Micro": caliburn = true; break; case "System.Windows.Forms": winforms = true; break; case "Newtonsoft.Json": json = true; break; } } } if (wpf) { var wpfAnalyzer = new WPFAnalyzer(); //context.Logger.Debug("WPF found, enabling compatibility."); service.Renamers.Add(wpfAnalyzer); if (caliburn) { //context.Logger.Debug("Caliburn.Micro found, enabling compatibility."); service.Renamers.Add(new CaliburnAnalyzer(wpfAnalyzer)); } } if (winforms) { var winformsAnalyzer = new WinFormsAnalyzer(); //context.Logger.Debug("WinForms found, enabling compatibility."); service.Renamers.Add(winformsAnalyzer); } if (json) { var jsonAnalyzer = new JsonAnalyzer(); //context.Logger.Debug("Newtonsoft.Json found, enabling compatibility."); service.Renamers.Add(jsonAnalyzer); } }
void RegisterRenamers(ConfuserContext context, NameService service) { bool wpf = false, caliburn = false, winforms = false, json = false, aspnetcore = false, nancyfx = false; foreach (var module in context.Modules) { foreach (var asmRef in module.GetAssemblyRefs()) { if (asmRef.Name == "WindowsBase" || asmRef.Name == "PresentationCore" || asmRef.Name == "PresentationFramework" || asmRef.Name == "System.Xaml") { wpf = true; } else if (asmRef.Name == "Caliburn.Micro") { caliburn = true; } else if (asmRef.Name == "System.Windows.Forms") { winforms = true; } else if (asmRef.Name == "Newtonsoft.Json") { json = true; } else if (asmRef.Name.StartsWith("Microsoft.AspNetCore.")) { aspnetcore = true; } else if (asmRef.Name == "Nancy") { nancyfx = true; } } } if (wpf) { #if !NETCOREAPP2_0 var wpfAnalyzer = new WPFAnalyzer(); context.Logger.Debug("WPF found, enabling compatibility."); service.Renamers.Add(wpfAnalyzer); if (caliburn) { context.Logger.Debug("Caliburn.Micro found, enabling compatibility."); service.Renamers.Add(new CaliburnAnalyzer(wpfAnalyzer)); } #else context.Logger.Warn("Found WPF, but netcoreapp2.0 doesn't have any WPF support at the moment."); #endif } if (winforms) { #if !NETCOREAPP2_0 var winformsAnalyzer = new WinFormsAnalyzer(); context.Logger.Debug("WinForms found, enabling compatibility."); service.Renamers.Add(winformsAnalyzer); #else context.Logger.Warn("Found WinForms, but netcoreapp2.0 doesn't have any WinForms support at the moment."); #endif } //if (json) //{ // var jsonAnalyzer = new JsonAnalyzer(); // context.Logger.Debug("Newtonsoft.Json found, enabling compatibility."); // service.Renamers.Add(jsonAnalyzer); //} if (aspnetcore) { var aspnetCoreAnalyzer = new AspNetCoreAnalyzer(); context.Logger.Debug("ASP.NET Core found, enabling compatibility."); service.Renamers.Add(aspnetCoreAnalyzer); } if (nancyfx) { var nancyFxAnalyzer = new NancyFxAnalyzer(); context.Logger.Debug("NancyFx found, enabling compatibility."); service.Renamers.Add(nancyFxAnalyzer); } }