Exemplo n.º 1
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();
		}