param([string]$GameDir = "C:\Program Files (x86)\Steam\steamapps\common\Casualties Unknown") $ErrorActionPreference = "Stop" $root = $PSScriptRoot $M = Join-Path $GameDir "CasualtiesUnknown_Data\Managed" $C = Join-Path $GameDir "BepInEx\core" $src = Join-Path $root "SaveAnywhere.cs" $out = Join-Path $root "SaveAnywhere.dll" $csc = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe" $names = @( "mscorlib","System","System.Core","netstandard", "UnityEngine","UnityEngine.CoreModule","UnityEngine.UI","UnityEngine.UIModule", "UnityEngine.InputLegacyModule","UnityEngine.TextRenderingModule","UnityEngine.AudioModule", "UnityEngine.ImageConversionModule","UnityEngine.IMGUIModule","UnityEngine.Physics2DModule", "UnityEngine.TilemapModule","UnityEngine.GridModule","Unity.TextMeshPro", "Unity.RenderPipelines.Universal.Runtime","Unity.RenderPipelines.Core.Runtime", "UnityEngine.UnityWebRequestModule","Assembly-CSharp" ) $refs = @() foreach ($n in $names) { $p = Join-Path $M "$n.dll" if (-not (Test-Path $p)) { throw "missing $p" } $refs += "/r:`"$p`"" } foreach ($n in @("BepInEx","0Harmony","Newtonsoft.Json")) { $p = Join-Path $C "$n.dll" if (-not (Test-Path $p)) { $p = Join-Path $M "$n.dll" } if (-not (Test-Path $p)) { throw "missing $n.dll (install BepInEx 5 first)" } $refs += "/r:`"$p`"" } $extra = @() $logo = Join-Path $root "art\cloudflare.png" if (Test-Path $logo) { $extra += "/resource:`"$logo`",SaveAnywhere.cloudflare.png" } $a = @("/nologo","/nostdlib+","/noconfig","/target:library","/langversion:5","/optimize+","/out:`"$out`"") + $refs + $extra + @("`"$src`"") & $csc $a if ($LASTEXITCODE -ne 0) { throw "build failed" } Write-Host ("SaveAnywhere.dll {0} bytes" -f (Get-Item $out).Length)