mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fixed more warnings
This commit is contained in:
parent
1511b69b4f
commit
13abba9c1e
@ -15,9 +15,11 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<!-- <IncludeSymbolsInSingleFile>true</IncludeSymbolsInSingleFile> -->
|
||||
<AssemblyName>Wabbajack</AssemblyName>
|
||||
<NoWarn>CS8600</NoWarn>
|
||||
<NoWarn>CS8601</NoWarn>
|
||||
<NoWarn>CS8618</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604,CS8632</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
@ -25,6 +25,10 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Wabbajack.Compiler\Wabbajack.Compiler.csproj" />
|
||||
|
@ -10,10 +10,10 @@ public class DropAll : ACompilationStep
|
||||
{
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
public override ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
var result = source.EvolveTo<NoMatch>();
|
||||
result.Reason = "No Match in Stack";
|
||||
return result;
|
||||
return ValueTask.FromResult<Directive?>(result);
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@ -12,6 +13,7 @@ using Xunit;
|
||||
|
||||
namespace Wabbajack.Compression.BSA.Test;
|
||||
|
||||
[SuppressMessage("Usage", "xUnit1026:Theory methods should use all of their parameters")]
|
||||
public class CompressionTests
|
||||
{
|
||||
private readonly ILogger<CompressionTests> _logger;
|
||||
|
@ -48,7 +48,7 @@ public class Reader : IReader
|
||||
return rdr;
|
||||
}
|
||||
|
||||
private async Task LoadHeaders()
|
||||
private Task LoadHeaders()
|
||||
{
|
||||
_headerMagic = Encoding.ASCII.GetString(_rdr.ReadBytes(4));
|
||||
|
||||
@ -91,5 +91,7 @@ public class Reader : IReader
|
||||
Files = files;
|
||||
_stream?.Dispose();
|
||||
_rdr.Dispose();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
@ -71,8 +71,8 @@ public class Builder : IBuilder
|
||||
}
|
||||
}
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
return;
|
||||
return ValueTask.CompletedTask;
|
||||
}
|
||||
}
|
@ -76,8 +76,9 @@ public class Reader : IReader
|
||||
return rdr;
|
||||
}
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
return ValueTask.CompletedTask;
|
||||
}
|
||||
|
||||
public void Dump(Action<string> print)
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -14,6 +15,7 @@ using Xunit;
|
||||
|
||||
namespace Wabbajack.Downloaders.Dispatcher.Test;
|
||||
|
||||
[SuppressMessage("Usage", "xUnit1026:Theory methods should use all of their parameters")]
|
||||
public class DownloaderTests
|
||||
{
|
||||
private readonly DownloadDispatcher _dispatcher;
|
||||
|
@ -46,9 +46,9 @@ public class NexusDownloader : ADownloader<Nexus>, IUrlDownloader
|
||||
_interventionLimiter = interventionLimiter;
|
||||
}
|
||||
|
||||
public override async Task<bool> Prepare()
|
||||
public override Task<bool> Prepare()
|
||||
{
|
||||
return _api.ApiKey.HaveToken();
|
||||
return Task.FromResult(_api.ApiKey.HaveToken());
|
||||
}
|
||||
|
||||
public override bool IsAllowed(ServerAllowList allowList, IDownloadState state)
|
||||
|
@ -6,6 +6,11 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>Wabbajack</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
</ItemGroup>
|
||||
|
@ -15,7 +15,6 @@ using Wabbajack.DTOs.Logins;
|
||||
using Wabbajack.Networking.Http;
|
||||
using Wabbajack.Networking.Http.Interfaces;
|
||||
using Wabbajack.Networking.NexusApi.DTOs;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.Paths.IO;
|
||||
using Wabbajack.RateLimiter;
|
||||
using Wabbajack.Server.DTOs;
|
||||
@ -245,7 +244,7 @@ public class NexusApi
|
||||
throw new HttpException(result);
|
||||
|
||||
var response = await result.Content.ReadFromJsonAsync<ChunkStatusResult>(_jsonOptions);
|
||||
return response;
|
||||
return response!;
|
||||
}
|
||||
public async Task UploadFile(UploadDefinition d)
|
||||
{
|
||||
@ -327,7 +326,7 @@ public class NexusApi
|
||||
_logger.LogInformation("Checking file status of {Uuid}", chunkStatus.UUID);
|
||||
var data = await _client.GetFromJsonAsync<FileStatusResult>(
|
||||
$"https://upload.nexusmods.com/uploads/check_status?id={chunkStatus.UUID}");
|
||||
if (data.FileChunksAssembled)
|
||||
if (data!.FileChunksAssembled)
|
||||
return data;
|
||||
await Task.Delay(TimeSpan.FromSeconds(5));
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class ProxiedNexusApi : NexusApi
|
||||
}
|
||||
|
||||
protected override async ValueTask<HttpRequestMessage> GenerateMessage(HttpMethod method, string uri,
|
||||
params object[] parameters)
|
||||
params object?[] parameters)
|
||||
{
|
||||
var msg = await base.GenerateMessage(method, uri, parameters);
|
||||
if (ProxiedEndpoints.Contains(uri))
|
||||
|
@ -6,6 +6,10 @@
|
||||
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
|
||||
<Version>$(VERSION)</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.2-mauipre.1.22102.15" />
|
||||
|
@ -40,18 +40,18 @@ public class CesiVFSCache : IVfsCache
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
_logger.LogInformation("Requesting CESI Information for: {Hash} - Not Found", hash.ToHex());
|
||||
_logger.LogInformation(exception, "Requesting CESI Information for: {Hash} - Not Found", hash.ToHex());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Put(IndexedVirtualFile file, CancellationToken token)
|
||||
public Task Put(IndexedVirtualFile file, CancellationToken token)
|
||||
{
|
||||
return;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task Clean()
|
||||
public Task Clean()
|
||||
{
|
||||
return;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
@ -45,7 +45,6 @@ public class Client
|
||||
private readonly IResource<Client> _hashLimiter;
|
||||
private readonly IResource<HttpClient> _limiter;
|
||||
private readonly ILogger<Client> _logger;
|
||||
private readonly ParallelOptions _parallelOptions;
|
||||
|
||||
private readonly ITokenProvider<WabbajackApiState> _token;
|
||||
|
||||
@ -461,7 +460,7 @@ public class Client
|
||||
var result = await _client.SendAsync(msg);
|
||||
return result.IsSuccessStatusCode;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -4,6 +4,10 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Wabbajack.Common\Wabbajack.Common.csproj" />
|
||||
|
@ -144,8 +144,8 @@ public class VFSTests : IDisposable
|
||||
await AddFile(_archiveTestTxt, "This is a test");
|
||||
await ZipUpFolder(_archiveTestTxt.Parent, _testZip);
|
||||
|
||||
var inner_dir = @"archive\other\dir".ToRelativePath().RelativeTo(_vfsTestDir);
|
||||
inner_dir.CreateDirectory();
|
||||
var innerDir = @"archive\other\dir".ToRelativePath().RelativeTo(_vfsTestDir);
|
||||
innerDir.CreateDirectory();
|
||||
await _testZip.MoveToAsync(@"archive\other\dir\nested.zip".ToRelativePath().RelativeTo(_vfsTestDir), true,
|
||||
CancellationToken.None);
|
||||
await ZipUpFolder(_archiveTestTxt.Parent, _testZip);
|
||||
@ -168,9 +168,10 @@ public class VFSTests : IDisposable
|
||||
await filename.WriteAllTextAsync(text);
|
||||
}
|
||||
|
||||
private static async Task ZipUpFolder(AbsolutePath folder, AbsolutePath output)
|
||||
private static Task ZipUpFolder(AbsolutePath folder, AbsolutePath output)
|
||||
{
|
||||
ZipFile.CreateFromDirectory(folder.ToString(), output.ToString());
|
||||
folder.DeleteDirectory();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
@ -132,7 +132,7 @@ public class Context
|
||||
token,
|
||||
fileNames.Keys.ToHashSet());
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
await using var stream = await sfn.GetStream();
|
||||
var hash = await stream.HashingCopy(Stream.Null, token);
|
||||
|
@ -37,7 +37,7 @@ public class IndexRoot
|
||||
public IReadOnlyList<VirtualFile> AllFiles { get; }
|
||||
public IDictionary<FullPath, VirtualFile> ByFullPath { get; }
|
||||
public ILookup<Hash, VirtualFile> ByHash { get; }
|
||||
public ILookup<IPath, VirtualFile> ByName { get; set; }
|
||||
public ILookup<IPath?, VirtualFile> ByName { get; set; }
|
||||
public IDictionary<AbsolutePath, VirtualFile> ByRootPath { get; }
|
||||
|
||||
public async Task<IndexRoot> Integrate(IEnumerable<VirtualFile> files)
|
||||
@ -77,7 +77,7 @@ public class IndexRoot
|
||||
|
||||
public static class EmptyLookup<TKey, TElement>
|
||||
{
|
||||
public static ILookup<TKey, TElement> Instance { get; } =
|
||||
public static ILookup<TKey?, TElement> Instance { get; } =
|
||||
Enumerable.Empty<TElement>().ToLookup(x => default(TKey));
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ public class VirtualFile
|
||||
|
||||
private static readonly SignatureChecker DDSSig = new(FileType.DDS);
|
||||
|
||||
private IEnumerable<VirtualFile> _thisAndAllChildren;
|
||||
private IEnumerable<VirtualFile>? _thisAndAllChildren;
|
||||
|
||||
public IPath Name { get; internal set; }
|
||||
|
||||
@ -45,7 +45,7 @@ public class VirtualFile
|
||||
|
||||
public ulong LastAnalyzed { get; internal set; }
|
||||
|
||||
public VirtualFile Parent { get; internal set; }
|
||||
public VirtualFile? Parent { get; internal set; }
|
||||
|
||||
public Context Context { get; set; }
|
||||
|
||||
@ -107,7 +107,7 @@ public class VirtualFile
|
||||
}
|
||||
|
||||
|
||||
public VirtualFile TopParent => IsNative ? this : Parent.TopParent;
|
||||
public VirtualFile TopParent => IsNative ? this : Parent!.TopParent;
|
||||
|
||||
|
||||
public T ThisAndAllChildrenReduced<T>(T acc, Func<T, VirtualFile, T> fn)
|
||||
@ -193,7 +193,7 @@ public class VirtualFile
|
||||
{
|
||||
Context = context,
|
||||
Name = relPath,
|
||||
Parent = parent,
|
||||
Parent = parent!,
|
||||
Size = stream.Length,
|
||||
LastModified = extractedFile.LastModifiedUtc.AsUnixTime(),
|
||||
LastAnalyzed = DateTime.Now.AsUnixTime(),
|
||||
@ -277,11 +277,11 @@ public class VirtualFile
|
||||
var self = this;
|
||||
for (var idx = depth; idx != 0; idx -= 1)
|
||||
{
|
||||
paths[idx - 1] = self.RelativeName;
|
||||
paths[idx - 1] = self!.RelativeName;
|
||||
self = self.Parent;
|
||||
}
|
||||
|
||||
FullPath = new FullPath(self.AbsoluteName, paths);
|
||||
FullPath = new FullPath(self!.AbsoluteName, paths);
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ public class VirtualFile
|
||||
return Read(context, null, br);
|
||||
}
|
||||
|
||||
private static VirtualFile Read(Context context, VirtualFile parent, BinaryReader br)
|
||||
private static VirtualFile Read(Context context, VirtualFile? parent, BinaryReader br)
|
||||
{
|
||||
var vf = new VirtualFile
|
||||
{
|
||||
@ -371,7 +371,7 @@ public class VirtualFile
|
||||
return path;
|
||||
}
|
||||
|
||||
public VirtualFile InSameFolder(RelativePath relativePath)
|
||||
public VirtualFile? InSameFolder(RelativePath relativePath)
|
||||
{
|
||||
var newPath = FullPath.InSameFolder(relativePath);
|
||||
return Context.Index.ByFullPath.TryGetValue(newPath, out var found) ? found : null;
|
||||
|
@ -6,6 +6,10 @@
|
||||
<Version>$(VERSION)</Version>
|
||||
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
|
||||
|
Loading…
Reference in New Issue
Block a user