mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Most warnings are fixed now
This commit is contained in:
parent
13abba9c1e
commit
7176ebb531
@ -4,7 +4,6 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Timers;
|
||||
using DynamicData;
|
||||
using DynamicData.Kernel;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -15,11 +14,10 @@ namespace Wabbajack.Models;
|
||||
|
||||
public class ResourceMonitor : IDisposable
|
||||
{
|
||||
private readonly TimeSpan PollInterval = TimeSpan.FromMilliseconds(250);
|
||||
private readonly TimeSpan _pollInterval = TimeSpan.FromMilliseconds(250);
|
||||
|
||||
private readonly IResource[] _resources;
|
||||
private readonly Timer _timer;
|
||||
|
||||
|
||||
private readonly Subject<(string Name, long Througput)[]> _updates = new ();
|
||||
private (string Name, long Throughput)[] _prev;
|
||||
public IObservable<(string Name, long Throughput)[]> Updates => _updates;
|
||||
@ -41,7 +39,7 @@ public class ResourceMonitor : IDisposable
|
||||
_resources = resources.ToArray();
|
||||
_prev = _resources.Select(x => (x.Name, (long)0)).ToArray();
|
||||
|
||||
RxApp.MainThreadScheduler.ScheduleRecurringAction(PollInterval, Elapsed)
|
||||
RxApp.MainThreadScheduler.ScheduleRecurringAction(_pollInterval, Elapsed)
|
||||
.DisposeWith(_compositeDisposable);
|
||||
|
||||
_tasks.Connect()
|
||||
@ -55,7 +53,7 @@ public class ResourceMonitor : IDisposable
|
||||
{
|
||||
var current = _resources.Select(x => (x.Name, x.StatusReport.Transferred)).ToArray();
|
||||
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();
|
||||
_prev = current;
|
||||
_updates.OnNext(diff);
|
||||
|
@ -58,7 +58,7 @@ namespace Wabbajack
|
||||
public CompilerState State { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public ISubCompilerVM SubCompilerVM { get; set; }
|
||||
public MO2CompilerVM SubCompilerVM { get; set; }
|
||||
|
||||
// Paths
|
||||
public FilePickerVM ModlistLocation { get; }
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ using Consts = Wabbajack.Consts;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
public class MO2CompilerVM : ViewModel, ISubCompilerVM
|
||||
public class MO2CompilerVM : ViewModel
|
||||
{
|
||||
public CompilerVM Parent { get; }
|
||||
|
||||
@ -36,11 +36,7 @@ namespace Wabbajack
|
||||
|
||||
[Reactive]
|
||||
public ACompiler ActiveCompilation { get; private set; }
|
||||
|
||||
private readonly ObservableAsPropertyHelper<ModlistSettingsEditorVM> _modlistSettings;
|
||||
private readonly IObservable<IChangeSet<string>> _authorKeys;
|
||||
public ModlistSettingsEditorVM ModlistSettings => _modlistSettings.Value;
|
||||
|
||||
|
||||
[Reactive]
|
||||
public object StatusTracker { get; private set; }
|
||||
|
||||
|
@ -145,9 +145,7 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||
public ReactiveCommand<Unit, Unit> OpenLogsCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> GoToInstallCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> BeginCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> BackCommand { get; }
|
||||
|
||||
|
||||
public InstallerVM(ILogger<InstallerVM> logger, DTOSerializer dtos, SettingsManager settingsManager, IServiceProvider serviceProvider,
|
||||
SystemParametersConstructor parametersConstructor, IGameLocator gameLocator, LogStream loggerProvider, ResourceMonitor resourceMonitor,
|
||||
Wabbajack.Services.OSIntegrated.Configuration configuration, HttpClient client, DownloadDispatcher dispatcher, IEnumerable<INeedsLogin> logins) : base(logger)
|
||||
|
@ -307,7 +307,7 @@ namespace Wabbajack
|
||||
ViewModel.AddOtherProfile(selectedPath.FileName.ToString());
|
||||
}
|
||||
|
||||
public async Task AddNoMatchIncludeCommand()
|
||||
public Task AddNoMatchIncludeCommand()
|
||||
{
|
||||
var dlg = new CommonOpenFileDialog
|
||||
{
|
||||
@ -325,12 +325,13 @@ namespace Wabbajack
|
||||
ShowPlacesList = true,
|
||||
};
|
||||
|
||||
if (dlg.ShowDialog() != CommonFileDialogResult.Ok) return;
|
||||
if (dlg.ShowDialog() != CommonFileDialogResult.Ok) return Task.CompletedTask;
|
||||
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));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task AddIncludeCommand()
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604,CS8632</NoWarn>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604,CS8632,CS1998</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
@ -97,7 +97,7 @@ public class ModListHarness
|
||||
CancellationToken.None);
|
||||
|
||||
var compiler = scope.ServiceProvider.GetService<MO2Compiler>();
|
||||
if (!await compiler.Begin(CancellationToken.None))
|
||||
if (!await compiler!.Begin(CancellationToken.None))
|
||||
return null;
|
||||
|
||||
var modlist = await StandardInstaller.LoadFromFile(_dtos, settings.OutputFile);
|
||||
|
@ -13,7 +13,6 @@ using Wabbajack.DTOs.Texture;
|
||||
using Wabbajack.Hashing.PHash;
|
||||
using Wabbajack.Paths.IO;
|
||||
using Wabbajack.RateLimiter;
|
||||
using Wabbajack.Services.OSIntegrated;
|
||||
using Xunit;
|
||||
|
||||
namespace Wabbajack.Compiler.Test;
|
||||
@ -29,7 +28,6 @@ public class CompilerSanityTests : IAsyncLifetime
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private Mod _mod;
|
||||
private ModList? _modlist;
|
||||
private readonly LoggingRateLimiterReporter _reporter;
|
||||
|
||||
public CompilerSanityTests(ILogger<CompilerSanityTests> logger, IServiceProvider serviceProvider,
|
||||
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"));
|
||||
}
|
||||
|
||||
public async Task DisposeAsync()
|
||||
public Task DisposeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task CompileAndValidate(int expectedDirectives, Action<CompilerSettings>? configureSettings = null)
|
||||
@ -97,7 +96,7 @@ public class CompilerSanityTests : IAsyncLifetime
|
||||
|
||||
await CompileAndValidate(4);
|
||||
|
||||
Assert.Single(_modlist.Directives.OfType<PatchedFromArchive>());
|
||||
Assert.Single(_modlist!.Directives.OfType<PatchedFromArchive>());
|
||||
await InstallAndValidate();
|
||||
}
|
||||
|
||||
@ -135,7 +134,7 @@ public class CompilerSanityTests : IAsyncLifetime
|
||||
}
|
||||
|
||||
await CompileAndValidate(42);
|
||||
Assert.Single(_modlist.Directives.OfType<CreateBSA>());
|
||||
Assert.Single(_modlist!.Directives.OfType<CreateBSA>());
|
||||
await InstallAndValidate();
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ public abstract class ACompiler
|
||||
protected async Task CleanInvalidArchivesAndFillState()
|
||||
{
|
||||
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);
|
||||
try
|
||||
@ -302,14 +302,15 @@ public abstract class ACompiler
|
||||
_logger.LogWarning(ex, "While resolving archive {Archive}", a.Name);
|
||||
return a;
|
||||
}
|
||||
}).ToHashSet();
|
||||
}).Where(x => x != null)
|
||||
.ToHashSet();
|
||||
|
||||
if (remove.Count == 0) return;
|
||||
|
||||
_logger.LogWarning(
|
||||
"Removing {count} archives from the compilation state, this is probably not an issue but reference this if you have compilation failures",
|
||||
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));
|
||||
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)
|
||||
{
|
||||
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");
|
||||
}
|
||||
@ -663,7 +664,6 @@ public abstract class ACompiler
|
||||
|
||||
public void PrintNoMatches(ICollection<NoMatch> noMatches)
|
||||
{
|
||||
const int max = 10;
|
||||
if (noMatches.Count > 0)
|
||||
foreach (var file in noMatches)
|
||||
_logger.LogWarning(" {fileTo} - {fileReason}", file.To, file.Reason);
|
||||
|
@ -11,7 +11,6 @@ namespace Wabbajack.Compiler.CompilationSteps;
|
||||
public class IgnoreSaveFiles : MO2CompilationStep
|
||||
{
|
||||
private readonly bool _includeSaves;
|
||||
private readonly AbsolutePath _sourcePath;
|
||||
private readonly string _tag;
|
||||
private readonly AbsolutePath[] _profilePaths;
|
||||
|
||||
|
@ -58,8 +58,8 @@ public class MatchSimilarTextures : ACompilationStep
|
||||
from mainMatch in _byName[mainFile.FullPath.FileName.FileNameWithoutExtension]
|
||||
where mainMatch.ImageState != null
|
||||
where mainFile.ImageState != null
|
||||
let similarity = ImageLoader.ComputeDifference(mainFile.ImageState.PerceptualHash,
|
||||
mainMatch.ImageState.PerceptualHash)
|
||||
let similarity = ImageLoader.ComputeDifference(mainFile.ImageState!.PerceptualHash,
|
||||
mainMatch.ImageState!.PerceptualHash)
|
||||
where similarity >= PerceptualTolerance
|
||||
orderby similarity descending
|
||||
let foundFile = mainMatch.InSameFolder(source.Path.FileName)
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Data.SQLite;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -15,8 +14,6 @@ namespace Wabbajack.Compiler;
|
||||
|
||||
public class BinaryPatchCache : IBinaryPatchCache
|
||||
{
|
||||
private readonly SQLiteConnection _conn;
|
||||
private readonly string _connectionString;
|
||||
private readonly AbsolutePath _location;
|
||||
private readonly ILogger<BinaryPatchCache> _logger;
|
||||
|
||||
@ -76,39 +73,4 @@ public class BinaryPatchCache : IBinaryPatchCache
|
||||
return await location.ReadAllBytesAsync();
|
||||
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);
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604,CS1998</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -11,7 +11,6 @@ namespace Wabbajack.Installer.Test;
|
||||
|
||||
public class StandardInstallerTest
|
||||
{
|
||||
private readonly StandardInstaller _installer;
|
||||
private readonly TemporaryFileManager _manager;
|
||||
private readonly AbsolutePath _modList;
|
||||
private readonly IServiceProvider _provider;
|
||||
|
@ -20,6 +20,7 @@ using Wabbajack.Networking.Http.Interfaces;
|
||||
using Wabbajack.Networking.NexusApi;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.Paths.IO;
|
||||
#pragma warning disable SYSLIB0014
|
||||
|
||||
namespace Wabbajack.Launcher.ViewModels;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604,CS1998</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -27,7 +27,6 @@ public class ApiKeyAuthenticationHandler : AuthenticationHandler<ApiKeyAuthentic
|
||||
private readonly DTOSerializer _dtos;
|
||||
private readonly AppSettings _settings;
|
||||
private readonly AuthorKeys _authorKeys;
|
||||
private readonly Task<HashSet<string>> _tarKeys;
|
||||
private readonly Metrics _metricsStore;
|
||||
private readonly TarLog _tarLog;
|
||||
private readonly Client _githubClient;
|
||||
|
@ -21,8 +21,8 @@ public class AppSettings
|
||||
public string ProxyFolder { get; set; }
|
||||
public AbsolutePath ProxyPath => (AbsolutePath) ProxyFolder;
|
||||
public AbsolutePath TempPath => (AbsolutePath) TempFolder;
|
||||
public string SpamWebHook { get; set; } = null;
|
||||
public string HamWebHook { get; set; } = null;
|
||||
public string SpamWebHook { get; set; } = "";
|
||||
public string HamWebHook { get; set; } = "";
|
||||
|
||||
public string DiscordKey { get; set; }
|
||||
|
||||
|
@ -100,24 +100,6 @@ public class MetricsController : ControllerBase
|
||||
public async Task GetMetrics([FromQuery] string action, [FromQuery] string from, [FromQuery] string? to, [FromQuery] string? subject)
|
||||
{
|
||||
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]
|
||||
|
@ -8,9 +8,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.DTOs.JsonConverters;
|
||||
using Wabbajack.Networking.NexusApi;
|
||||
using Wabbajack.Networking.NexusApi.DTOs;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.Paths.IO;
|
||||
using Wabbajack.Server.Services;
|
||||
|
||||
@ -22,35 +20,19 @@ namespace Wabbajack.BuildServer.Controllers;
|
||||
[Route("/v1/games/")]
|
||||
public class NexusCache : ControllerBase
|
||||
{
|
||||
private readonly NexusApi _api;
|
||||
private readonly ILogger<NexusCache> _logger;
|
||||
private AppSettings _settings;
|
||||
private readonly HttpClient _client;
|
||||
private readonly AbsolutePath _cacheFolder;
|
||||
private readonly DTOSerializer _dtos;
|
||||
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;
|
||||
_client = client;
|
||||
_cache = cache;
|
||||
_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)
|
||||
{
|
||||
_logger.LogInformation("Nexus Cache Forwarding: {path}", src.Path);
|
||||
|
@ -141,7 +141,7 @@ public class Proxy : ControllerBase
|
||||
|
||||
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 =>
|
||||
{
|
||||
var strmA = of.WriteAsync(m, token);
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Wabbajack.BuildServer;
|
||||
|
||||
@ -100,7 +101,7 @@ public static class AbstractServiceExtensions
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
@ -56,7 +56,7 @@ public class DiscordWebHook : AbstractService<DiscordWebHook, int>
|
||||
Channel.Ham => _settings.HamWebHook,
|
||||
_ => null
|
||||
};
|
||||
if (url == null) return;
|
||||
if (string.IsNullOrWhiteSpace(url)) return;
|
||||
|
||||
await _client.PostAsync(url,
|
||||
new StringContent(_dtos.Serialize(message), Encoding.UTF8, "application/json"));
|
||||
|
@ -81,7 +81,7 @@ public class NexusCacheManager
|
||||
{
|
||||
data = await file.ReadAllBytesAsync(token);
|
||||
}
|
||||
catch (FileNotFoundException ex)
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604</NoWarn>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604,CS1998</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
@ -74,7 +75,7 @@ public static class ProtectedData
|
||||
|
||||
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 enc = await fs.UnProtect(destination.FileName.ToString());
|
||||
|
@ -6,6 +6,10 @@
|
||||
<Version>$(VERSION)</Version>
|
||||
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>CS8600,CS8601,CS8618,CS8604,CS1998</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DeviceId" Version="6.2.0" />
|
||||
|
@ -15,7 +15,7 @@ public class IndexRoot
|
||||
IDictionary<FullPath, VirtualFile> byFullPath,
|
||||
ILookup<Hash, VirtualFile> byHash,
|
||||
IDictionary<AbsolutePath, VirtualFile> byRoot,
|
||||
ILookup<IPath, VirtualFile> byName)
|
||||
ILookup<IPath?, VirtualFile> byName)
|
||||
{
|
||||
AllFiles = aFiles;
|
||||
ByFullPath = byFullPath;
|
||||
@ -56,7 +56,7 @@ public class IndexRoot
|
||||
.ToLookup(f => f.Hash));
|
||||
|
||||
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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user