|
69 | 69 | - name: Patch ServerDownloader.cs to skip prompts |
70 | 70 | shell: pwsh |
71 | 71 | run: | |
72 | | - $path = "SecretLabDependenciesBuilder/SecretLabDependenciesBuilder/ServerDownloader.cs" |
73 | | - $content = Get-Content $path |
74 | | - $patternStart = 'public static async Task RunAsync\(\)' |
75 | | - $startIndex = $content.FindIndex({ $_ -match $patternStart }) |
76 | | - if ($startIndex -lt 0) { throw "Start pattern not found." } |
77 | | -
|
78 | | - $braceCount = 0 |
79 | | - for ($i = $startIndex; $i -lt $content.Count; $i++) { |
80 | | - $line = $content[$i] |
81 | | - $braceCount += ($line -split '{').Count - 1 |
82 | | - $braceCount -= ($line -split '}').Count - 1 |
83 | | - if ($braceCount -eq 0 -and $i -ne $startIndex) { |
84 | | - $endIndex = $i |
85 | | - break |
86 | | - } |
87 | | - } |
88 | | - $replacement = @' |
| 72 | + (Get-Content "SecretLabDependenciesBuilder/SecretLabDependenciesBuilder/ServerDownloader.cs") -replace 'public static async Task RunAsync\(\)\s*\{[^}]*\}', @' |
89 | 73 | public static async Task RunAsync() |
90 | | - { |
| 74 | + { |
91 | 75 | ConsoleWriter.WriteTitle(); |
92 | 76 | _beta = Environment.GetEnvironmentVariable("SL_BETA") ?? ""; |
93 | 77 | _betaPassword = Environment.GetEnvironmentVariable("SL_BETA_PASSWORD") ?? ""; |
|
98 | 82 | List<string> args = [ "-app", "996560", "-filelist", filesPath, "-dir", installationDirectory.FullName ]; |
99 | 83 | if (!string.IsNullOrEmpty(_beta)) { |
100 | 84 | args.Add("-beta"); args.Add(_beta); |
101 | | - if (!string.IsNullOrEmpty(_betaPassword)) { |
| 85 | + if (!string.IsNullOrEmpty(_betaPassword)) { |
102 | 86 | args.Add("-betapassword"); args.Add(_betaPassword); |
103 | 87 | } |
104 | 88 | } |
|
111 | 95 | AssembliesPublicizer.RunPublicizer(managedDirectory); |
112 | 96 | installationDirectory.Delete(true); |
113 | 97 | } |
114 | | - '@ -split "`n" |
115 | | - $newContent = $content[0..($startIndex - 1)] + $replacement + $content[($endIndex + 1)..($content.Count - 1)] |
116 | | - Set-Content -Path $path -Value $newContent |
| 98 | + '@ | Set-Content "SecretLabDependenciesBuilder/SecretLabDependenciesBuilder/ServerDownloader.cs" |
117 | 99 |
|
118 | 100 | - name: Build SecretLabDependenciesBuilder |
119 | 101 | run: | |
|
0 commit comments