Most warnings are fixed now

This commit is contained in:
Halgari 2022-10-07 21:43:44 -06:00
parent 13abba9c1e
commit 7176ebb531
29 changed files with 44 additions and 138 deletions

View File

@ -4,7 +4,6 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Reactive.Disposables; using System.Reactive.Disposables;
using System.Reactive.Subjects; using System.Reactive.Subjects;
using System.Timers;
using DynamicData; using DynamicData;
using DynamicData.Kernel; using DynamicData.Kernel;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -15,10 +14,9 @@ namespace Wabbajack.Models;
public class ResourceMonitor : IDisposable public class ResourceMonitor : IDisposable
{ {
private readonly TimeSpan PollInterval = TimeSpan.FromMilliseconds(250); private readonly TimeSpan _pollInterval = TimeSpan.FromMilliseconds(250);
private readonly IResource[] _resources; private readonly IResource[] _resources;
private readonly Timer _timer;
private readonly Subject<(string Name, long Througput)[]> _updates = new (); private readonly Subject<(string Name, long Througput)[]> _updates = new ();
private (string Name, long Throughput)[] _prev; private (string Name, long Throughput)[] _prev;
@ -41,7 +39,7 @@ public class ResourceMonitor : IDisposable
_resources = resources.ToArray(); _resources = resources.ToArray();
_prev = _resources.Select(x => (x.Name, (long)0)).ToArray(); _prev = _resources.Select(x => (x.Name, (long)0)).ToArray();
RxApp.MainThreadScheduler.ScheduleRecurringAction(PollInterval, Elapsed) RxApp.MainThreadScheduler.ScheduleRecurringAction(_pollInterval, Elapsed)
.DisposeWith(_compositeDisposable); .DisposeWith(_compositeDisposable);
_tasks.Connect() _tasks.Connect()
@ -55,7 +53,7 @@ public class ResourceMonitor : IDisposable
{ {
var current = _resources.Select(x => (x.Name, x.StatusReport.Transferred)).ToArray(); var current = _resources.Select(x => (x.Name, x.StatusReport.Transferred)).ToArray();
var diff = _prev.Zip(current) var diff = _prev.Zip(current)
.Select(t => (t.First.Name, (long)((t.Second.Transferred - t.First.Throughput) / PollInterval.TotalSeconds))) .Select(t => (t.First.Name, (long)((t.Second.Transferred - t.First.Throughput) / _pollInterval.TotalSeconds)))
.ToArray(); .ToArray();
_prev = current; _prev = current;
_updates.OnNext(diff); _updates.OnNext(diff);

View File

@ -58,7 +58,7 @@ namespace Wabbajack
public CompilerState State { get; set; } public CompilerState State { get; set; }
[Reactive] [Reactive]
public ISubCompilerVM SubCompilerVM { get; set; } public MO2CompilerVM SubCompilerVM { get; set; }
// Paths // Paths
public FilePickerVM ModlistLocation { get; } public FilePickerVM ModlistLocation { get; }

View File

@ -1,16 +0,0 @@
using System;
using System.Threading.Tasks;
using Wabbajack.Compiler;
using Wabbajack.DTOs;
namespace Wabbajack
{
public interface ISubCompilerVM
{
ACompiler ActiveCompilation { get; }
ModlistSettingsEditorVM ModlistSettings { get; }
void Unload();
IObservable<bool> CanCompile { get; }
Task<GetResponse<ModList>> Compile();
}
}

View File

@ -18,7 +18,7 @@ using Consts = Wabbajack.Consts;
namespace Wabbajack namespace Wabbajack
{ {
public class MO2CompilerVM : ViewModel, ISubCompilerVM public class MO2CompilerVM : ViewModel
{ {
public CompilerVM Parent { get; } public CompilerVM Parent { get; }
@ -37,10 +37,6 @@ namespace Wabbajack
[Reactive] [Reactive]
public ACompiler ActiveCompilation { get; private set; } public ACompiler ActiveCompilation { get; private set; }
private readonly ObservableAsPropertyHelper<ModlistSettingsEditorVM> _modlistSettings;
private readonly IObservable<IChangeSet<string>> _authorKeys;
public ModlistSettingsEditorVM ModlistSettings => _modlistSettings.Value;
[Reactive] [Reactive]
public object StatusTracker { get; private set; } public object StatusTracker { get; private set; }

View File

@ -145,8 +145,6 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
public ReactiveCommand<Unit, Unit> OpenLogsCommand { get; } public ReactiveCommand<Unit, Unit> OpenLogsCommand { get; }
public ReactiveCommand<Unit, Unit> GoToInstallCommand { get; } public ReactiveCommand<Unit, Unit> GoToInstallCommand { get; }
public ReactiveCommand<Unit, Unit> BeginCommand { get; } public ReactiveCommand<Unit, Unit> BeginCommand { get; }
public ReactiveCommand<Unit, Unit> BackCommand { get; }
public InstallerVM(ILogger<InstallerVM> logger, DTOSerializer dtos, SettingsManager settingsManager, IServiceProvider serviceProvider, public InstallerVM(ILogger<InstallerVM> logger, DTOSerializer dtos, SettingsManager settingsManager, IServiceProvider serviceProvider,
SystemParametersConstructor parametersConstructor, IGameLocator gameLocator, LogStream loggerProvider, ResourceMonitor resourceMonitor, SystemParametersConstructor parametersConstructor, IGameLocator gameLocator, LogStream loggerProvider, ResourceMonitor resourceMonitor,

View File

@ -307,7 +307,7 @@ namespace Wabbajack
ViewModel.AddOtherProfile(selectedPath.FileName.ToString()); ViewModel.AddOtherProfile(selectedPath.FileName.ToString());
} }
public async Task AddNoMatchIncludeCommand() public Task AddNoMatchIncludeCommand()
{ {
var dlg = new CommonOpenFileDialog var dlg = new CommonOpenFileDialog
{ {
@ -325,12 +325,13 @@ namespace Wabbajack
ShowPlacesList = true, ShowPlacesList = true,
}; };
if (dlg.ShowDialog() != CommonFileDialogResult.Ok) return; if (dlg.ShowDialog() != CommonFileDialogResult.Ok) return Task.CompletedTask;
var selectedPath = dlg.FileNames.First().ToAbsolutePath(); var selectedPath = dlg.FileNames.First().ToAbsolutePath();
if (!selectedPath.InFolder(ViewModel.Source)) return; if (!selectedPath.InFolder(ViewModel.Source)) return Task.CompletedTask;
ViewModel.AddNoMatchInclude(selectedPath.RelativeTo(ViewModel!.Source)); ViewModel.AddNoMatchInclude(selectedPath.RelativeTo(ViewModel!.Source));
return Task.CompletedTask;
} }
public async Task AddIncludeCommand() public async Task AddIncludeCommand()

View File

@ -19,7 +19,7 @@
<PropertyGroup> <PropertyGroup>
<NoWarn>CS8600,CS8601,CS8618,CS8604,CS8632</NoWarn> <NoWarn>CS8600,CS8601,CS8618,CS8604,CS8632,CS1998</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

View File

@ -97,7 +97,7 @@ public class ModListHarness
CancellationToken.None); CancellationToken.None);
var compiler = scope.ServiceProvider.GetService<MO2Compiler>(); var compiler = scope.ServiceProvider.GetService<MO2Compiler>();
if (!await compiler.Begin(CancellationToken.None)) if (!await compiler!.Begin(CancellationToken.None))
return null; return null;
var modlist = await StandardInstaller.LoadFromFile(_dtos, settings.OutputFile); var modlist = await StandardInstaller.LoadFromFile(_dtos, settings.OutputFile);

View File

@ -13,7 +13,6 @@ using Wabbajack.DTOs.Texture;
using Wabbajack.Hashing.PHash; using Wabbajack.Hashing.PHash;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
using Wabbajack.RateLimiter; using Wabbajack.RateLimiter;
using Wabbajack.Services.OSIntegrated;
using Xunit; using Xunit;
namespace Wabbajack.Compiler.Test; namespace Wabbajack.Compiler.Test;
@ -29,7 +28,6 @@ public class CompilerSanityTests : IAsyncLifetime
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private Mod _mod; private Mod _mod;
private ModList? _modlist; private ModList? _modlist;
private readonly LoggingRateLimiterReporter _reporter;
public CompilerSanityTests(ILogger<CompilerSanityTests> logger, IServiceProvider serviceProvider, public CompilerSanityTests(ILogger<CompilerSanityTests> logger, IServiceProvider serviceProvider,
FileExtractor.FileExtractor fileExtractor, FileExtractor.FileExtractor fileExtractor,
@ -52,8 +50,9 @@ public class CompilerSanityTests : IAsyncLifetime
"https://authored-files.wabbajack.org/Tonal%20Architect_WJ_TEST_FILES.zip_9cb97a01-3354-4077-9e4a-7e808d47794f")); "https://authored-files.wabbajack.org/Tonal%20Architect_WJ_TEST_FILES.zip_9cb97a01-3354-4077-9e4a-7e808d47794f"));
} }
public async Task DisposeAsync() public Task DisposeAsync()
{ {
return Task.CompletedTask;
} }
private async Task CompileAndValidate(int expectedDirectives, Action<CompilerSettings>? configureSettings = null) private async Task CompileAndValidate(int expectedDirectives, Action<CompilerSettings>? configureSettings = null)
@ -97,7 +96,7 @@ public class CompilerSanityTests : IAsyncLifetime
await CompileAndValidate(4); await CompileAndValidate(4);
Assert.Single(_modlist.Directives.OfType<PatchedFromArchive>()); Assert.Single(_modlist!.Directives.OfType<PatchedFromArchive>());
await InstallAndValidate(); await InstallAndValidate();
} }
@ -135,7 +134,7 @@ public class CompilerSanityTests : IAsyncLifetime
} }
await CompileAndValidate(42); await CompileAndValidate(42);
Assert.Single(_modlist.Directives.OfType<CreateBSA>()); Assert.Single(_modlist!.Directives.OfType<CreateBSA>());
await InstallAndValidate(); await InstallAndValidate();
} }

View File

@ -286,7 +286,7 @@ public abstract class ACompiler
protected async Task CleanInvalidArchivesAndFillState() protected async Task CleanInvalidArchivesAndFillState()
{ {
NextStep("Compiling", "Cleaning Invalid Archives", IndexedArchives.Count); NextStep("Compiling", "Cleaning Invalid Archives", IndexedArchives.Count);
var remove = await IndexedArchives.PKeepAll(CompilerLimiter, async a => var remove = await IndexedArchives.PMapAllBatchedAsync(CompilerLimiter, async a =>
{ {
UpdateProgress(1); UpdateProgress(1);
try try
@ -302,14 +302,15 @@ public abstract class ACompiler
_logger.LogWarning(ex, "While resolving archive {Archive}", a.Name); _logger.LogWarning(ex, "While resolving archive {Archive}", a.Name);
return a; return a;
} }
}).ToHashSet(); }).Where(x => x != null)
.ToHashSet();
if (remove.Count == 0) return; if (remove.Count == 0) return;
_logger.LogWarning( _logger.LogWarning(
"Removing {count} archives from the compilation state, this is probably not an issue but reference this if you have compilation failures", "Removing {count} archives from the compilation state, this is probably not an issue but reference this if you have compilation failures",
remove.Count); remove.Count);
remove.Do(r => _logger.LogWarning("Resolution failed for: ({size} {hash}) {path}", r.File.Size, r.File.Hash, remove.Do(r => _logger.LogWarning("Resolution failed for: ({size} {hash}) {path}", r!.File.Size, r.File.Hash,
r.File.FullPath)); r.File.FullPath));
IndexedArchives.RemoveAll(a => remove.Contains(a)); IndexedArchives.RemoveAll(a => remove.Contains(a));
} }
@ -596,7 +597,7 @@ public abstract class ACompiler
public async Task<Archive> ResolveArchive(Hash hash, IDictionary<Hash, IndexedArchive> archives) public async Task<Archive> ResolveArchive(Hash hash, IDictionary<Hash, IndexedArchive> archives)
{ {
if (archives.TryGetValue(hash, out var found)) return await ResolveArchive(found); if (archives.TryGetValue(hash, out var found)) return (await ResolveArchive(found))!;
throw new ArgumentException($"No match found for Archive sha: {hash.ToBase64()} this shouldn't happen"); throw new ArgumentException($"No match found for Archive sha: {hash.ToBase64()} this shouldn't happen");
} }
@ -663,7 +664,6 @@ public abstract class ACompiler
public void PrintNoMatches(ICollection<NoMatch> noMatches) public void PrintNoMatches(ICollection<NoMatch> noMatches)
{ {
const int max = 10;
if (noMatches.Count > 0) if (noMatches.Count > 0)
foreach (var file in noMatches) foreach (var file in noMatches)
_logger.LogWarning(" {fileTo} - {fileReason}", file.To, file.Reason); _logger.LogWarning(" {fileTo} - {fileReason}", file.To, file.Reason);

View File

@ -11,7 +11,6 @@ namespace Wabbajack.Compiler.CompilationSteps;
public class IgnoreSaveFiles : MO2CompilationStep public class IgnoreSaveFiles : MO2CompilationStep
{ {
private readonly bool _includeSaves; private readonly bool _includeSaves;
private readonly AbsolutePath _sourcePath;
private readonly string _tag; private readonly string _tag;
private readonly AbsolutePath[] _profilePaths; private readonly AbsolutePath[] _profilePaths;

View File

@ -58,8 +58,8 @@ public class MatchSimilarTextures : ACompilationStep
from mainMatch in _byName[mainFile.FullPath.FileName.FileNameWithoutExtension] from mainMatch in _byName[mainFile.FullPath.FileName.FileNameWithoutExtension]
where mainMatch.ImageState != null where mainMatch.ImageState != null
where mainFile.ImageState != null where mainFile.ImageState != null
let similarity = ImageLoader.ComputeDifference(mainFile.ImageState.PerceptualHash, let similarity = ImageLoader.ComputeDifference(mainFile.ImageState!.PerceptualHash,
mainMatch.ImageState.PerceptualHash) mainMatch.ImageState!.PerceptualHash)
where similarity >= PerceptualTolerance where similarity >= PerceptualTolerance
orderby similarity descending orderby similarity descending
let foundFile = mainMatch.InSameFolder(source.Path.FileName) let foundFile = mainMatch.InSameFolder(source.Path.FileName)

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Data.SQLite;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -15,8 +14,6 @@ namespace Wabbajack.Compiler;
public class BinaryPatchCache : IBinaryPatchCache public class BinaryPatchCache : IBinaryPatchCache
{ {
private readonly SQLiteConnection _conn;
private readonly string _connectionString;
private readonly AbsolutePath _location; private readonly AbsolutePath _location;
private readonly ILogger<BinaryPatchCache> _logger; private readonly ILogger<BinaryPatchCache> _logger;
@ -76,39 +73,4 @@ public class BinaryPatchCache : IBinaryPatchCache
return await location.ReadAllBytesAsync(); return await location.ReadAllBytesAsync();
return Array.Empty<byte>(); return Array.Empty<byte>();
} }
public async Task CreatePatchCached(byte[] a, byte[] b, Stream output)
{
await using var cmd = new SQLiteCommand(_conn);
cmd.CommandText = @"INSERT INTO PatchCache (FromHash, ToHash, PatchSize, Patch)
VALUES (@fromHash, @toHash, @patchSize, @patch)";
xxHashAlgorithm aAl = new(0), bAl = new(0);
var dataA = Hash.FromULong(aAl.HashBytes(a));
;
var dataB = Hash.FromULong(bAl.HashBytes(b));
;
cmd.Parameters.AddWithValue("@fromHash", (long) dataA);
cmd.Parameters.AddWithValue("@toHash", (long) dataB);
await using var patch = new MemoryStream();
OctoDiff.Create(a, b, patch);
patch.Position = 0;
cmd.Parameters.AddWithValue("@patchSize", patch.Length);
cmd.Parameters.AddWithValue("@patch", patch.ToArray());
try
{
await cmd.ExecuteNonQueryAsync();
}
catch (SQLiteException ex)
{
if (!ex.Message.StartsWith("constraint failed"))
throw;
}
await patch.CopyToAsync(output);
}
} }

View File

@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn> <NoWarn>CS8600,CS8601,CS8618,CS8604,CS1998</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -11,7 +11,6 @@ namespace Wabbajack.Installer.Test;
public class StandardInstallerTest public class StandardInstallerTest
{ {
private readonly StandardInstaller _installer;
private readonly TemporaryFileManager _manager; private readonly TemporaryFileManager _manager;
private readonly AbsolutePath _modList; private readonly AbsolutePath _modList;
private readonly IServiceProvider _provider; private readonly IServiceProvider _provider;

View File

@ -20,6 +20,7 @@ using Wabbajack.Networking.Http.Interfaces;
using Wabbajack.Networking.NexusApi; using Wabbajack.Networking.NexusApi;
using Wabbajack.Paths; using Wabbajack.Paths;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
#pragma warning disable SYSLIB0014
namespace Wabbajack.Launcher.ViewModels; namespace Wabbajack.Launcher.ViewModels;

View File

@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn> <NoWarn>CS8600,CS8601,CS8618,CS8604,CS1998</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -27,7 +27,6 @@ public class ApiKeyAuthenticationHandler : AuthenticationHandler<ApiKeyAuthentic
private readonly DTOSerializer _dtos; private readonly DTOSerializer _dtos;
private readonly AppSettings _settings; private readonly AppSettings _settings;
private readonly AuthorKeys _authorKeys; private readonly AuthorKeys _authorKeys;
private readonly Task<HashSet<string>> _tarKeys;
private readonly Metrics _metricsStore; private readonly Metrics _metricsStore;
private readonly TarLog _tarLog; private readonly TarLog _tarLog;
private readonly Client _githubClient; private readonly Client _githubClient;

View File

@ -21,8 +21,8 @@ public class AppSettings
public string ProxyFolder { get; set; } public string ProxyFolder { get; set; }
public AbsolutePath ProxyPath => (AbsolutePath) ProxyFolder; public AbsolutePath ProxyPath => (AbsolutePath) ProxyFolder;
public AbsolutePath TempPath => (AbsolutePath) TempFolder; public AbsolutePath TempPath => (AbsolutePath) TempFolder;
public string SpamWebHook { get; set; } = null; public string SpamWebHook { get; set; } = "";
public string HamWebHook { get; set; } = null; public string HamWebHook { get; set; } = "";
public string DiscordKey { get; set; } public string DiscordKey { get; set; }

View File

@ -100,24 +100,6 @@ public class MetricsController : ControllerBase
public async Task GetMetrics([FromQuery] string action, [FromQuery] string from, [FromQuery] string? to, [FromQuery] string? subject) public async Task GetMetrics([FromQuery] string action, [FromQuery] string from, [FromQuery] string? to, [FromQuery] string? subject)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
var parser = new Parser();
to ??= "now";
var toDate = parser.Parse(to).Start;
var fromDate = parser.Parse(from).Start;
var records = _metricsStore.GetRecords(fromDate!.Value, toDate!.Value, action);
Response.Headers.ContentType = "application/json";
await foreach (var record in records)
{
if (!string.IsNullOrWhiteSpace(subject) && !record.Subject.Contains(subject))
continue;
await JsonSerializer.SerializeAsync(Response.Body, record);
await Response.Body.WriteAsync(EOL);
}
} }
[HttpGet] [HttpGet]

View File

@ -8,9 +8,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.DTOs.JsonConverters; using Wabbajack.DTOs.JsonConverters;
using Wabbajack.Networking.NexusApi;
using Wabbajack.Networking.NexusApi.DTOs; using Wabbajack.Networking.NexusApi.DTOs;
using Wabbajack.Paths;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
using Wabbajack.Server.Services; using Wabbajack.Server.Services;
@ -22,35 +20,19 @@ namespace Wabbajack.BuildServer.Controllers;
[Route("/v1/games/")] [Route("/v1/games/")]
public class NexusCache : ControllerBase public class NexusCache : ControllerBase
{ {
private readonly NexusApi _api;
private readonly ILogger<NexusCache> _logger; private readonly ILogger<NexusCache> _logger;
private AppSettings _settings;
private readonly HttpClient _client; private readonly HttpClient _client;
private readonly AbsolutePath _cacheFolder;
private readonly DTOSerializer _dtos; private readonly DTOSerializer _dtos;
private readonly NexusCacheManager _cache; private readonly NexusCacheManager _cache;
public NexusCache(ILogger<NexusCache> logger,AppSettings settings, HttpClient client, NexusCacheManager cache, DTOSerializer dtos) public NexusCache(ILogger<NexusCache> logger, HttpClient client, NexusCacheManager cache, DTOSerializer dtos)
{ {
_settings = settings;
_logger = logger; _logger = logger;
_client = client; _client = client;
_cache = cache; _cache = cache;
_dtos = dtos; _dtos = dtos;
} }
private async Task ForwardToNexus(HttpRequest src)
{
_logger.LogInformation("Nexus Cache Forwarding: {path}", src.Path);
var request = new HttpRequestMessage(HttpMethod.Get, (Uri?)new Uri("https://api.nexusmods.com/" + src.Path));
request.Headers.Add("apikey", (string?)src.Headers["apikey"]);
request.Headers.Add("User-Agent", (string?)src.Headers.UserAgent);
using var response = await _client.SendAsync(request);
Response.Headers.ContentType = "application/json";
Response.StatusCode = (int)response.StatusCode;
await response.Content.CopyToAsync(Response.Body);
}
private async Task<T> ForwardRequest<T>(HttpRequest src, CancellationToken token) private async Task<T> ForwardRequest<T>(HttpRequest src, CancellationToken token)
{ {
_logger.LogInformation("Nexus Cache Forwarding: {path}", src.Path); _logger.LogInformation("Nexus Cache Forwarding: {path}", src.Path);

View File

@ -141,7 +141,7 @@ public class Proxy : ControllerBase
Response.Headers.Add( HeaderNames.ContentType, "application/octet-stream" ); Response.Headers.Add( HeaderNames.ContentType, "application/octet-stream" );
var result = await proxyDownloader.DownloadStream(archive, async s => { var result = await proxyDownloader!.DownloadStream(archive, async s => {
return await s.HashingCopy(async m => return await s.HashingCopy(async m =>
{ {
var strmA = of.WriteAsync(m, token); var strmA = of.WriteAsync(m, token);

View File

@ -2,6 +2,7 @@
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Wabbajack.BuildServer; using Wabbajack.BuildServer;
@ -100,7 +101,7 @@ public static class AbstractServiceExtensions
{ {
public static void UseService<T>(this IApplicationBuilder b) public static void UseService<T>(this IApplicationBuilder b)
{ {
var poll = (IStartable) b.ApplicationServices.GetService(typeof(T)); var poll = (IStartable) b.ApplicationServices.GetRequiredService(typeof(T));
poll.Start(); poll.Start();
} }
} }

View File

@ -56,7 +56,7 @@ public class DiscordWebHook : AbstractService<DiscordWebHook, int>
Channel.Ham => _settings.HamWebHook, Channel.Ham => _settings.HamWebHook,
_ => null _ => null
}; };
if (url == null) return; if (string.IsNullOrWhiteSpace(url)) return;
await _client.PostAsync(url, await _client.PostAsync(url,
new StringContent(_dtos.Serialize(message), Encoding.UTF8, "application/json")); new StringContent(_dtos.Serialize(message), Encoding.UTF8, "application/json"));

View File

@ -81,7 +81,7 @@ public class NexusCacheManager
{ {
data = await file.ReadAllBytesAsync(token); data = await file.ReadAllBytesAsync(token);
} }
catch (FileNotFoundException ex) catch (FileNotFoundException)
{ {
return default; return default;
} }

View File

@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn> <NoWarn>CS8600,CS8601,CS8618,CS8604,CS1998</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,3 +1,4 @@
using System;
using System.IO; using System.IO;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
@ -74,7 +75,7 @@ public static class ProtectedData
public static async Task<byte[]> FromEncryptedDataFile(this AbsolutePath destination) public static async Task<byte[]> FromEncryptedDataFile(this AbsolutePath destination)
{ {
if (!destination.FileExists()) return default; if (!destination.FileExists()) return Array.Empty<byte>();
await using var fs = destination.Open(FileMode.Open, FileAccess.Read, FileShare.Read); await using var fs = destination.Open(FileMode.Open, FileAccess.Read, FileShare.Read);
await using var enc = await fs.UnProtect(destination.FileName.ToString()); await using var enc = await fs.UnProtect(destination.FileName.ToString());

View File

@ -7,6 +7,10 @@
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression> <PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<NoWarn>CS8600,CS8601,CS8618,CS8604,CS1998</NoWarn>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DeviceId" Version="6.2.0" /> <PackageReference Include="DeviceId" Version="6.2.0" />
<PackageReference Include="GitInfo" Version="2.2.0"> <PackageReference Include="GitInfo" Version="2.2.0">

View File

@ -15,7 +15,7 @@ public class IndexRoot
IDictionary<FullPath, VirtualFile> byFullPath, IDictionary<FullPath, VirtualFile> byFullPath,
ILookup<Hash, VirtualFile> byHash, ILookup<Hash, VirtualFile> byHash,
IDictionary<AbsolutePath, VirtualFile> byRoot, IDictionary<AbsolutePath, VirtualFile> byRoot,
ILookup<IPath, VirtualFile> byName) ILookup<IPath?, VirtualFile> byName)
{ {
AllFiles = aFiles; AllFiles = aFiles;
ByFullPath = byFullPath; ByFullPath = byFullPath;
@ -56,7 +56,7 @@ public class IndexRoot
.ToLookup(f => f.Hash)); .ToLookup(f => f.Hash));
var byName = Task.Run(() => allFiles.SelectMany(f => f.ThisAndAllChildren) var byName = Task.Run(() => allFiles.SelectMany(f => f.ThisAndAllChildren)
.ToLookup(f => f.Name)); .ToLookup<VirtualFile, IPath?>(f => f.Name));
var byRootPath = Task.Run(() => allFiles.ToDictionary(f => f.AbsoluteName)); var byRootPath = Task.Run(() => allFiles.ToDictionary(f => f.AbsoluteName));