Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahStolk committed Sep 14, 2024
1 parent 16d0509 commit 35145fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/DevilDaggersInfo.Web.Client/HttpClients/ApiHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ protected ApiHttpClient(HttpClient client, ILocalStorageService localStorageServ

protected async Task<HttpResponseMessage> SendRequest(HttpMethod httpMethod, string url, JsonContent? body = null)
{
HttpRequestMessage request = new()
{
RequestUri = new Uri(url, UriKind.Relative),
Method = httpMethod,
Content = body,
};
using HttpRequestMessage request = new();
request.RequestUri = new Uri(url, UriKind.Relative);
request.Method = httpMethod;
request.Content = body;
string? token = await _localStorageService.GetItemAsStringAsync(AdminAuthenticationStateProvider.LocalStorageAuthKey);
if (token != null)
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,8 @@ private static Dictionary<BinaryName, byte[]> GetBinaryNames(List<(string Name,
foreach ((string name, byte[] data) in binaries)
{
BinaryName binaryName = new(ModBinaryToc.DetermineType(data), name);
if (dict.ContainsKey(binaryName))
if (!dict.TryAdd(binaryName, data))
throw new InvalidModArchiveException("Binary names must all be unique.");

dict.Add(binaryName, data);
}

return dict;
Expand Down

0 comments on commit 35145fa

Please sign in to comment.