public BaseMergeReflectionVisitor (MergeContext context, AssemblyDefinition target, AssemblyDefinition source) { this.context = context; this.target = target; this.source = source; module = target.MainModule; }
public BaseMergeReflectionVisitor(MergeContext context, AssemblyDefinition target, AssemblyDefinition source) { this.context = context; this.target = target; this.source = source; module = target.MainModule; }
public void AddExternalMethods(MergeContext context) { foreach (List <MethodDefinition> methods in externalMethods.Values) { foreach (MethodDefinition method in methods) { context.MainType.Methods.Add(method); } } foreach (ModuleReference library in referredLibraries.Values) { context.OutputAssembly.MainModule.ModuleReferences.Add(library); } }
static void Process(MergeContext context) { AssemblyDefinition primary = null; try { primary = AssemblyFactory.GetAssembly(context.Assemblies [0]); for (int i = 1; i < context.Assemblies.Count; i++) { AssemblyDefinition asm = AssemblyFactory.GetAssembly(context.Assemblies [i]); asm.Accept(new StructureMerger(context, primary, asm)); } } catch (FileNotFoundException e) { Error(e.Message); } FixReflectionAfterMerge fix = new FixReflectionAfterMerge(context, primary, primary); fix.Process(); AssemblyFactory.SaveAssembly(primary, context.OutputPath); ConfigMerger.Process(context.Assemblies, context.OutputPath); }
static void Run(Queue q) { MergeContext context = GetDefaultContext(); while (q.Count > 0) { string token = (string)q.Dequeue(); if (token.Length < 2) { Usage(); } if (token [0] == '-' && token [1] == '-') { if (token.Length < 3) { Usage(); } switch (token [2]) { case 'v': Version(); break; case 'a': About(); break; default: Usage(); break; } } if (token [0] == '-' || token [0] == '/') { token = token.Substring(1); if (token == "o" || token == "out") { context.OutputPath = (string)q.Dequeue(); } else if (token == "e" || token == "exe") { context.OutputIsExecutable = true; } else if (token == "d" || token == "dll") { context.OutputIsExecutable = false; } else if (token == "L") { context.NativeLibraries.LibrariesSearchPaths.Add((string)q.Dequeue()); } else if (token == "l") { context.NativeLibraries.Libraries.Add((string)q.Dequeue()); } else { Usage(); } } else { context.Assemblies.Add(token); while (q.Count > 0) { context.Assemblies.Add((string)q.Dequeue()); } } } if (context.Assemblies.Count < 2) { Error("At least two assemblies needed"); } if (context.OutputPath == "") { Error("Please set output filename"); } context.NativeLibraries.Libraries.Add("c"); context.NativeLibraries.LibrariesSearchPaths.Add("/lib"); context.NativeLibraries.Initialize(); context.Link(); }
static MergeContext GetDefaultContext() { MergeContext context = new MergeContext(); return(context); }
static MergeContext GetDefaultContext () { MergeContext context = new MergeContext (); return context; }
public void AddExternalMethods (MergeContext context) { foreach (List<MethodDefinition> methods in externalMethods.Values) { foreach (MethodDefinition method in methods) { context.MainType.Methods.Add (method); } } foreach (ModuleReference library in referredLibraries.Values) { context.OutputAssembly.MainModule.ModuleReferences.Add(library); } }
public ReflectionMerger (MergeContext context, AssemblyDefinition target, AssemblyDefinition source) : base (context, target, source) { }
public StructureMerger (MergeContext context, AssemblyDefinition target, AssemblyDefinition source) { this.context = context; this.target = target; this.source = source; }
public FixReflectionAfterMerge (MergeContext context, AssemblyDefinition target, AssemblyDefinition source) : base (context, target, source) { module = target.MainModule; }
static void Process (MergeContext context) { AssemblyDefinition primary = null; try { primary = AssemblyFactory.GetAssembly (context.Assemblies [0]); for (int i = 1; i < context.Assemblies.Count; i++) { AssemblyDefinition asm = AssemblyFactory.GetAssembly (context.Assemblies [i]); asm.Accept (new StructureMerger (context, primary, asm)); } } catch (FileNotFoundException e) { Error (e.Message); } FixReflectionAfterMerge fix = new FixReflectionAfterMerge (context, primary, primary); fix.Process (); AssemblyFactory.SaveAssembly (primary, context.OutputPath); ConfigMerger.Process (context.Assemblies, context.OutputPath); }
public FixReflectionAfterMerge(MergeContext context, AssemblyDefinition target, AssemblyDefinition source) : base(context, target, source) { module = target.MainModule; }
public ReflectionMerger(MergeContext context, AssemblyDefinition target, AssemblyDefinition source) : base(context, target, source) { }
public StructureMerger(MergeContext context, AssemblyDefinition target, AssemblyDefinition source) { this.context = context; this.target = target; this.source = source; }
static void Run(Queue q) { MergeContext context = GetDefaultContext(); while (q.Count > 0) { string token = (string)q.Dequeue(); if (token.Length < 2) { Usage(); } if (token [0] == '-' && token [1] == '-') { if (token.Length < 3) { Usage(); } switch (token [2]) { case 'v': Version(); break; case 'a': About(); break; default: Usage(); break; } } if (token [0] == '-' || token [0] == '/') { if (token [1] == 'o' || token.Substring(1) == "out") { context.OutputPath = (string)q.Dequeue(); } else { if (token [0] == '/') { if (File.Exists(token) || token.Substring(1).IndexOf("/") > -1) { context.Assemblies.Add(token); } } else { Usage(); } } } else { context.Assemblies.Add(token); while (q.Count > 0) { context.Assemblies.Add((string)q.Dequeue()); } } } if (context.Assemblies.Count < 2) { Error("At least two assemblies needed"); } if (context.OutputPath == "") { Error("Please set output filename"); } Process(context); }