Skip to content

Commit 357e7b7

Browse files
authored
Update codeql.yml
1 parent b10a2a5 commit 357e7b7

File tree

1 file changed

+33
-23
lines changed

1 file changed

+33
-23
lines changed

.github/workflows/codeql.yml

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,33 +69,43 @@ jobs:
6969
- name: Patch ServerDownloader.cs to skip prompts
7070
shell: pwsh
7171
run: |
72-
(Get-Content "SecretLabDependenciesBuilder/SecretLabDependenciesBuilder/ServerDownloader.cs") -replace 'public static async Task RunAsync\(\)\s*\{[^}]*\}', @'
73-
public static async Task RunAsync()
72+
@‚
73+
using DepotDownloader;
74+
75+
namespace SecretLabDependenciesBuilde
76+
77+
public static class ServerDownloader
7478
{
75-
ConsoleWriter.WriteTitle();
76-
_beta = Environment.GetEnvironmentVariable("SL_BETA") ?? "";
77-
_betaPassword = Environment.GetEnvironmentVariable("SL_BETA_PASSWORD") ?? "";
78-
DirectoryInfo installationDirectory = new(Path.Combine(Environment.CurrentDirectory, "temp"));
79-
installationDirectory.Create();
80-
string filesPath = Path.Combine(installationDirectory.FullName, "files.txt");
81-
await File.WriteAllTextAsync(filesPath, "regex:SCPSL_Data/Managed/*");
82-
List<string> args = [ "-app", "996560", "-filelist", filesPath, "-dir", installationDirectory.FullName ];
83-
if (!string.IsNullOrEmpty(_beta)) {
84-
args.Add("-beta"); args.Add(_beta);
85-
if (!string.IsNullOrEmpty(_betaPassword)) {
86-
args.Add("-betapassword"); args.Add(_betaPassword);
79+
private static string _beta;
80+
private static string _betaPassword;
81+
82+
public static async Task RunAsync()
83+
{
84+
ConsoleWriter.WriteTitle();
85+
_beta = Environment.GetEnvironmentVariable("SL_BETA") ?? "";
86+
_betaPassword = Environment.GetEnvironmentVariable("SL_BETA_PASSWORD") ?? "";
87+
DirectoryInfo installationDirectory = new(Path.Combine(Environment.CurrentDirectory, "temp"));
88+
installationDirectory.Create();
89+
string filesPath = Path.Combine(installationDirectory.FullName, "files.txt");
90+
await File.WriteAllTextAsync(filesPath, "regex:SCPSL_Data/Managed/*");
91+
List<string> args = [ "-app", "996560", "-filelist", filesPath, "-dir", installationDirectory.FullName ];
92+
if (!string.IsNullOrEmpty(_beta)) {
93+
args.Add("-beta"); args.Add(_beta);
94+
if (!string.IsNullOrEmpty(_betaPassword)) {
95+
args.Add("-betapassword"); args.Add(_betaPassword);
96+
}
8797
}
98+
bool success = await DepotProgram.Main(args.ToArray()) == 0;
99+
if (!success) {
100+
ConsoleWriter.Write("An error occurred while downloading the files.", ConsoleColor.Red);
101+
return;
102+
}
103+
DirectoryInfo managedDirectory = new(Path.Combine(installationDirectory.FullName, "SCPSL_Data/Managed"));
104+
AssembliesPublicizer.RunPublicizer(managedDirectory);
105+
installationDirectory.Delete(true);
88106
}
89-
bool success = await DepotProgram.Main(args.ToArray()) == 0;
90-
if (!success) {
91-
ConsoleWriter.Write("An error occurred while downloading the files.", ConsoleColor.Red);
92-
return;
93-
}
94-
DirectoryInfo managedDirectory = new(Path.Combine(installationDirectory.FullName, "SCPSL_Data/Managed"));
95-
AssembliesPublicizer.RunPublicizer(managedDirectory);
96-
installationDirectory.Delete(true);
97107
}
98-
'@ | Set-Content "SecretLabDependenciesBuilder/SecretLabDependenciesBuilder/ServerDownloader.cs"
108+
@ | Set-Content "SecretLabDependenciesBuilder/SecretLabDependenciesBuilder/ServerDownloader.cs"
99109
100110
- name: Build SecretLabDependenciesBuilder
101111
run: |

0 commit comments

Comments
 (0)