diff --git a/.editorconfig b/.editorconfig
index 2d97846..bbddcad 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -9,7 +9,7 @@ end_of_line = lf
indent_style = space
indent_size = 4
-# ----- Resharper Rules -----
+# ----- Resharper Rules -----
# https://www.jetbrains.com/help/resharper/EditorConfig_CSHARP_CSharpIndentStylePageSchema.html#resharper_csharp_align_linq_query
align_linq_query = true
align_multiline_calls_chain = true
@@ -46,12 +46,21 @@ dotnet_diagnostic.CA1815.severity = none
# CA1822: Member does not access instance data and can be marked as static
dotnet_diagnostic.CA1822.severity = none
dotnet_diagnostic.CA1835.severity = none
+
+# CA1854: Prefer the IDictionary.TryGetValue(TKey, out TValue) method
+# - I'm not worried about performance in this application where ContainsKey() is being used, and I like the current syntax as far as readability
+dotnet_diagnostic.CA1854.severity = none
+
+# CA1860: Avoid using 'Enumerable.Any()' extension method, both for clarity and performance
+# - I don't agree with this analyzer, using Any() is far more readable than comparing Count == 0, and has been a pattern in dotnet for more than a decade
+dotnet_diagnostic.CA1860.severity = none
+
# CA2007: Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2007.severity = none
# CA2201: Do not raise reserved exception types
dotnet_diagnostic.CA2201.severity = none
-# CS1998: Async method lacks 'await' operators and will run synchronously
+# CS1998: Async method lacks 'await' operators and will run synchronously
dotnet_diagnostic.cs1998.severity = error
# CS4014: Because this call is not awaited, execution of the current method continues before the call is completed
dotnet_diagnostic.cs4014.severity = error
diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml
index c809e62..8c20e65 100644
--- a/.github/workflows/release-publish.yml
+++ b/.github/workflows/release-publish.yml
@@ -18,7 +18,7 @@ jobs:
# The duplicate releases happen because of a race condition, where each parallel publish job thinks the release has not yet been created.
create-placeholder-release:
runs-on: ubuntu-latest
- container: mcr.microsoft.com/dotnet/sdk:6.0
+ container: mcr.microsoft.com/dotnet/sdk:8.0
steps:
- uses: actions/checkout@v3
with:
@@ -27,7 +27,7 @@ jobs:
- name: Set Version
id: vars
run: |
- version=$(grep -Po '(?<=)(.*?)(?=)' $PROJECT_NAME/$PROJECT_NAME.csproj);
+ version=$(grep -Po '(?<=)(.*?)(?=)' $PROJECT_NAME/$PROJECT_NAME.csproj);
echo "version=$version" >> $GITHUB_OUTPUT;
- name: Create Release
uses: softprops/action-gh-release@v1
@@ -35,12 +35,12 @@ jobs:
with:
draft: true
name: "v${{ steps.vars.outputs.version }}"
- files: "**/*.zip"
+ files: "**/*.zip"
generate_release_notes: true
dotnet-publish:
runs-on: ubuntu-latest
- container: mcr.microsoft.com/dotnet/sdk:6.0
+ container: mcr.microsoft.com/dotnet/sdk:8.0
needs: create-placeholder-release
strategy:
matrix:
@@ -54,11 +54,11 @@ jobs:
- name: Set Version
id: vars
run: |
- version=$(grep -Po '(?<=)(.*?)(?=)' $PROJECT_NAME/$PROJECT_NAME.csproj);
+ version=$(grep -Po '(?<=)(.*?)(?=)' $PROJECT_NAME/$PROJECT_NAME.csproj);
echo "version=$version" >> $GITHUB_OUTPUT;
- run: apt-get update
- run: apt-get install zip -y
- - name: Publish
+ - name: Publish
run: >
version=${{ steps.vars.outputs.version }}
@@ -66,11 +66,7 @@ jobs:
--nologo \
-o "publish/$PROJECT_NAME-$version-${{ matrix.runtime }}" \
-c Release \
- --runtime "${{ matrix.runtime }}" \
- --self-contained true \
- /p:PublishSingleFile=true \
- /p:PublishReadyToRun=true \
- /p:PublishTrimmed=true;
+ --runtime "${{ matrix.runtime }}";
cd publish;
@@ -81,7 +77,7 @@ jobs:
- name: Upload
uses: actions/upload-artifact@v3
with:
- name: EpicPrefill-${{ steps.vars.outputs.version }}-${{ matrix.runtime }}
+ name: EpicPrefill-${{ steps.vars.outputs.version }}-${{ matrix.runtime }}
path: publish/
if-no-files-found: error
- name: Create Release
@@ -90,7 +86,7 @@ jobs:
with:
draft: true
name: "v${{ steps.vars.outputs.version }}"
- files: "**/*.zip"
+ files: "**/*.zip"
generate_release_notes: true
docker-publish-x64:
runs-on: ubuntu-latest
@@ -101,7 +97,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
- dotnet-version: 6.0.x
+ dotnet-version: 8.0.x
- name: Publish
run: >
dotnet publish $PROJECT_NAME/$PROJECT_NAME.csproj \
diff --git a/Benchmarks/Benchmarks.csproj b/Benchmarks/Benchmarks.csproj
index 6bd1475..bebe826 100644
--- a/Benchmarks/Benchmarks.csproj
+++ b/Benchmarks/Benchmarks.csproj
@@ -2,7 +2,7 @@
Exe
- net6.0
+ net8.0
diff --git a/EpicPrefill.Test/EpicPrefill.Test.csproj b/EpicPrefill.Test/EpicPrefill.Test.csproj
index e3e5e86..6875a37 100644
--- a/EpicPrefill.Test/EpicPrefill.Test.csproj
+++ b/EpicPrefill.Test/EpicPrefill.Test.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
enable
enable
diff --git a/EpicPrefill.sln b/EpicPrefill.sln
index f6f1742..6fcb509 100644
--- a/EpicPrefill.sln
+++ b/EpicPrefill.sln
@@ -10,8 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solutio
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EpicPrefill", "EpicPrefill\EpicPrefill.csproj", "{C9891AEF-F9A1-4D6C-9F48-AAB0B054EE81}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LancachePrefill.Common", "LancachePrefill.Common\LancachePrefill.Common.csproj", "{D983EC87-5052-4E88-8891-23EE47A5FF9A}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{964C7C38-DF8F-4D47-AFD0-30B670EFA4AB}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build-and-test.yml = .github\workflows\build-and-test.yml
@@ -25,16 +23,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "Benchmarks\Be
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Testing", "Testing", "{D40480CD-E51C-48F5-B1C5-938420D33C3A}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LancachePrefill.Common", "LancachePrefill.Common\dotnet\LancachePrefill.Common.csproj", "{DD478B94-C184-449D-86F8-E118690720A6}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {D983EC87-5052-4E88-8891-23EE47A5FF9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D983EC87-5052-4E88-8891-23EE47A5FF9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D983EC87-5052-4E88-8891-23EE47A5FF9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D983EC87-5052-4E88-8891-23EE47A5FF9A}.Release|Any CPU.Build.0 = Release|Any CPU
{C9891AEF-F9A1-4D6C-9F48-AAB0B054EE81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9891AEF-F9A1-4D6C-9F48-AAB0B054EE81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9891AEF-F9A1-4D6C-9F48-AAB0B054EE81}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -47,6 +43,10 @@ Global
{3467CD6C-B4F2-4EE5-9872-407C2985C457}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3467CD6C-B4F2-4EE5-9872-407C2985C457}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3467CD6C-B4F2-4EE5-9872-407C2985C457}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DD478B94-C184-449D-86F8-E118690720A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DD478B94-C184-449D-86F8-E118690720A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DD478B94-C184-449D-86F8-E118690720A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DD478B94-C184-449D-86F8-E118690720A6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/EpicPrefill/EpicGamesManager.cs b/EpicPrefill/EpicGamesManager.cs
index 81b744d..53071b5 100644
--- a/EpicPrefill/EpicGamesManager.cs
+++ b/EpicPrefill/EpicGamesManager.cs
@@ -62,7 +62,7 @@ public async Task DownloadMultipleAppsAsync(bool downloadAllOwnedGames, List
- net6.0
+ net8.0
win-x64;linux-x64;linux-arm64;osx-x64
Exe
@@ -9,19 +9,29 @@
1.2.0
tpill90
- True
-
true
strict
latest
true
AllEnabledByDefault
+
+
+
+ true
true
+ false
+
+ partial
+
+ true
true
+
+
+ false
@@ -29,6 +39,11 @@
false
+
+
+ $(MSBuildProjectDirectory)=$(MSBuildProjectName)
+
+
@@ -84,10 +99,6 @@
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
all
runtime; build; native; contentfiles; analyzers
@@ -99,7 +110,7 @@
-
+
\ No newline at end of file
diff --git a/EpicPrefill/Extensions/MiscExtensions.cs b/EpicPrefill/Extensions/MiscExtensions.cs
index 6544867..64a0fc5 100644
--- a/EpicPrefill/Extensions/MiscExtensions.cs
+++ b/EpicPrefill/Extensions/MiscExtensions.cs
@@ -18,8 +18,7 @@ public static byte[] Decompress(this byte[] bytes)
[SuppressMessage("Microsoft.Security", "CA5350", Justification = "SHA1 is required by Epic")]
public static byte[] ComputeSha1Hash(this byte[] input)
{
- using var sha = SHA1.Create();
- return sha.ComputeHash(input);
+ return SHA1.HashData(input);
}
public static string ToHexString(this byte[] input)
@@ -47,7 +46,7 @@ public static string ReadFstring(this BinaryReader br)
// Read bytes representing string
var bytes = br.ReadBytes(stringLength - 2);
- // Reading utf-16 two byte null terminators
+ // Reading utf-16 two byte null terminators
br.ReadBytes(2);
return Encoding.Unicode.GetString(bytes);
@@ -58,7 +57,7 @@ public static string ReadFstring(this BinaryReader br)
{
// Read bytes representing string
var bytes = br.ReadBytes(stringLength - 1);
- // Read null delimiter
+ // Read null delimiter
br.ReadBytes(1);
return Encoding.ASCII.GetString(bytes);
diff --git a/EpicPrefill/Handlers/EpicGamesApi.cs b/EpicPrefill/Handlers/EpicGamesApi.cs
index 40de8c1..fa86b48 100644
--- a/EpicPrefill/Handlers/EpicGamesApi.cs
+++ b/EpicPrefill/Handlers/EpicGamesApi.cs
@@ -36,7 +36,7 @@ public async Task> GetOwnedAppsAsync()
// Read and deserialize
using var responseContent = await response.Content.ReadAsStreamAsync();
- var ownedApps = JsonSerializer.Deserialize(responseContent, SerializationContext.Default.ListGameAsset);
+ var ownedApps = await JsonSerializer.DeserializeAsync(responseContent, SerializationContext.Default.ListGameAsset);
var appMetadata = await LoadAppMetadataAsync(ownedApps);
foreach (var app in ownedApps)
@@ -112,7 +112,7 @@ private async Task GetSingleAppMetadataAsync(GameAsset appI
response.EnsureSuccessStatusCode();
using var responseStream = await response.Content.ReadAsStreamAsync();
- var appMetadata = JsonSerializer.Deserialize(responseStream, SerializationContext.Default.DictionaryStringAppMetadataResponse);
+ var appMetadata = await JsonSerializer.DeserializeAsync(responseStream, SerializationContext.Default.DictionaryStringAppMetadataResponse);
return appMetadata.Values.First();
}
@@ -129,7 +129,7 @@ public async Task> GetAllDownloadUrlsAsync(GameAsset appInfo)
response.EnsureSuccessStatusCode();
using var responseStream = await response.Content.ReadAsStreamAsync();
- ManifestResponse deserialized = JsonSerializer.Deserialize(responseStream, SerializationContext.Default.ManifestResponse);
+ ManifestResponse deserialized = await JsonSerializer.DeserializeAsync(responseStream, SerializationContext.Default.ManifestResponse);
return deserialized.elements.First().manifests.ToList();
}
diff --git a/EpicPrefill/Handlers/UserAccountManager.cs b/EpicPrefill/Handlers/UserAccountManager.cs
index 6eeec6c..a8dce35 100644
--- a/EpicPrefill/Handlers/UserAccountManager.cs
+++ b/EpicPrefill/Handlers/UserAccountManager.cs
@@ -57,7 +57,7 @@ public async Task LoginAsync()
response.EnsureSuccessStatusCode();
using var responseStream = await response.Content.ReadAsStreamAsync();
- OauthToken = JsonSerializer.Deserialize(responseStream, SerializationContext.Default.OauthToken);
+ OauthToken = await JsonSerializer.DeserializeAsync(responseStream, SerializationContext.Default.OauthToken);
Save();
}
diff --git a/EpicPrefill/Models/Exceptions/EpicLoginException.cs b/EpicPrefill/Models/Exceptions/EpicLoginException.cs
index ba6af67..44e7116 100644
--- a/EpicPrefill/Models/Exceptions/EpicLoginException.cs
+++ b/EpicPrefill/Models/Exceptions/EpicLoginException.cs
@@ -1,25 +1,18 @@
namespace EpicPrefill.Models.Exceptions
{
- public class EpicLoginException : Exception
+ public sealed class EpicLoginException : Exception
{
- protected EpicLoginException(SerializationInfo info, StreamingContext context) : base(info, context)
+ public EpicLoginException(string message) : base(message)
{
}
public EpicLoginException()
{
-
- }
-
- public EpicLoginException(string message) : base(message)
- {
-
}
- public EpicLoginException(string message, Exception inner) : base(message, inner)
+ public EpicLoginException(string message, Exception innerException) : base(message, innerException)
{
-
}
}
}
\ No newline at end of file
diff --git a/LancachePrefill.Common b/LancachePrefill.Common
index d93c80f..68c799c 160000
--- a/LancachePrefill.Common
+++ b/LancachePrefill.Common
@@ -1 +1 @@
-Subproject commit d93c80f706a530f753b38ca3a79a7d4a0509fe35
+Subproject commit 68c799c5a8d506710f81c57a95a9ae6bb6d35efc
diff --git a/global.json b/global.json
deleted file mode 100644
index 15f1594..0000000
--- a/global.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "sdk": {
- "version": "6.0.300",
- "rollForward": "latestMinor"
- }
- }
\ No newline at end of file