Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
tpill90 committed Dec 22, 2023
1 parent 60bcc75 commit c8ccd18
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
4 changes: 2 additions & 2 deletions SteamPrefill.Test/DepotHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ public async Task OperatingSystemMatches_DepotIsIncluded(string supportedOS, str
{
DepotId = 123,
ManifestId = 5555,
SupportedOperatingSystems = supportedOS.Split(" ").Select(e => OperatingSystem.Parse(e)).ToList()
SupportedOperatingSystems = supportedOS.Split(" ").Select(e => OperatingSystem.FromValue(e)).ToList()
}
};

var downloadArguments = new DownloadArguments
{
OperatingSystems = downloadOS.Split(" ").Select(e => OperatingSystem.Parse(e)).ToList()
OperatingSystems = downloadOS.Split(" ").Select(e => OperatingSystem.FromValue(e)).ToList()
};
var filteredDepots = await _depotHandler.FilterDepotsToDownloadAsync(downloadArguments, depotList);
Assert.Single(filteredDepots);
Expand Down
23 changes: 1 addition & 22 deletions SteamPrefill/Extensions/KeyValueExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,7 @@ public static class KeyValueExtensions

return DateTimeOffset.FromUnixTimeSeconds(seconds).DateTime;
}

/// <summary>
/// Attempts to convert and return the value of this instance as an enum.
/// If the conversion is invalid, null is returned.
/// </summary>
public static T AsEnum<T>(this KeyValue keyValue, bool toLower = false) where T : EnumBase<T>
{
if (keyValue == KeyValue.Invalid)
{
return null;
}
if (string.IsNullOrEmpty(keyValue.Value))
{
return null;
}
if (toLower)
{
return EnumBase<T>.Parse(keyValue.Value.ToLower());
}
return EnumBase<T>.Parse(keyValue.Value);
}


public static string ToLowerCaseString(this KeyValue keyValue)
{
if (keyValue == KeyValue.Invalid)
Expand Down

0 comments on commit c8ccd18

Please sign in to comment.