Inheritance: Mono.Cecil.DefaultAssemblyResolver
Esempio n. 1
0
        /// <summary>
        /// Creates a new instance of the patcher with the specified source assembly path and
        /// a glob containing all the modification assemblies.
        /// </summary>
        /// <param name="sourceAssemblyPath">Path to the source assembly that modifications need to applied to</param>
        /// <param name="modificationAssemblyGlob">A list of globs that yields a list of modifications</param>
        /// <param name="outputAssemblyPath">Path for the modified assembly to be saved</param>
        public Patcher(string sourceAssemblyPath, IEnumerable <string> modificationAssemblyGlob, string outputAssemblyPath)
        {
            this.SourceAssemblyPath       = sourceAssemblyPath;
            this.modificationAssemblyGlob = modificationAssemblyGlob;
            this.OutputAssemblyPath       = outputAssemblyPath;

            resolver             = new NugetAssemblyResolver();
            resolver.OnResolved += Resolver_OnResolved;
            readerParams         = new ReaderParameters(ReadingMode.Immediate)
            {
                AssemblyResolver = resolver
            };

            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
            AppDomain.CurrentDomain.AssemblyLoad    += CurrentDomain_AssemblyLoad;
            resolver.ResolveFailure += Resolver_ResolveFailure;
        }
Esempio n. 2
0
		/// <summary>
		/// Creates a new instance of the patcher with the specified source assembly path and
		/// a glob containing all the modification assemblies.
		/// </summary>
		/// <param name="sourceAssemblyPath">Path to the source assembly that modifications need to applied to</param>
		/// <param name="modificationAssemblyGlob">A list of globs that yields a list of modifications</param>
		/// <param name="outputAssemblyPath">Path for the modified assembly to be saved</param>
		public Patcher(string sourceAssemblyPath, IEnumerable<string> modificationAssemblyGlob, string outputAssemblyPath)
		{
			this.SourceAssemblyPath = sourceAssemblyPath;
			this.modificationAssemblyGlob = modificationAssemblyGlob;
			this.OutputAssemblyPath = outputAssemblyPath;

			resolver = new NugetAssemblyResolver();
			resolver.OnResolved += Resolver_OnResolved;
			readerParams = new ReaderParameters(ReadingMode.Immediate)
			{
				AssemblyResolver = resolver
			};

			AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
			AppDomain.CurrentDomain.AssemblyLoad += CurrentDomain_AssemblyLoad;
			resolver.ResolveFailure += Resolver_ResolveFailure;
		}