Skip to content

Commit

Permalink
Renamed functions to better reflect their behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
GoobyCorp committed Feb 5, 2024
1 parent 94d9304 commit 3030803
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static async Task<int> Main(string[] args) {
}

Console.WriteLine("Fetching download links and files...");
List<Task> tl = entries.ToList().Select((e) => FindDownloadExtractPackage(e.Creator, e.Mod)).ToList();
List<Task> tl = entries.ToList().Select((e) => FindDownloadExtractPackageAsync(e.Creator, e.Mod)).ToList();
await Task.WhenAll(tl);

Console.WriteLine("Creating modpack...");
Expand All @@ -57,7 +57,7 @@ static async Task<int> Main(string[] args) {
return 0;
}

internal static async Task FindDownloadExtractPackage(string creator, string mod) {
internal static async Task FindDownloadExtractPackageAsync(string creator, string mod) {
var pe = await ThunderstoreAPI.PackageExperimental(creator, mod);
string path = Path.Combine(DOWNLOAD_DIR, pe.Latest.FullName + ".zip");
Console.WriteLine($"Downloading \"{pe.Namespace}/{pe.Name}\" version \"{pe.Latest.VersionNumber}\" to \"{path}\"...");
Expand All @@ -66,7 +66,7 @@ internal static async Task FindDownloadExtractPackage(string creator, string mod
}

internal static async Task ExtractModPackageAsync(string path) {
await Utilities.ExtractZipEntriesWithPrefix(path, PLUGIN_PREFIX, MODS_DIR);
await Utilities.ExtractZipEntriesWithPrefixAsync(path, PLUGIN_PREFIX, MODS_DIR);
}

internal static async Task CreateModPackageAsync(string path) {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This Company Is Getting Lethal

A program for creating Lethal Company modpacks from [Thunderstore](https://thunderstore.io/c/lethal-company/)
A program for creating [Lethal Company](https://store.steampowered.com/app/1966720/Lethal_Company/) modpacks from [Thunderstore](https://thunderstore.io/c/lethal-company/)

A `config.json` file is required for this to work:

Expand Down
5 changes: 3 additions & 2 deletions Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace ThisCompanyIsGettingLethal
{
internal class Utilities
{
internal static async Task ExtractZipEntriesWithPrefix(string zipPath, string prefix, string outPath) {
internal static async Task ExtractZipEntriesWithPrefixAsync(string zipPath, string prefix, string outPath) {
using (ZipArchive archive = ZipFile.OpenRead(zipPath)) {
foreach (var entry in archive.Entries) {
if (String.IsNullOrEmpty(entry.Name))
Expand All @@ -13,8 +13,9 @@ internal static async Task ExtractZipEntriesWithPrefix(string zipPath, string pr
continue;

string finalPath = Path.Combine(outPath, Path.GetRelativePath(prefix, entry.FullName));
if (String.IsNullOrEmpty(finalPath))
continue;
string finalDir = Path.GetDirectoryName(finalPath);

Check warning on line 18 in Utilities.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

if (String.IsNullOrEmpty(finalDir))
continue;

Expand Down

0 comments on commit 3030803

Please sign in to comment.