Browse Source

Bring branch up to date with master

Bepis 5 years ago
parent
commit
20f1754af2

+ 5 - 3
BepInEx.Preloader/BepInEx.Preloader.csproj

@@ -31,8 +31,8 @@
     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Mono.Cecil">
-      <HintPath>..\lib\Mono.Cecil.dll</HintPath>
+    <Reference Include="Mono.Cecil, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
+      <HintPath>..\packages\Mono.Cecil.0.10.3\lib\net35\Mono.Cecil.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
@@ -61,6 +61,8 @@
       <Name>Harmony</Name>
     </ProjectReference>
   </ItemGroup>
-  <ItemGroup />
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 3 - 1
BepInEx.Preloader/Patching/AssemblyPatcher.cs

@@ -45,7 +45,7 @@ namespace BepInEx.Preloader.Patching
 
 			var sortedPatchers = new SortedDictionary<string, PatcherPlugin>();
 
-			foreach (string assemblyPath in Directory.GetFiles(directory, "*.dll"))
+			foreach (string assemblyPath in Directory.GetFiles(directory, "*.dll", SearchOption.AllDirectories))
 				try
 				{
 					var assembly = Assembly.LoadFrom(assemblyPath);
@@ -124,6 +124,8 @@ namespace BepInEx.Preloader.Patching
 				foreach (string targetDll in assemblyPatcher.TargetDLLs)
 					if (assemblies.TryGetValue(targetDll, out var assembly))
 					{
+						Logger.LogInfo($"Patching [{assembly.Name.Name}] with [{assemblyPatcher.Name}]");
+
 						assemblyPatcher.Patcher?.Invoke(ref assembly);
 						assemblies[targetDll] = assembly;
 						patchedAssemblies.Add(targetDll);

+ 7 - 3
BepInEx.Preloader/Preloader.cs

@@ -69,7 +69,10 @@ namespace BepInEx.Preloader
 
 
 				AssemblyPatcher.AddPatcher(new PatcherPlugin
-					{ TargetDLLs = new[] { ConfigEntrypointAssembly.Value }, Patcher = PatchEntrypoint });
+					{ TargetDLLs = new[] { ConfigEntrypointAssembly.Value },
+						Patcher = PatchEntrypoint,
+						Name = "BepInEx.Chainloader"
+					});
 
 				AssemblyPatcher.AddPatchersFromDirectory(Paths.PatcherPluginPath, GetPatcherMethods);
 
@@ -163,7 +166,7 @@ namespace BepInEx.Preloader
 
 					var assemblyPatcher = new PatcherPlugin();
 
-					assemblyPatcher.Name = $"{assembly.GetName().Name}{type.FullName}";
+					assemblyPatcher.Name = $"{assembly.GetName().Name}/{type.FullName}";
 					assemblyPatcher.Patcher = (ref AssemblyDefinition ass) =>
 					{
 						//we do the array fuckery here to get the ref result out
@@ -204,7 +207,8 @@ namespace BepInEx.Preloader
 					Logger.LogWarning(ex);
 				}
 
-			Logger.LogInfo($"Loaded {patcherMethods.Count} patcher methods from {assembly.GetName().Name}");
+			Logger.Log(patcherMethods.Count > 0 ? LogLevel.Info : LogLevel.Debug,
+				$"Loaded {patcherMethods.Count} patcher methods from {assembly.GetName().Name}");
 
 			return patcherMethods;
 		}

+ 4 - 0
BepInEx.Preloader/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Mono.Cecil" version="0.10.3" targetFramework="net35" />
+</packages>

+ 5 - 2
BepInEx/BepInEx.csproj

@@ -36,8 +36,8 @@
     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Mono.Cecil">
-      <HintPath>..\lib\Mono.Cecil.dll</HintPath>
+    <Reference Include="Mono.Cecil, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
+      <HintPath>..\packages\Mono.Cecil.0.10.3\lib\net35\Mono.Cecil.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="UnityEngine">
@@ -84,5 +84,8 @@
       <Name>BepInEx.Harmony</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 2 - 1
BepInEx/Bootstrap/Chainloader.cs

@@ -57,7 +57,8 @@ namespace BepInEx.Bootstrap
 			}
 
 			//Fix for standard output getting overwritten by UnityLogger
-			Console.SetOut(ConsoleWindow.StandardOut);
+			if (ConsoleWindow.StandardOut != null)
+				Console.SetOut(ConsoleWindow.StandardOut);
 
 
 			Logger.Listeners.Add(new UnityLogListener());

+ 3 - 3
BepInEx/Logging/TraceLogSource.cs

@@ -38,7 +38,7 @@ namespace BepInEx.Logging
 		/// <param name="message">The message to write.</param>
 		public override void Write(string message)
 		{
-			LogSource.Log(LogLevel.None, message);
+			LogSource.LogInfo(message);
 		}
 
 		/// <summary>
@@ -47,7 +47,7 @@ namespace BepInEx.Logging
 		/// <param name="message">The message to write.</param>
 		public override void WriteLine(string message)
 		{
-			LogSource.Log(LogLevel.None, $"{message}\r\n");
+			LogSource.LogInfo(message);
 		}
 
 		public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args)
@@ -77,7 +77,7 @@ namespace BepInEx.Logging
 					break;
 			}
 			
-			LogSource.Log(level, $"{message}");
+			LogSource.Log(level, $"{message}".Trim());
 		}
 	}
 }

+ 4 - 0
BepInEx/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Mono.Cecil" version="0.10.3" targetFramework="net35" />
+</packages>

BIN
lib/Mono.Cecil.dll


+ 6 - 3
scripts/jenkins_master.groovy

@@ -33,8 +33,8 @@ Changes since ${latestTag}:
                 }
 
                 dir('Doorstop') {
-                    sh '''  tag="$(curl -s https://api.github.com/repos/NeighTools/UnityDoorstop/releases/latest | grep "tag_name" | cut -d : -f 2 | tr -d "\\", ")";
-                    version="$(echo $tag | cut -c 2-)";
+                    sh '''  tag="v2.7.1.0";
+                    version="2.7.1.0";
                     wget https://github.com/NeighTools/UnityDoorstop/releases/download/$tag/Doorstop_x64_$version.zip;
                     wget https://github.com/NeighTools/UnityDoorstop/releases/download/$tag/Doorstop_x86_$version.zip;
                     unzip -o Doorstop_x86_$version.zip winhttp.dll -d x86;
@@ -45,7 +45,10 @@ Changes since ${latestTag}:
         stage('Prepare BepInEx') {
             steps {
                 dir('BepInEx') {
-                    sh 'nuget restore'
+                    sh '''
+						nuget restore
+						mkdir -p "lib"
+					'''
                 }
 
                 dir('BepInEx/BepInEx') {