public CodeForm(MethodDefinition source) { InitializeComponent(); _mdefsource = source; var helper = LanguageHelperFactory.GetLanguageHelper(Settings.Default.Language); TextEditor.Text = helper.GenerateSourceCode(source, CompileReferences); // Guess best compiler profile SelProfile.Items.Add(Compiler.DotNet2Profile); SelProfile.Items.Add(Compiler.DotNet35Profile); SelProfile.Items.Add(Compiler.DotNet4Profile); SelProfile.Items.Add(Compiler.UnitySilverLightProfile); SelProfile.Items.Add(Compiler.SilverLight5Profile); SelProfile.SelectedItem = GuessCompilerProfile(source); // Hook AssemblyResolve Event, usefull if reflexil is not located in the host program path AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; _appdomain = AppDomainHelper.CreateAppDomain(); _compiler = AppDomainHelper.CreateCompilerInstanceAndUnwrap(_appdomain); SetupIntellisense(TextEditor); TextEditor.Document.FoldingManager.FoldingStrategy = new RegionFoldingStrategy(); TextEditor.Document.FoldingManager.UpdateFoldings(DummyFileName, null); TextEditor.Refresh(); }
protected override string PrepareText(MethodReference value) { if (!(value is GenericInstanceMethod)) { return(base.PrepareText(value)); } var helper = LanguageHelperFactory.GetLanguageHelper(Settings.Default.Language); return(helper.GetMethodSignature(value)); }
public CodeForm(MethodDefinition source) { InitializeComponent(); _mdefsource = source; ILanguageHelper helper = LanguageHelperFactory.GetLanguageHelper(Settings.Default.Language); TextEditor.Text = helper.GenerateSourceCode(source, CompileReferences); // Guess best compiler version SelVersion.Items.Add(Compiler.DotNet2Profile); SelVersion.Items.Add(Compiler.DotNet35Profile); SelVersion.Items.Add(Compiler.DotNet4Profile); SelVersion.Items.Add(Compiler.UnitySilverLightProfile); switch (source.Module.Runtime) { case TargetRuntime.Net_4_0: SelVersion.SelectedItem = Compiler.DotNet4Profile; break; case TargetRuntime.Net_2_0: if (IsUnityOrSilverLightAssembly) { SelVersion.SelectedItem = Compiler.UnitySilverLightProfile; break; } if (IsReferencingSystemCore) { SelVersion.SelectedItem = Compiler.DotNet35Profile; break; } SelVersion.SelectedItem = Compiler.DotNet2Profile; break; default: SelVersion.SelectedItem = Compiler.DotNet2Profile; break; } // Hook AssemblyResolve Event, usefull if reflexil is not located in the host program path AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; _appdomain = AppDomainHelper.CreateAppDomain(); _compiler = AppDomainHelper.CreateCompilerInstanceAndUnwrap(_appdomain); SetupIntellisense(TextEditor); TextEditor.Document.FoldingManager.FoldingStrategy = new RegionFoldingStrategy(); TextEditor.Document.FoldingManager.UpdateFoldings(DummyFileName, null); TextEditor.Refresh(); }
public CodeForm(MethodDefinition source) { InitializeComponent(); _mdefsource = source; ILanguageHelper helper = LanguageHelperFactory.GetLanguageHelper(Settings.Default.Language); TextEditor.Text = helper.GenerateSourceCode(source, CompileReferences); // Guess best compiler version SelVersion.Items.Add(Compiler.CompilerV20); SelVersion.Items.Add(Compiler.CompilerV35); SelVersion.Items.Add(Compiler.CompilerV40); switch (source.Module.Runtime) { case TargetRuntime.Net_4_0: SelVersion.Text = Compiler.CompilerV40; break; case TargetRuntime.Net_2_0: SelVersion.Text = Array.Find(GetReferences(true), s => s != null && s.ToLower().EndsWith("system.core.dll")) != null ? Compiler.CompilerV35 : Compiler.CompilerV20; break; default: SelVersion.Text = Compiler.CompilerV20; break; } // Hook AssemblyResolve Event, usefull if reflexil is not located in the host program path AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); _appdomain = AppDomainHelper.CreateAppDomain(); _compiler = AppDomainHelper.CreateCompilerInstanceAndUnwrap(_appdomain); SetupIntellisense(TextEditor); TextEditor.Document.FoldingManager.FoldingStrategy = new RegionFoldingStrategy(); TextEditor.Document.FoldingManager.UpdateFoldings(DummyFileName, null); TextEditor.Refresh(); }