コード例 #1
0
		public BaseMergeReflectionVisitor (MergeContext context, AssemblyDefinition target, AssemblyDefinition source)
		{
			this.context = context;
			this.target = target;
			this.source = source;
			module = target.MainModule;
		}
コード例 #2
0
 public BaseMergeReflectionVisitor(MergeContext context, AssemblyDefinition target, AssemblyDefinition source)
 {
     this.context = context;
     this.target  = target;
     this.source  = source;
     module       = target.MainModule;
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
ファイル: Driver.cs プロジェクト: jma2400/cecil-old
        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);
        }
コード例 #5
0
ファイル: Driver.cs プロジェクト: jma2400/cecil-old
        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();
        }
コード例 #6
0
ファイル: Driver.cs プロジェクト: jma2400/cecil-old
        static MergeContext GetDefaultContext()
        {
            MergeContext context = new MergeContext();

            return(context);
        }
コード例 #7
0
		static MergeContext GetDefaultContext ()
		{
			MergeContext context = new MergeContext ();
			return context;
		}
コード例 #8
0
		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);
			}
		}
コード例 #9
0
		public ReflectionMerger (MergeContext context, AssemblyDefinition target, AssemblyDefinition source)
			: base (context, target, source)
		{
		}
コード例 #10
0
		public StructureMerger (MergeContext context, AssemblyDefinition target, AssemblyDefinition source)
		{
			this.context = context;
			this.target = target;
			this.source = source;
		}
コード例 #11
0
		public FixReflectionAfterMerge (MergeContext context, AssemblyDefinition target, AssemblyDefinition source)
			: base (context, target, source)
		{
			module = target.MainModule;
		}
コード例 #12
0
		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);
		}
コード例 #13
0
 public FixReflectionAfterMerge(MergeContext context, AssemblyDefinition target, AssemblyDefinition source)
     : base(context, target, source)
 {
     module = target.MainModule;
 }
コード例 #14
0
ファイル: ReflectionMerger.cs プロジェクト: jma2400/cecil-old
 public ReflectionMerger(MergeContext context, AssemblyDefinition target, AssemblyDefinition source)
     : base(context, target, source)
 {
 }
コード例 #15
0
ファイル: StructureMerger.cs プロジェクト: jma2400/cecil-old
 public StructureMerger(MergeContext context, AssemblyDefinition target, AssemblyDefinition source)
 {
     this.context = context;
     this.target  = target;
     this.source  = source;
 }
コード例 #16
0
ファイル: Driver.cs プロジェクト: jma2400/cecil-old
        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);
        }