using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("BatchBuildRefresh")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BatchBuildRefresh")]
[assembly: AssemblyTitle("BatchBuildRefresh")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BatchBuildRefresh
{
public static class Batcher
{
private class State
{
public readonly HashSet<GPUInstancingManager> gpu = new HashSet<GPUInstancingManager>();
public readonly HashSet<PlanetData> meshes = new HashSet<PlanetData>();
public readonly Dictionary<CargoTraffic, HashSet<int>> paths = new Dictionary<CargoTraffic, HashSet<int>>();
public readonly HashSet<FactoryModel> power = new HashSet<FactoryModel>();
public readonly HashSet<CargoTraffic> beltBuf = new HashSet<CargoTraffic>();
public readonly HashSet<CargoTraffic> pathBuf = new HashSet<CargoTraffic>();
public bool Any
{
get
{
if (gpu.Count <= 0 && meshes.Count <= 0 && paths.Count <= 0 && power.Count <= 0 && beltBuf.Count <= 0)
{
return pathBuf.Count > 0;
}
return true;
}
}
}
public static bool Enabled = true;
public static bool GizmoThrottle = true;
public static float GizmoInterval = 0.5f;
public static int GizmoMinPrebuilds = 2000;
public static long Batches;
public static long Builds;
public static long DeferredGpu;
public static long DeferredMesh;
public static long DeferredPathUV;
public static long DeferredPower;
public static long FlushTicks;
public static long GizmoSkipped;
public static long GizmoRefreshed;
public static long SecPath;
public static long SecPower;
public static long SecMesh;
public static long SecGpu;
public static long DeferredBuf;
[ThreadStatic]
private static int depth;
[ThreadStatic]
private static State st;
[ThreadStatic]
private static bool flushing;
private static float lastGizmoRefresh = -1000f;
public static int KindsPerHandout = 6;
public static long HandoutCalls;
public static long HandoutExtraRuns;
[ThreadStatic]
private static bool inHandout;
private static Action<ConstructionModuleComponent, PlanetFactory, Player> placeItems;
private static Harmony live;
private static bool Batching => depth > 0;
[HarmonyPrefix]
[HarmonyPatch(typeof(ConstructionSystem), "ExecuteBuildTasks")]
public static void ExecuteBuildTasks_Prefix(out bool __state)
{
__state = Enabled;
if (__state)
{
if (st == null)
{
st = new State();
}
depth++;
}
}
[HarmonyFinalizer]
[HarmonyPatch(typeof(ConstructionSystem), "ExecuteBuildTasks")]
public static void ExecuteBuildTasks_Finalizer(bool __state)
{
if (__state)
{
depth--;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(GameMain), "Update")]
public static void GameMainUpdate_Prefix()
{
if (depth == 0)
{
Flush();
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlanetFactory), "BuildFinally")]
public static void BuildFinally_Postfix()
{
if (Batching)
{
Builds++;
}
}
private static void Flush()
{
if (st == null || !st.Any)
{
return;
}
Batches++;
long timestamp = Stopwatch.GetTimestamp();
flushing = true;
try
{
foreach (KeyValuePair<CargoTraffic, HashSet<int>> path in st.paths)
{
foreach (int item in path.Value)
{
path.Key.RefreshPathUV(item);
}
}
}
finally
{
flushing = false;
}
st.paths.Clear();
foreach (CargoTraffic item2 in st.beltBuf)
{
if (item2 != null)
{
item2.RefreshBeltBatchesBuffers();
}
}
foreach (CargoTraffic item3 in st.pathBuf)
{
if (item3 != null)
{
item3.RefreshPathBatchesBuffers();
}
}
st.beltBuf.Clear();
st.pathBuf.Clear();
long timestamp2 = Stopwatch.GetTimestamp();
SecPath += timestamp2 - timestamp;
foreach (FactoryModel item4 in st.power)
{
if ((Object)(object)item4 != (Object)null)
{
item4.RefreshPowerConsumers();
}
}
st.power.Clear();
long timestamp3 = Stopwatch.GetTimestamp();
SecPower += timestamp3 - timestamp2;
foreach (PlanetData mesh in st.meshes)
{
if (mesh != null && mesh.UpdateDirtyMeshes())
{
if (GameMain.isRunning && mesh.factory != null)
{
mesh.factory.RenderLocalPlanetHeightmap();
}
PlanetAlgorithm.CalcLandPercent(mesh);
}
}
st.meshes.Clear();
long timestamp4 = Stopwatch.GetTimestamp();
SecMesh += timestamp4 - timestamp3;
foreach (GPUInstancingManager item5 in st.gpu)
{
if (item5 != null)
{
item5.SyncAllGPUBuffer();
}
}
st.gpu.Clear();
long timestamp5 = Stopwatch.GetTimestamp();
SecGpu += timestamp5 - timestamp4;
FlushTicks += timestamp5 - timestamp;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(GPUInstancingManager), "SyncAllGPUBuffer")]
public static bool SyncAllGPUBuffer_Prefix(GPUInstancingManager __instance)
{
if (!Batching)
{
return true;
}
st.gpu.Add(__instance);
DeferredGpu++;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(PlanetData), "UpdateDirtyMeshes")]
public static bool UpdateDirtyMeshes_Prefix(PlanetData __instance, ref bool __result)
{
if (!Batching)
{
return true;
}
st.meshes.Add(__instance);
DeferredMesh++;
__result = false;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(CargoTraffic), "RefreshPathUV")]
public static bool RefreshPathUV_Prefix(CargoTraffic __instance, int pathId)
{
if (!Batching)
{
return true;
}
if (!__instance.isLocal)
{
return false;
}
if (!st.paths.TryGetValue(__instance, out var value))
{
value = (st.paths[__instance] = new HashSet<int>());
}
value.Add(pathId);
DeferredPathUV++;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(CargoTraffic), "RefreshBeltBatchesBuffers")]
public static bool RefreshBeltBatchesBuffers_Prefix(CargoTraffic __instance)
{
if (!Batching && !flushing)
{
return true;
}
st.beltBuf.Add(__instance);
DeferredBuf++;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(CargoTraffic), "RefreshPathBatchesBuffers")]
public static bool RefreshPathBatchesBuffers_Prefix(CargoTraffic __instance)
{
if (!Batching && !flushing)
{
return true;
}
st.pathBuf.Add(__instance);
DeferredBuf++;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(FactoryModel), "RefreshPowerConsumers")]
public static bool RefreshPowerConsumers_Prefix(FactoryModel __instance)
{
if (!Batching)
{
return true;
}
st.power.Add(__instance);
DeferredPower++;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ConnGizmoRenderer), "Update")]
public static void ConnGizmoUpdate_Prefix(ConnGizmoRenderer __instance, out int __state)
{
__state = 0;
FactoryModel factoryModel = __instance.factoryModel;
PlanetFactory factory = __instance.factory;
if (!((Object)(object)factoryModel == (Object)null) && factory != null && factoryModel.needRefreshConnGizmo012)
{
float realtimeSinceStartup = Time.realtimeSinceStartup;
if (GizmoThrottle && factory.prebuildCount >= GizmoMinPrebuilds && realtimeSinceStartup - lastGizmoRefresh < GizmoInterval && (__instance.cursorGizmoGraph == null || __instance.cursorGizmoGraph.pointCount == 0))
{
factoryModel.needRefreshConnGizmo012 = false;
__state = 1;
}
else
{
__state = 2;
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(ConnGizmoRenderer), "Update")]
public static void ConnGizmoUpdate_Postfix(ConnGizmoRenderer __instance, int __state)
{
FactoryModel factoryModel = __instance.factoryModel;
switch (__state)
{
case 1:
if (__instance.cursorGizmoGraph != null && __instance.cursorGizmoGraph.pointCount > 0)
{
lastGizmoRefresh = Time.realtimeSinceStartup;
GizmoRefreshed++;
}
else if ((Object)(object)factoryModel != (Object)null)
{
factoryModel.needRefreshConnGizmo012 = true;
GizmoSkipped++;
}
break;
case 2:
lastGizmoRefresh = Time.realtimeSinceStartup;
GizmoRefreshed++;
break;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(ConstructionModuleComponent), "PlaceItems")]
public static void PlaceItems_Postfix(ConstructionModuleComponent __instance, PlanetFactory factory, Player player)
{
if (inHandout || KindsPerHandout <= 1 || __instance.entityId != 0)
{
return;
}
if (placeItems == null)
{
placeItems = AccessTools.MethodDelegate<Action<ConstructionModuleComponent, PlanetFactory, Player>>(AccessTools.Method(typeof(ConstructionModuleComponent), "PlaceItems", (Type[])null, (Type[])null), (object)null, true);
}
HandoutCalls++;
inHandout = true;
try
{
for (int i = 1; i < KindsPerHandout; i++)
{
placeItems(__instance, factory, player);
HandoutExtraRuns++;
}
}
finally
{
inHandout = false;
}
}
public static string LiveApply()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
if (live != null)
{
return "已经打过补丁";
}
live = new Harmony("com.github.jiesiluo.batchbuildrefresh.live");
live.PatchAll(typeof(Batcher));
return "补丁已打上";
}
public static string LiveRemove()
{
if (live == null)
{
return "没有补丁";
}
live.UnpatchSelf();
live = null;
return "补丁已撤掉";
}
public static void ResetCounters()
{
Batches = (Builds = (DeferredGpu = (DeferredMesh = (DeferredPathUV = (DeferredPower = (FlushTicks = 0L))))));
GizmoSkipped = (GizmoRefreshed = 0L);
SecPath = (SecPower = (SecMesh = (SecGpu = (DeferredBuf = 0L))));
HandoutCalls = (HandoutExtraRuns = 0L);
}
public static string Summary()
{
double num = (double)FlushTicks * 1000.0 / (double)Stopwatch.Frequency;
double num2 = 1000.0 / (double)Stopwatch.Frequency;
double num3 = Math.Max(1L, Batches);
return $"合并 {Batches} 批、{Builds} 个建筑;省下的调用:显存同步 {DeferredGpu}、地形网格 {DeferredMesh}、传送带贴图 {DeferredPathUV}、用电显示 {DeferredPower}、传送带显示缓冲上传 {DeferredBuf};" + $"每批统一刷新共 {num:0.0} ms(每批 {((Batches > 0) ? (num / (double)Batches) : 0.0):0.00} ms:传送带贴图 {(double)SecPath * num2 / num3:0.00}、用电显示 {(double)SecPower * num2 / num3:0.00}、地形 {(double)SecMesh * num2 / num3:0.00}、显存 {(double)SecGpu * num2 / num3:0.00});连线显示 刷新 {GizmoRefreshed} 次、跳过 {GizmoSkipped} 帧;发料 {HandoutCalls} 次(每次最多 {KindsPerHandout} 种,多跑 {HandoutExtraRuns} 轮)";
}
}
public static class CapacityTrim
{
public static bool Enabled = true;
public static long Paths;
public static long Trimmed;
public static long CellsSaved;
public static long CellsKept;
[ThreadStatic]
private static bool inImport;
[ThreadStatic]
private static CargoPath pendingPath;
[ThreadStatic]
private static int pendingCap;
private static readonly FieldRef<CargoPath, int> BufLen = AccessTools.FieldRefAccess<CargoPath, int>("bufferLength");
private static readonly FieldRef<CargoPath, int> Cap = AccessTools.FieldRefAccess<CargoPath, int>("capacity");
private static readonly FieldRef<CargoPath, int> ChunkCount = AccessTools.FieldRefAccess<CargoPath, int>("chunkCount");
private static readonly FieldRef<CargoPath, int> UpdateLen = AccessTools.FieldRefAccess<CargoPath, int>("updateLen");
public static int TrimmedCapacity(int need, int saved)
{
int num;
for (num = 200; num < need; num *= 2)
{
}
if (num > saved && saved >= need)
{
num = saved;
}
return num;
}
[HarmonyPrefix]
[HarmonyPriority(800)]
[HarmonyPatch(typeof(CargoPath), "Import")]
private static void Import_Prefix()
{
if (Enabled)
{
inImport = true;
pendingPath = null;
}
}
[HarmonyFinalizer]
[HarmonyPatch(typeof(CargoPath), "Import")]
private static Exception Import_Finalizer(Exception __exception)
{
if (pendingPath != null)
{
CargoPath val = pendingPath;
pendingPath = null;
inImport = false;
if (val.buffer == null)
{
val.SetCapacity(pendingCap);
}
}
inImport = false;
return __exception;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(CargoPath), "SetCapacity")]
private static bool SetCapacity_Prefix(CargoPath __instance, int newCap)
{
if (!inImport || pendingPath != null || __instance.buffer != null)
{
return true;
}
pendingPath = __instance;
pendingCap = newCap;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(CargoPath), "SetChunkCapacity")]
private static void SetChunkCapacity_Prefix(CargoPath __instance)
{
if (pendingPath != null && pendingPath == __instance)
{
pendingPath = null;
inImport = false;
int num = TrimmedCapacity(BufLen.Invoke(__instance), pendingCap);
__instance.SetCapacity(num);
Interlocked.Increment(ref Paths);
if (num < pendingCap)
{
Interlocked.Increment(ref Trimmed);
Interlocked.Add(ref CellsSaved, pendingCap - num);
}
Interlocked.Add(ref CellsKept, num);
}
}
public static string Summary()
{
return string.Format("收紧传送带容量 {0}:读档时 {1} 条路径,收紧 {2} 条,省 {3} MB(留下 {4} MB)", Enabled ? "开" : "关", Paths, Trimmed, CellsSaved * 29 / 1048576, CellsKept * 29 / 1048576);
}
public static string LiveTest(int maxPaths, long maxBytes)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Expected O, but got Unknown
//IL_045c: Unknown result type (might be due to invalid IL or missing references)
//IL_046a: Unknown result type (might be due to invalid IL or missing references)
//IL_047f: Unknown result type (might be due to invalid IL or missing references)
//IL_048d: Unknown result type (might be due to invalid IL or missing references)
Harmony val = new Harmony("com.github.jiesiluo.batchbuildrefresh.trimtest");
bool enabled = Enabled;
Enabled = true;
long num = 0L;
long num2 = 0L;
long num3 = 0L;
long num4 = 0L;
long num5 = 0L;
long num6 = 0L;
long num7 = 0L;
List<string> list = new List<string>();
try
{
val.PatchAll(typeof(CapacityTrim));
GameData data = GameMain.data;
List<CargoPath> list2 = new List<CargoPath>();
for (int i = 0; i < data.factoryCount; i++)
{
CargoTraffic val2 = data.factories[i]?.cargoTraffic;
if (val2 == null)
{
continue;
}
for (int j = 1; j < val2.pathCursor; j++)
{
CargoPath val3 = val2.pathPool[j];
if (val3 != null && val3.id == j)
{
list2.Add(val3);
}
}
}
list2.Sort((CargoPath a, CargoPath b) => BufLen.Invoke(b).CompareTo(BufLen.Invoke(a)));
List<CargoPath> list3 = new List<CargoPath>();
for (int num8 = 0; num8 < list2.Count && num8 < 10; num8++)
{
list3.Add(list2[num8]);
}
int num9 = Math.Max(1, list2.Count / Math.Max(1, maxPaths - 10));
for (int num10 = 10; num10 < list2.Count; num10 += num9)
{
if (list3.Count >= maxPaths)
{
break;
}
list3.Add(list2[num10]);
}
foreach (CargoPath item in list3)
{
if (num3 > maxBytes)
{
break;
}
MemoryStream memoryStream = new MemoryStream();
BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
item.Export(binaryWriter);
binaryWriter.Flush();
num3 += memoryStream.Length;
memoryStream.Position = 0L;
CargoPath val4 = new CargoPath(item.cargoContainer);
val4.Import(new BinaryReader(memoryStream));
num++;
int num11 = BufLen.Invoke(item);
num6 += num11;
num4 += Cap.Invoke(item);
num5 += Cap.Invoke(val4);
if (Cap.Invoke(val4) < Cap.Invoke(item))
{
num7++;
}
string text = null;
if (memoryStream.Position != memoryStream.Length)
{
text = $"读完位置 {memoryStream.Position} / {memoryStream.Length}";
}
else if (BufLen.Invoke(val4) != num11)
{
text = $"长度 {BufLen.Invoke(val4)} != {num11}";
}
else if (Cap.Invoke(val4) < num11 || val4.buffer.Length != Cap.Invoke(val4) || val4.pointPos.Length != Cap.Invoke(val4) || val4.pointRot.Length != Cap.Invoke(val4))
{
text = $"容量 {Cap.Invoke(val4)} / 数组 {val4.buffer.Length},{val4.pointPos.Length},{val4.pointRot.Length} 长度 {num11}";
}
else if (Cap.Invoke(val4) != TrimmedCapacity(num11, Cap.Invoke(item)))
{
text = $"容量 {Cap.Invoke(val4)},应为 {TrimmedCapacity(num11, Cap.Invoke(item))}";
}
else if (val4.id != item.id || val4.closed != item.closed || ChunkCount.Invoke(val4) != ChunkCount.Invoke(item) || UpdateLen.Invoke(val4) != UpdateLen.Invoke(item))
{
text = "id / closed / chunkCount / updateLen 不同";
}
else
{
for (int num12 = 0; num12 < num11; num12++)
{
if (text != null)
{
break;
}
if (val4.buffer[num12] != item.buffer[num12] || val4.pointPos[num12] != item.pointPos[num12] || val4.pointRot[num12] != item.pointRot[num12])
{
text = $"第 {num12} 格不同";
}
}
for (int num13 = 0; num13 < ChunkCount.Invoke(item) * 3; num13++)
{
if (text != null)
{
break;
}
if (val4.chunks[num13] != item.chunks[num13])
{
text = $"chunks[{num13}] 不同";
}
}
if (text == null && (val4.belts.Count != item.belts.Count || val4.inputPaths.Count != item.inputPaths.Count))
{
text = "belts / inputPaths 数量不同";
}
for (int num14 = 0; num14 < item.belts.Count; num14++)
{
if (text != null)
{
break;
}
if (val4.belts[num14] != item.belts[num14])
{
text = $"belts[{num14}] 不同";
}
}
for (int num15 = 0; num15 < item.inputPaths.Count; num15++)
{
if (text != null)
{
break;
}
if (val4.inputPaths[num15] != item.inputPaths[num15])
{
text = $"inputPaths[{num15}] 不同";
}
}
}
if (text != null)
{
num2++;
if (list.Count < 8)
{
list.Add($"路径 {item.id}(长 {num11} 容量 {Cap.Invoke(item)}):{text}");
}
}
}
}
catch (Exception ex)
{
list.Add("异常:" + ex);
}
finally
{
val.UnpatchSelf();
Enabled = enabled;
}
return $"来回测试 {num} 条路径({num3 / 1048576} MB),不一致 {num2} 条;总长 {num6},容量 {num4} → {num5}(收紧 {num7} 条)" + ((list.Count > 0) ? (";" + string.Join(";", list)) : "");
}
}
[BepInPlugin("com.github.jiesiluo.batchbuildrefresh", "Batch Build Refresh", "1.3.0")]
public class Plugin : BaseUnityPlugin
{
public const string Guid = "com.github.jiesiluo.batchbuildrefresh";
public const string Name = "Batch Build Refresh";
public const string Version = "1.3.0";
private void Awake()
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Expected O, but got Unknown
ConfigEntry<bool> enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Run the per-building render refreshes once per frame while drones build. 无人机建造时,每个建筑都要做的画面刷新改成每帧只做一次。");
ConfigEntry<bool> gizmo = ((BaseUnityPlugin)this).Config.Bind<bool>("ConnGizmo", "Throttle", true, "Refresh the unbuilt-building connection display at most every Interval seconds on busy planets. 待建建筑多时,待建连线显示最多每 Interval 秒刷新一次。");
ConfigEntry<float> interval = ((BaseUnityPlugin)this).Config.Bind<float>("ConnGizmo", "Interval", 0.5f, new ConfigDescription("Seconds between two refreshes of the connection display. 连线显示两次刷新之间的秒数。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 5f), Array.Empty<object>()));
ConfigEntry<int> min = ((BaseUnityPlugin)this).Config.Bind<int>("ConnGizmo", "MinUnbuilt", 2000, "Throttle only on planets with at least this many unbuilt buildings. 星球上待建建筑达到这个数才限频。");
ConfigEntry<int> kinds = ((BaseUnityPlugin)this).Config.Bind<int>("Handout", "KindsPerHandout", 6, new ConfigDescription("How many building kinds the mecha hands their items to per hand-out (the game: 1, every 30 logic ticks). 机甲每次发料最多发几种建筑(原版 1 种,每 30 个逻辑帧发一次)。", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>()));
kinds.SettingChanged += delegate
{
Apply();
};
Apply();
enabled.SettingChanged += delegate
{
Apply();
};
gizmo.SettingChanged += delegate
{
Apply();
};
interval.SettingChanged += delegate
{
Apply();
};
min.SettingChanged += delegate
{
Apply();
};
ConfigEntry<bool> trim = ((BaseUnityPlugin)this).Config.Bind<bool>("Memory", "TrimBeltCapacity", true, "When a save loads, give every belt path arrays just big enough for its length (vanilla keeps the largest size a path ever had, ~17 GB in a big save). Takes effect at the next load. 读档时把每条传送带路径的数组收紧到够用的大小(原版一直保留路径曾经到过的最大容量,大存档里能多占十几 GB)。下次读档生效。");
CapacityTrim.Enabled = trim.Value;
trim.SettingChanged += delegate
{
CapacityTrim.Enabled = trim.Value;
};
Harmony.CreateAndPatchAll(typeof(Batcher), "com.github.jiesiluo.batchbuildrefresh");
Harmony.CreateAndPatchAll(typeof(CapacityTrim), "com.github.jiesiluo.batchbuildrefresh.trim");
((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} {1}: batching = {2}, connection display throttle = {3} ({4} s, from {5} unbuilt), belt capacity trim = {6}", "Batch Build Refresh", "1.3.0", Batcher.Enabled, Batcher.GizmoThrottle, Batcher.GizmoInterval, Batcher.GizmoMinPrebuilds, CapacityTrim.Enabled));
void Apply()
{
Batcher.KindsPerHandout = kinds.Value;
Batcher.Enabled = enabled.Value;
Batcher.GizmoThrottle = gizmo.Value;
Batcher.GizmoInterval = interval.Value;
Batcher.GizmoMinPrebuilds = min.Value;
}
}
}
}