Exemplo n.º 1
0
        private static void PatchGame(ILogger log)
        {
            log.Information("Creating {0}", Paths.PatchedAssemblyFolder);
            Directory.CreateDirectory(Paths.PatchedAssemblyFolder);

            log.Information("Loading original assembly {0}", Paths.OriginalAssembly);
            var patcher = new AssemblyPatcher(Paths.OriginalAssembly, log);
            patcher.EmbedHistory = false;
            patcher.UseBackup = false;

            log.Information("Patching");
            patcher.PatchAssembly(typeof(W2PWMod.ModType).Assembly.Location);

            log.Information("Saving patched file");
            patcher.WriteTo(Paths.PatchedAssembly);
        }
Exemplo n.º 2
0
		private static void PatchGame(string version, string copyToFolder, bool runPeVerify) {
			if (!Directory.Exists(copyToFolder)) {
				Log.Information("Creating copy to folder.");
				Directory.CreateDirectory(copyToFolder);
			}
			//+ Path-related
			var copyToPath = Path.Combine(copyToFolder, @"Assembly-CSharp.dll");
			var originalDllPath = Path.Combine(RelativePaths.DllSourcesPath, version, "Assembly-CSharp.dll");

			//+ Creating patcher
			var patcher = new AssemblyPatcher(originalDllPath, ImplicitImportSetting.OnlyCompilerGenerated, Log);

			//+ Patching assemblies
			patcher.PatchAssembly(typeof (IEModType).Assembly.Location);

			//add more lines to patch more things

			//+ End

			patcher.WriteTo(copyToPath);
			if (runPeVerify) {
				Console.WriteLine(
					"Going to run PEVerify to check the IL for errors. Press ESC to cancel, or any other key to continue.");
				if (Console.ReadKey().Key != ConsoleKey.Escape) {
					RunPEVerify(copyToPath);
					//RunILSpy(copyToPath);
					//RunILSpy(typeof (IEModType).Assembly.Location);
				}
			}

		}
Exemplo n.º 3
0
		private static void PatchGame(string version, string copyToFolder, bool runPeVerify) {
			if (!Directory.Exists(copyToFolder)) {
				Log.Information("Creating copy to folder.");
				Directory.CreateDirectory(copyToFolder);
			}
			//+ Path-related
			var copyToPath = Path.Combine(copyToFolder, @"Assembly-CSharp.dll");
			var originalDllPath = Path.Combine(RelativePaths.DllSourcesPath, version, "Assembly-CSharp.dll");

			//+ Creating patcher
			var patcher = new AssemblyPatcher(originalDllPath, ImplicitImportSetting.OnlyCompilerGenerated, Log) {
				EmbedHistory = false
			};

			//+ Patching assemblies
			patcher.PatchAssembly(typeof (IEModType).Assembly.Location);
			//add more lines to patch more things

			//+ End

			if (runPeVerify) {
				Console.WriteLine(
					"Running PEVerify on the assembly to check the IL for errors. Please wait.");
				Log.Information(patcher.RunPeVerify(ignoreErrors: _ignoreErrors));
			}
			patcher.WriteTo(copyToPath);
			LogFile.Flush();
			Console.WriteLine("Press any key to close.");
			Console.Read();
		}
Exemplo n.º 4
0
		private static void PatchGame() {
			//+ Path-related
			var copyToPath = Paths.YourNormalManagedFolder + @"\Assembly-CSharp.dll";
			var originalDllPath = Path.Combine(Paths.YourDllSourcesPath, "Assembly-CSharp.dll");

			//+ Creating patcher
			var patcher = new AssemblyPatcher(originalDllPath, ImplicitImportSetting.OnlyCompilerGenerated, Serilog.Log.Logger);

			//+ Patching assemblies
			patcher.PatchAssembly(typeof (IEModType).Assembly.Location);
			
			//add more lines to patch more things
			
			//+ End
		 

			patcher.WriteTo(copyToPath);
			Console.WriteLine("Going to run PEVerify to check the IL for errors. Press ESC to cancel, or any other key to continue.");
			if (Console.ReadKey().Key != ConsoleKey.Escape) {

				
				RunPEVerify(copyToPath);
				//RunILSpy(copyToPath);
			}
		}