Skip to content

Commit

Permalink
bug fix and improvement
Browse files Browse the repository at this point in the history
improve DownloadHelper performance
improve multi-thread dispatch
prevent race condition in ResourceCompleter

code cleanup
  • Loading branch information
laolarou726 committed Nov 16, 2024
1 parent b77ed8a commit c616eb6
Show file tree
Hide file tree
Showing 130 changed files with 1,888 additions and 1,904 deletions.
2 changes: 0 additions & 2 deletions ProjBobcat/ProjBobcat/Class/Helper/ArchiveHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

namespace ProjBobcat.Class.Helper;

#nullable enable

public static class ArchiveHelper
{
public static bool TryOpen(string path, [MaybeNullWhen(false)] out IArchive archive)
Expand Down
14 changes: 0 additions & 14 deletions ProjBobcat/ProjBobcat/Class/Helper/CryptoHelper.cs

This file was deleted.

9 changes: 6 additions & 3 deletions ProjBobcat/ProjBobcat/Class/Helper/CurseForgeAPIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ namespace ProjBobcat.Class.Helper;
#region Temp Models

record AddonInfoReqModel(IEnumerable<long> modIds);

record FileInfoReqModel(IEnumerable<long> fileIds);

record FuzzyFingerPrintReqModel(IEnumerable<long> fingerprints);

[JsonSerializable(typeof(AddonInfoReqModel))]
Expand Down Expand Up @@ -44,7 +46,7 @@ static HttpRequestMessage Req(HttpMethod method, string url)
{
if (string.IsNullOrEmpty(ApiKey))
throw new NullReferenceException("未设置 API KEY,请调用 SetApiKey(string apiKey) 来进行设置。");

var req = new HttpRequestMessage(method, url);

req.Headers.Add("x-api-key", ApiKey);
Expand Down Expand Up @@ -117,7 +119,7 @@ public static void SetApiKey(string apiKey)

using var req = Req(HttpMethod.Post, reqUrl);
req.Content = new StringContent(data, Encoding.UTF8, "application/json");

using var res = await Client.SendAsync(req);

res.EnsureSuccessStatusCode();
Expand Down Expand Up @@ -176,7 +178,8 @@ public static void SetApiKey(string apiKey)
return (await res.Content.ReadFromJsonAsync(CurseForgeModelContext.Default.DataModelString))?.Data;
}

public static async Task<CurseForgeFuzzySearchResponseModel?> TryFuzzySearchFile(long[] fingerprint, int gameId = 432)
public static async Task<CurseForgeFuzzySearchResponseModel?> TryFuzzySearchFile(long[] fingerprint,
int gameId = 432)
{
var reqUrl = $"{BaseUrl}/fingerprints/{gameId}";

Expand Down
Loading

0 comments on commit c616eb6

Please sign in to comment.