Fix some warnings.

This commit is contained in:
2025-05-10 13:38:59 +01:00
parent c8ee8bb151
commit e4113d2092
21 changed files with 80 additions and 90 deletions

View File

@@ -1,7 +1,6 @@
@page "/{documentCategory}/{documentName}.md" @page "/{documentCategory}/{documentName}.md"
@page "/{documentName}.md" @page "/{documentName}.md"
@inject NavigationManager NavigationManager
@inject IWebHostEnvironment HostEnvironment @inject IWebHostEnvironment HostEnvironment
@inject IConfiguration Configuration @inject IConfiguration Configuration

View File

@@ -6,7 +6,7 @@
@inject Microsoft.EntityFrameworkCore.IDbContextFactory<DbContext> DbContextFactory @inject Microsoft.EntityFrameworkCore.IDbContextFactory<DbContext> DbContextFactory
<PageTitle>@_pageTitle</PageTitle> <PageTitle>@PageTitle</PageTitle>
<style> <style>
.list-group-item { .list-group-item {
background-color: #212529; color: white; border-color: #373b3e; background-color: #212529; color: white; border-color: #373b3e;
@@ -30,7 +30,7 @@
} }
<div class="stats-section"> <div class="stats-section">
<h1 style="color: #e18fdc; align-content: center; padding: 2rem">@_pageTitle</h1> <h1 style="color: #e18fdc; align-content: center; padding: 2rem">@PageTitle</h1>
</div> </div>
<div class="stats-section"> <div class="stats-section">

View File

@@ -19,7 +19,7 @@ public partial class View
{ {
bool _initialized; bool _initialized;
bool _notFound; bool _notFound;
string _pageTitle { get; set; } = "Aaru Device Report"; string PageTitle { get; set; } = "Aaru Device Report";
[CascadingParameter] [CascadingParameter]
HttpContext HttpContext { get; set; } = default!; HttpContext HttpContext { get; set; } = default!;
[Parameter] [Parameter]
@@ -132,7 +132,7 @@ public partial class View
return; return;
} }
_pageTitle = $"Aaru Device Report for {report.Manufacturer} {report.Model} {report.Revision}"; PageTitle = $"Aaru Device Report for {report.Manufacturer} {report.Model} {report.Revision}";
if(report.USB != null) if(report.USB != null)
{ {
@@ -195,7 +195,7 @@ public partial class View
if(tuples != null) if(tuples != null)
{ {
Dictionary<string, string> decodedTuples = new(); Dictionary<string, string> decodedTuples = [];
foreach(Tuple tuple in tuples) foreach(Tuple tuple in tuples)
{ {
@@ -319,7 +319,7 @@ public partial class View
out string? maximumAtaRevision, out string? maximumAtaRevision,
out string? transport, out string? transport,
out List<string>? transportVersions, out List<string>? transportVersions,
out List<string>? generalConfiguration, out List<string> generalConfiguration,
out List<string>? specificConfiguration, out List<string>? specificConfiguration,
out List<string> deviceCapabilities, out List<string> deviceCapabilities,
out List<string> pioTransferModes, out List<string> pioTransferModes,
@@ -405,8 +405,7 @@ public partial class View
DeviceInquiry = new Dictionary<string, string> DeviceInquiry = new Dictionary<string, string>
{ {
{ {
"Vendor:", "Vendor:", VendorString.Prettify(vendorId) != vendorId
VendorString.Prettify(vendorId) != vendorId
? $"{vendorId} ({VendorString.Prettify(vendorId)})" ? $"{vendorId} ({VendorString.Prettify(vendorId)})"
: vendorId : vendorId
}, },

View File

@@ -39,7 +39,7 @@ public partial class Commands
} }
#pragma warning disable CS8604 // Possible null reference argument. #pragma warning disable CS8604 // Possible null reference argument.
await Common.HandleRedraw(_commandsChart, _commandsLabels, GetCommandsChartDataset); await Common.HandleRedrawAsync(_commandsChart, _commandsLabels, GetCommandsChartDataset);
#pragma warning restore CS8604 // Possible null reference argument. #pragma warning restore CS8604 // Possible null reference argument.
} }
@@ -47,8 +47,8 @@ public partial class Commands
{ {
Label = $"Top {_commandsLabels.Length} used commands", Label = $"Top {_commandsLabels.Length} used commands",
Data = _commandsCounts, Data = _commandsCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
} }

View File

@@ -4,23 +4,17 @@ namespace Aaru.Server.Components.Pages.Statistics;
public static class Common public static class Common
{ {
internal static readonly List<string> _backgroundColors = internal static readonly List<string> BackgroundColors =
[ [
ChartColor.FromHtmlColorCode("#006412"), ChartColor.FromHtmlColorCode("#0000D3"), ChartColor.FromHtmlColorCode("#006412"), ChartColor.FromHtmlColorCode("#0000D3"), ChartColor.FromHtmlColorCode("#FF6403"), ChartColor.FromHtmlColorCode("#562C05"), ChartColor.FromHtmlColorCode("#DD0907"), ChartColor.FromHtmlColorCode("#F20884"), ChartColor.FromHtmlColorCode("#4700A5"), ChartColor.FromHtmlColorCode("#90713A"), ChartColor.FromHtmlColorCode("#1FB714"), ChartColor.FromHtmlColorCode("#02ABEA"), ChartColor.FromHtmlColorCode("#FBF305")
ChartColor.FromHtmlColorCode("#FF6403"), ChartColor.FromHtmlColorCode("#562C05"),
ChartColor.FromHtmlColorCode("#DD0907"), ChartColor.FromHtmlColorCode("#F20884"),
ChartColor.FromHtmlColorCode("#4700A5"), ChartColor.FromHtmlColorCode("#90713A"),
ChartColor.FromHtmlColorCode("#1FB714"), ChartColor.FromHtmlColorCode("#02ABEA"),
ChartColor.FromHtmlColorCode("#FBF305")
]; ];
internal static readonly List<string> _borderColors = [ChartColor.FromHtmlColorCode("#8b0000")]; internal static readonly List<string> BorderColors = [ChartColor.FromHtmlColorCode("#8b0000")];
internal static async Task HandleRedraw<TDataSet, TItem, TOptions, TModel>( internal static async Task HandleRedrawAsync<TDataSet, TItem, TOptions, TModel>(BaseChart<TDataSet, TItem, TOptions, TModel> chart, string[] labels, Func<TDataSet> getDataSet)
BaseChart<TDataSet, TItem, TOptions, TModel> chart, string[] labels, Func<TDataSet> getDataSet)
where TDataSet : ChartDataset<TItem> where TOptions : ChartOptions where TModel : ChartModel where TDataSet : ChartDataset<TItem> where TOptions : ChartOptions where TModel : ChartModel
{ {
await chart.Clear(); await chart.Clear();
await chart.AddLabelsDatasetsAndUpdate(labels, getDataSet()); await chart.AddLabelsDatasetsAndUpdate(labels, getDataSet()).ConfigureAwait(false);
} }
} }

View File

@@ -95,9 +95,9 @@ public partial class Devices
_devicesByManufacturerCounts[9] = data.Sum(static o => o.Count) - _devicesByManufacturerCounts.Take(9).Sum(); _devicesByManufacturerCounts[9] = data.Sum(static o => o.Count) - _devicesByManufacturerCounts.Take(9).Sum();
#pragma warning disable CS8604 // Possible null reference argument. #pragma warning disable CS8604 // Possible null reference argument.
await Common.HandleRedraw(_devicesByBusChart, _devicesByBusLabels, GetDevicesByBusChartDataset); await Common.HandleRedrawAsync(_devicesByBusChart, _devicesByBusLabels, GetDevicesByBusChartDataset);
await Common.HandleRedraw(_devicesByManufacturerChart, await Common.HandleRedrawAsync(_devicesByManufacturerChart,
_devicesByManufacturerLabels, _devicesByManufacturerLabels,
GetDevicesByManufacturerChartDataset); GetDevicesByManufacturerChartDataset);
#pragma warning restore CS8604 // Possible null reference argument. #pragma warning restore CS8604 // Possible null reference argument.
@@ -110,8 +110,8 @@ public partial class Devices
{ {
Label = $"Top {_devicesByBusLabels.Length} devices by bus", Label = $"Top {_devicesByBusLabels.Length} devices by bus",
Data = _devicesByBusCounts, Data = _devicesByBusCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
@@ -119,8 +119,8 @@ public partial class Devices
{ {
Label = $"Top {_devicesByManufacturerLabels.Length} devices by manufacturers", Label = $"Top {_devicesByManufacturerLabels.Length} devices by manufacturers",
Data = _devicesByManufacturerCounts, Data = _devicesByManufacturerCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
} }

View File

@@ -49,7 +49,7 @@ public partial class Filesystems
} }
#pragma warning disable CS8604 // Possible null reference argument. #pragma warning disable CS8604 // Possible null reference argument.
await Common.HandleRedraw(_filesystemsChart, _filesystemsLabels, GetFilesystemsChartDataset); await Common.HandleRedrawAsync(_filesystemsChart, _filesystemsLabels, GetFilesystemsChartDataset);
#pragma warning restore CS8604 // Possible null reference argument. #pragma warning restore CS8604 // Possible null reference argument.
} }
@@ -57,8 +57,8 @@ public partial class Filesystems
{ {
Label = $"Top {_filesystemsLabels.Length} filesystems found", Label = $"Top {_filesystemsLabels.Length} filesystems found",
Data = _filesystemsCounts, Data = _filesystemsCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
} }

View File

@@ -49,7 +49,7 @@ public partial class Filters
} }
#pragma warning disable CS8604 // Possible null reference argument. #pragma warning disable CS8604 // Possible null reference argument.
await Common.HandleRedraw(_filtersChart, _filtersLabels, GetFiltersChartDataset); await Common.HandleRedrawAsync(_filtersChart, _filtersLabels, GetFiltersChartDataset);
#pragma warning restore CS8604 // Possible null reference argument. #pragma warning restore CS8604 // Possible null reference argument.
} }
@@ -58,8 +58,8 @@ public partial class Filters
{ {
Label = $"Top {_filtersLabels.Length} filters found", Label = $"Top {_filtersLabels.Length} filters found",
Data = _filtersCounts, Data = _filtersCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
} }

View File

@@ -50,7 +50,7 @@ public partial class Formats
#pragma warning disable CS8604 // Possible null reference argument. #pragma warning disable CS8604 // Possible null reference argument.
await Common.HandleRedraw(_formatsChart, _formatsLabels, GetFormatsChartDataset); await Common.HandleRedrawAsync(_formatsChart, _formatsLabels, GetFormatsChartDataset);
#pragma warning restore CS8604 // Possible null reference argument. #pragma warning restore CS8604 // Possible null reference argument.
} }
@@ -59,8 +59,8 @@ public partial class Formats
{ {
Label = $"Top {_formatsLabels.Length} media image formats found", Label = $"Top {_formatsLabels.Length} media image formats found",
Data = _formatsCounts, Data = _formatsCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
} }

View File

@@ -147,12 +147,12 @@ public partial class OperatingSystems
#pragma warning disable CS8604 // Possible null reference argument. #pragma warning disable CS8604 // Possible null reference argument.
await Task.WhenAll(Common.HandleRedraw(_operatingSystemsChart, await Task.WhenAll(Common.HandleRedrawAsync(_operatingSystemsChart,
_operatingSystemsLabels, _operatingSystemsLabels,
GetOperatingSystemsChartDataset), GetOperatingSystemsChartDataset),
Common.HandleRedraw(_linuxChart, _linuxLabels, GetLinuxChartDataset), Common.HandleRedrawAsync(_linuxChart, _linuxLabels, GetLinuxChartDataset),
Common.HandleRedraw(_macosChart, _macosLabels, GetMacosChartDataset), Common.HandleRedrawAsync(_macosChart, _macosLabels, GetMacosChartDataset),
Common.HandleRedraw(_windowsChart, _windowsLabels, GetWindowsChartDataset)); Common.HandleRedrawAsync(_windowsChart, _windowsLabels, GetWindowsChartDataset));
#pragma warning restore CS8604 // Possible null reference argument. #pragma warning restore CS8604 // Possible null reference argument.
// Upstream: https://github.com/Megabit/Blazorise/issues/5491 // Upstream: https://github.com/Megabit/Blazorise/issues/5491
@@ -163,8 +163,8 @@ public partial class OperatingSystems
{ {
Label = "Operating systems", Label = "Operating systems",
Data = _operatingSystemsCounts, Data = _operatingSystemsCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
@@ -172,8 +172,8 @@ public partial class OperatingSystems
{ {
Label = $"Top {_linuxLabels.Length} Linux versions", Label = $"Top {_linuxLabels.Length} Linux versions",
Data = _linuxCounts, Data = _linuxCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
@@ -181,8 +181,8 @@ public partial class OperatingSystems
{ {
Label = $"Top {_macosLabels.Length} macOS versions", Label = $"Top {_macosLabels.Length} macOS versions",
Data = _macosCounts, Data = _macosCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
@@ -190,11 +190,10 @@ public partial class OperatingSystems
{ {
Label = $"Top {_windowsLabels.Length} Windows versions", Label = $"Top {_windowsLabels.Length} Windows versions",
Data = _windowsCounts, Data = _windowsCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
static string GetPlatformName(string name, string version) => static string GetPlatformName(string name, string version) => DetectOS.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID), name), version);
DetectOS.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID), name), version);
} }

View File

@@ -49,7 +49,7 @@ public partial class Partitions
} }
#pragma warning disable CS8604 // Possible null reference argument. #pragma warning disable CS8604 // Possible null reference argument.
await Common.HandleRedraw(_partitionsChart, _partitionsLabels, GetPartitionsChartDataset); await Common.HandleRedrawAsync(_partitionsChart, _partitionsLabels, GetPartitionsChartDataset);
#pragma warning restore CS8604 // Possible null reference argument. #pragma warning restore CS8604 // Possible null reference argument.
} }
@@ -57,8 +57,8 @@ public partial class Partitions
{ {
Label = $"Top {_partitionsLabels.Length} partitioning schemes found", Label = $"Top {_partitionsLabels.Length} partitioning schemes found",
Data = _partitionsCounts, Data = _partitionsCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
} }

View File

@@ -65,7 +65,7 @@ public partial class RealMedias
#pragma warning disable CS8604 // Possible null reference argument. #pragma warning disable CS8604 // Possible null reference argument.
await Common.HandleRedraw(_realMediaChart, _realMediaLabels, GetRealMediaChartDataset); await Common.HandleRedrawAsync(_realMediaChart, _realMediaLabels, GetRealMediaChartDataset);
#pragma warning restore CS8604 // Possible null reference argument. #pragma warning restore CS8604 // Possible null reference argument.
} }
@@ -73,8 +73,8 @@ public partial class RealMedias
{ {
Label = $"Top {_realMediaLabels.Length} media types found in devices", Label = $"Top {_realMediaLabels.Length} media types found in devices",
Data = _realMediaCounts, Data = _realMediaCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
} }

View File

@@ -55,7 +55,7 @@ public partial class Versions
} }
#pragma warning disable CS8604 // Possible null reference argument. #pragma warning disable CS8604 // Possible null reference argument.
await Common.HandleRedraw(_versionsChart, _versionsLabels, GetVersionsChartDataset); await Common.HandleRedrawAsync(_versionsChart, _versionsLabels, GetVersionsChartDataset);
#pragma warning restore CS8604 // Possible null reference argument. #pragma warning restore CS8604 // Possible null reference argument.
} }
@@ -63,8 +63,8 @@ public partial class Versions
{ {
Label = $"Top {_versionsLabels.Length} Aaru versions", Label = $"Top {_versionsLabels.Length} Aaru versions",
Data = _versionsCounts, Data = _versionsCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
} }

View File

@@ -64,7 +64,7 @@ public partial class VirtualMedias
} }
#pragma warning disable CS8604 // Possible null reference argument. #pragma warning disable CS8604 // Possible null reference argument.
await Common.HandleRedraw(_virtualMediaChart, _virtualMediaLabels, GetVirtualMediaChartDataset); await Common.HandleRedrawAsync(_virtualMediaChart, _virtualMediaLabels, GetVirtualMediaChartDataset);
#pragma warning restore CS8604 // Possible null reference argument. #pragma warning restore CS8604 // Possible null reference argument.
} }
@@ -72,8 +72,8 @@ public partial class VirtualMedias
{ {
Label = $"Top {_virtualMediaLabels.Length} media types found in images", Label = $"Top {_virtualMediaLabels.Length} media types found in images",
Data = _virtualMediaCounts, Data = _virtualMediaCounts,
BackgroundColor = Common._backgroundColors, BackgroundColor = Common.BackgroundColors,
BorderColor = Common._borderColors, BorderColor = Common.BorderColors,
BorderWidth = 1 BorderWidth = 1
}; };
} }

View File

@@ -99,7 +99,7 @@ public static class Ata
streaming = null; streaming = null;
smartCommandTransport = null; smartCommandTransport = null;
nvCache = null; nvCache = null;
readCapabilitiesDictionary = new Dictionary<string, string>(); readCapabilitiesDictionary = [];
readCapabilitiesList = []; readCapabilitiesList = [];
Identify.IdentifyDevice? ataIdentifyNullable = Identify.Decode(ataReport.Identify); Identify.IdentifyDevice? ataIdentifyNullable = Identify.Decode(ataReport.Identify);
@@ -110,19 +110,19 @@ public static class Ata
if(!string.IsNullOrEmpty(ataIdentify.Model)) if(!string.IsNullOrEmpty(ataIdentify.Model))
{ {
deviceIdentification ??= new Dictionary<string, string>(); deviceIdentification ??= [];
deviceIdentification["Model"] = ataIdentify.Model; deviceIdentification["Model"] = ataIdentify.Model;
} }
if(!string.IsNullOrEmpty(ataIdentify.FirmwareRevision)) if(!string.IsNullOrEmpty(ataIdentify.FirmwareRevision))
{ {
deviceIdentification ??= new Dictionary<string, string>(); deviceIdentification ??= [];
deviceIdentification["Firmware revision"] = ataIdentify.FirmwareRevision; deviceIdentification["Firmware revision"] = ataIdentify.FirmwareRevision;
} }
if(!string.IsNullOrEmpty(ataIdentify.AdditionalPID)) if(!string.IsNullOrEmpty(ataIdentify.AdditionalPID))
{ {
deviceIdentification ??= new Dictionary<string, string>(); deviceIdentification ??= [];
deviceIdentification["Additional product ID"] = ataIdentify.AdditionalPID; deviceIdentification["Additional product ID"] = ataIdentify.AdditionalPID;
} }

View File

@@ -47,7 +47,7 @@ public static class ScsiEvpd
public static void Report(IEnumerable<ScsiPage> pages, string vendor, public static void Report(IEnumerable<ScsiPage> pages, string vendor,
out Dictionary<string, List<string>> evpdPages) out Dictionary<string, List<string>> evpdPages)
{ {
evpdPages = new Dictionary<string, List<string>>(); evpdPages = [];
vendor = vendor.ToLowerInvariant(); vendor = vendor.ToLowerInvariant();
foreach(ScsiPage evpd in pages) foreach(ScsiPage evpd in pages)

View File

@@ -53,7 +53,7 @@ public static class ScsiModeSense
{ {
modeSenseCapabilities = null; modeSenseCapabilities = null;
blockDescriptors = null; blockDescriptors = null;
modePages = new Dictionary<string, List<string>>(); modePages = [];
if(modeSense.MediumType.HasValue) if(modeSense.MediumType.HasValue)
{ {

View File

@@ -43,11 +43,11 @@ public static class SscTestedMedia
out Dictionary<string, (Dictionary<string, string> Table, List<string> List)> out Dictionary<string, (Dictionary<string, string> Table, List<string> List)>
mediaInformation) mediaInformation)
{ {
mediaInformation = new Dictionary<string, (Dictionary<string, string>, List<string>)>(); mediaInformation = [];
foreach(TestedSequentialMedia media in testedMedia) foreach(TestedSequentialMedia media in testedMedia)
{ {
Dictionary<string, string> table = new(); Dictionary<string, string> table = [];
List<string> list = []; List<string> list = [];
string header; string header;
@@ -63,9 +63,9 @@ public static class SscTestedMedia
header = "Information for unknown medium type"; header = "Information for unknown medium type";
if(!string.IsNullOrWhiteSpace(media.Manufacturer)) if(!string.IsNullOrWhiteSpace(media.Manufacturer))
table.Add("Medium manufacturer", $"{media.Manufacturer}"); table.Add("Medium manufacturer", media.Manufacturer);
if(!string.IsNullOrWhiteSpace(media.Model)) table.Add("Medium model", $"{media.Model}"); if(!string.IsNullOrWhiteSpace(media.Model)) table.Add("Medium model", media.Model);
if(media.Density.HasValue) list.Add($"Medium has density code {media.Density:X2}h"); if(media.Density.HasValue) list.Add($"Medium has density code {media.Density:X2}h");

View File

@@ -38,13 +38,13 @@ public static class TestedMedia
/// <param name="mediaInformation">List to put values on</param> /// <param name="mediaInformation">List to put values on</param>
/// <param name="testedMedias">List of tested media</param> /// <param name="testedMedias">List of tested media</param>
public static void Report(List<CommonTypes.Metadata.TestedMedia> testedMedias, public static void Report(List<CommonTypes.Metadata.TestedMedia> testedMedias,
out Dictionary<string, (Dictionary<string, string>, List<string>)> mediaInformation) out Dictionary<string, (Dictionary<string, string> Table, List<string> List)> mediaInformation)
{ {
mediaInformation = new Dictionary<string, (Dictionary<string, string>, List<string>)>(); mediaInformation = [];
foreach(CommonTypes.Metadata.TestedMedia testedMedia in testedMedias) foreach(CommonTypes.Metadata.TestedMedia testedMedia in testedMedias)
{ {
Dictionary<string, string> table = new(); Dictionary<string, string> table = [];
List<string> list = []; List<string> list = [];
string header; string header;
@@ -64,9 +64,9 @@ public static class TestedMedia
: "Drive does not recognize this medium."); : "Drive does not recognize this medium.");
if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer)) if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer))
table.Add("Medium manufacturer", $"{testedMedia.Manufacturer}"); table.Add("Medium manufacturer", testedMedia.Manufacturer);
if(!string.IsNullOrWhiteSpace(testedMedia.Model)) table.Add("Medium model", $"{testedMedia.Model}"); if(!string.IsNullOrWhiteSpace(testedMedia.Model)) table.Add("Medium model", testedMedia.Model);
if(testedMedia.Density != null) table.Add("Density code", $"{testedMedia.Density:X2}h"); if(testedMedia.Density != null) table.Add("Density code", $"{testedMedia.Density:X2}h");
@@ -191,8 +191,7 @@ public static class TestedMedia
: $"Medium rotates at {testedMedia.NominalRotationRate} rpm"); : $"Medium rotates at {testedMedia.NominalRotationRate} rpm");
} }
if(testedMedia.BlockSize != null && if(testedMedia is { BlockSize: not null, PhysicalBlockSize: not null } &&
testedMedia.PhysicalBlockSize != null &&
testedMedia.BlockSize.Value != testedMedia.PhysicalBlockSize.Value && testedMedia.BlockSize.Value != testedMedia.PhysicalBlockSize.Value &&
(testedMedia.LogicalAlignment & 0x8000) == 0x0000 && (testedMedia.LogicalAlignment & 0x8000) == 0x0000 &&
(testedMedia.LogicalAlignment & 0x4000) == 0x4000) (testedMedia.LogicalAlignment & 0x4000) == 0x4000)

View File

@@ -76,7 +76,7 @@ builder.Services.AddScoped<IdentityUserAccessor>();
builder.Services.AddScoped<IdentityRedirectManager>(); builder.Services.AddScoped<IdentityRedirectManager>();
builder.Services.AddScoped<AuthenticationStateProvider, IdentityRevalidatingAuthenticationStateProvider>(); builder.Services.AddScoped<AuthenticationStateProvider, IdentityRevalidatingAuthenticationStateProvider>();
builder.Services.AddAuthentication(options => builder.Services.AddAuthentication(static options =>
{ {
options.DefaultScheme = IdentityConstants.ApplicationScheme; options.DefaultScheme = IdentityConstants.ApplicationScheme;
options.DefaultSignInScheme = IdentityConstants.ExternalScheme; options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
@@ -164,7 +164,7 @@ using(IServiceScope scope = app.Services.CreateScope())
{ {
Console.WriteLine("\e[31;1mCould not open database...\e[0m"); Console.WriteLine("\e[31;1mCould not open database...\e[0m");
#if DEBUG #if DEBUG
Console.WriteLine("\e[31;1mException: {0}\e[0m", ex.Message); Console.WriteLine("\e[31;1mException: {0}\e[0m", ex);
#endif #endif
return; return;
} }

View File

@@ -7,7 +7,7 @@ public static class Seeder
{ {
public static async Task SeedAsync(DbContext ctx, IServiceProvider serviceProvider) public static async Task SeedAsync(DbContext ctx, IServiceProvider serviceProvider)
{ {
var email = "claunia@claunia.com"; const string email = "claunia@claunia.com";
var randChars = new char[16]; var randChars = new char[16];
UserManager<IdentityUser> userManager = serviceProvider.GetRequiredService<UserManager<IdentityUser>>(); UserManager<IdentityUser> userManager = serviceProvider.GetRequiredService<UserManager<IdentityUser>>();
var rnd = new Random(); var rnd = new Random();