Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Mar 27, 2024
1 parent 8220e01 commit b0d9763
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 47 deletions.
28 changes: 14 additions & 14 deletions src/BUTR.Site.NexusMods.Client/BUTR.Site.NexusMods.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
<PackageReference Include="Blazorise.Bootstrap5" Version="1.4.2" />
<PackageReference Include="Blazorise.Charts" Version="1.4.2" />
<PackageReference Include="Blazorise.Components" Version="1.4.2" />
<PackageReference Include="Blazorise.DataGrid" Version="1.4.2" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="1.4.2" />
<PackageReference Include="Blazorise.LoadingIndicator" Version="1.4.2" />
<PackageReference Include="Blazorise.QRCode" Version="1.4.2" />
<PackageReference Include="Blazorise.Snackbar" Version="1.4.2" />
<PackageReference Include="Blazorise.TreeView" Version="1.4.2" />
<PackageReference Include="BUTR.CrashReport.Models" Version="13.0.0.48" />
<PackageReference Include="BUTR.CrashReport.Bannerlord.Parser" Version="13.0.0.48" />
<PackageReference Include="CsvHelper" Version="31.0.0" />
<PackageReference Include="Blazorise.Bootstrap5" Version="1.5.0" />
<PackageReference Include="Blazorise.Charts" Version="1.5.0" />
<PackageReference Include="Blazorise.Components" Version="1.5.0" />
<PackageReference Include="Blazorise.DataGrid" Version="1.5.0" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="1.5.0" />
<PackageReference Include="Blazorise.LoadingIndicator" Version="1.5.0" />
<PackageReference Include="Blazorise.QRCode" Version="1.5.0" />
<PackageReference Include="Blazorise.Snackbar" Version="1.5.0" />
<PackageReference Include="Blazorise.TreeView" Version="1.5.0" />
<PackageReference Include="BUTR.CrashReport.Models" Version="13.0.0.49" />
<PackageReference Include="BUTR.CrashReport.Bannerlord.Parser" Version="13.0.0.49" />
<PackageReference Include="CsvHelper" Version="31.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.3" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Mono.Cecil" Version="0.11.5" />
Expand Down
2 changes: 1 addition & 1 deletion src/BUTR.Site.NexusMods.Client/Models/DemoUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static string GetException(ExceptionModel? exception, bool inner = false) => exc
var report = new CrashReportModel2(
id: cr.Id,
version: cr.Version,
gameVersion: cr.GameVersion,
gameVersion: cr.Metadata.GameVersion,
exceptionType: cr.Exception.Type,
exception: GetException(cr.Exception),
date: DateTimeOffset.UtcNow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
<PackageReference Include="Vogen" Version="3.0.24" />
<PackageReference Include="Vogen" Version="3.0.25-beta.1" />
</ItemGroup>

<ItemGroup>
Expand Down
23 changes: 11 additions & 12 deletions src/BUTR.Site.NexusMods.Server/BUTR.Site.NexusMods.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@

<ItemGroup>
<PackageReference Include="Aragas.Extensions.Options.FluentValidation" Version="1.1.0.14" />
<PackageReference Include="AsmResolver.DotNet" Version="5.5.0" />
<PackageReference Include="AsmResolver.DotNet" Version="5.5.1" />
<PackageReference Include="Bannerlord.ModuleManager" Version="5.0.221" />
<PackageReference Include="BUTR.Authentication.NexusMods" Version="1.0.0.6" />
<PackageReference Include="BUTR.CrashReport.Models" Version="13.0.0.48" />
<PackageReference Include="BUTR.CrashReport.Bannerlord.Parser" Version="13.0.0.48" />
<PackageReference Include="BUTR.CrashReport.Models" Version="13.0.0.49" />
<PackageReference Include="BUTR.CrashReport.Bannerlord.Parser" Version="13.0.0.49" />
<PackageReference Include="Community.Microsoft.Extensions.Caching.PostgreSql" Version="4.0.4" />
<PackageReference Include="CsvHelper" Version="31.0.0" />
<PackageReference Include="CsvHelper" Version="31.0.2" />
<PackageReference Include="ICSharpCode.Decompiler" Version="8.2.0.7535" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.3" />
<PackageReference Include="Nerdbank.Streams" Version="2.10.72" />
<PackageReference Include="Npgsql" Version="8.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageReference Include="Npgsql.OpenTelemetry" Version="8.0.2" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.8.0-beta.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.8.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.7.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.10" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.7.0-beta.1" />
Expand All @@ -46,7 +46,7 @@
<PackageReference Include="OpenTelemetry.Instrumentation.Quartz" Version="1.0.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.ResourceDetectors.Container" Version="1.0.0-beta.6" />
<PackageReference Include="Polly" Version="8.3.0" />
<PackageReference Include="Polly" Version="8.3.1" />
<PackageReference Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageReference Include="Quartz" Version="3.8.1" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.8.1" />
Expand All @@ -56,11 +56,10 @@
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.OpenTelemetry" Version="2.0.0-dev-00270" />
<PackageReference Include="SharpCompress" Version="0.36.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
<PackageReference Include="Z.EntityFramework.Extensions.EFCore" Version="8.102.1" />
<PackageReference Include="Z.EntityFramework.Extensions.EFCore" Version="8.102.2.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static bool GetTypeLoadExceptionLevel(ExceptionModel? exceptionModel, ref int le
var involvedModule = crashReport.InvolvedModules[level];
yield return new ModuleSuggestedFix
{
ModuleId = involvedModule.ModuleId,
ModuleId = involvedModule.ModuleOrLoaderPluginId,
Type = ModuleSuggestedFixType.Update,
};
}
Expand All @@ -106,17 +106,17 @@ private async IAsyncEnumerable<ModuleUpdate> GetModuleUpdatesForBannerlordAsync(
{
await Task.Yield();

if (!ApplicationVersion.TryParse(crashReport.GameVersion, out var gVersion)) yield break;
if (!ApplicationVersion.TryParse(crashReport.Metadata.GameVersion, out var gVersion)) yield break;

var moduleIds = crashReport.Modules.Where(x => !x.IsOfficial && string.IsNullOrEmpty(x.Url) && string.IsNullOrEmpty(x.UpdateInfo))
var moduleIds = crashReport.Modules.Where(x => !x.IsOfficial && string.IsNullOrEmpty(x.Url) && x.UpdateInfo is null)
.Select(x => ModuleId.From(x.Id)).ToArray();
var nexusModsIds = crashReport.Modules.Where(x => !x.IsOfficial && !string.IsNullOrEmpty(x.Url))
.Select(x => NexusModsModId.TryParseUrl(x.Url, out var modId) ? modId : NexusModsModId.None)
.Where(x => x != NexusModsModId.None).ToArray();
var nexusModsIds2 = crashReport.Modules.Where(x => !x.IsOfficial && !string.IsNullOrEmpty(x.Url))
.Select(x => new { ModuelId = ModuleId.From(x.Id), NexusModsId = NexusModsModId.From(NexusModsUtils.TryParse(x.Url, out _, out var id) ? (int) id : -1) })
.Where(x => x.NexusModsId != NexusModsModId.None).ToArray();
var updateInfos = crashReport.Modules.Where(x => !x.IsOfficial && !string.IsNullOrEmpty(x.UpdateInfo))
var updateInfos = crashReport.Modules.Where(x => !x.IsOfficial && x.UpdateInfo is not null)
.Select(x => new { ModuleId = ModuleId.From(x.Id), x.UpdateInfo }).ToArray();
var moduleIdVersions = crashReport.Modules
.Where(x => !x.IsOfficial).Select(x => new { ModuleId = ModuleId.From(x.Id), Version = ModuleVersion.From(x.Version) }).ToArray();
Expand Down Expand Up @@ -166,7 +166,7 @@ private async IAsyncEnumerable<ModuleUpdate> GetModuleUpdatesForBannerlordAsync(
{
ModuleId = x.ModuleId.Value,
ModuleVersion = x.ModuleVersion.ToString(),
IsModuleInvolved = crashReport.InvolvedModules.Any(y => y.ModuleId == x.ModuleId)
IsModuleInvolved = crashReport.InvolvedModules.Any(y => y.ModuleOrLoaderPluginId == x.ModuleId)
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public RecreateStacktraceController(ILogger<RecreateStacktraceController> logger
if (!CrashReportParser.TryParse(crashReportContent, out var version, out var crashReport, out var json))
return ApiBadRequest("Invalid crash report!");

var gameVersion = crashReport.GameVersion;
var gameVersion = crashReport.Metadata.GameVersion;

var assemblyFiles = await _steamBinaryCache.GetBranchAssemblyFilesAsync(gameVersion, ct);
var recreatedStacktrace = RecreateStacktraceUtils.GetRecreatedStacktraceUnordered(assemblyFiles, crashReport, ct).ToList();
Expand Down Expand Up @@ -93,7 +93,7 @@ public async Task<ActionResult<string>> HtmlAsync(CrashReportFileId id, Cancella
if (!CrashReportParser.TryParse(crashReportContent, out var version, out var crashReport, out var json))
return BadRequest();

var gameVersion = crashReport.GameVersion;
var gameVersion = crashReport.Metadata.GameVersion;

var assemblyFiles = await _steamBinaryCache.GetBranchAssemblyFilesAsync(gameVersion, ct);
var recreatedStacktrace = RecreateStacktraceUtils.GetRecreatedStacktraceUnordered(assemblyFiles, crashReport, ct).ToList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class ListExtensions
/// <param name="instance">The list to search.</param>
/// <param name="itemKey">The key to search for.</param>
/// <param name="keySelector">A function to extract a key from an element.</param>
/// <returns>The zero-based index of item in the sorted List<T>, if item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, the bitwise complement of Count.</returns>
/// <returns>The zero-based index of item in the sorted List{T}, if item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, the bitwise complement of Count.</returns>

public static int BinarySearch<T, TKey>(this IList<T> instance, TKey itemKey, Func<T, TKey> keySelector) where TKey : IComparable<TKey>, IComparable
{
Expand Down
9 changes: 3 additions & 6 deletions src/BUTR.Site.NexusMods.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host
options.WaitForJobsToComplete = true;
});

var oltpSection = ctx.Configuration.GetSection("Oltp");
if (oltpSection != null!)
if (ctx.Configuration.GetSection("Oltp") is { } oltpSection)
{
var openTelemetry = services.AddOpenTelemetry()
.ConfigureResource(builder =>
Expand All @@ -101,8 +100,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host
builder.AddTelemetrySdk();
});

var metricsEndpoint = oltpSection.GetValue<string?>("MetricsEndpoint");
if (metricsEndpoint is not null)
if (oltpSection.GetValue<string?>("MetricsEndpoint") is { } metricsEndpoint)
{
var metricsProtocol = oltpSection.GetValue<OtlpExportProtocol>("MetricsProtocol");
openTelemetry.WithMetrics(builder => builder
Expand All @@ -120,8 +118,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host
}));
}

var tracingEndpoint = oltpSection.GetValue<string?>("TracingEndpoint");
if (tracingEndpoint is not null)
if (oltpSection.GetValue<string?>("TracingEndpoint") is { } tracingEndpoint)
{
var tracingProtocol = oltpSection.GetValue<OtlpExportProtocol>("TracingProtocol");
openTelemetry.WithTracing(builder => builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"launchBrowser": false,
"launchUrl": "swagger"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private async Task<int> WriteCrashReportsToDatabaseAsync(CancellationToken ct)
CrashReportId = crashReportId,
Url = CrashReportUrl.From(new Uri(new Uri(_options.Endpoint), fileId.ToString())),
Version = CrashReportVersion.From(report.Version),
GameVersion = GameVersion.From(report.GameVersion),
GameVersion = GameVersion.From(report.Metadata.GameVersion),
ExceptionType = entityFactory.GetOrCreateExceptionType(ExceptionTypeId.From(report.Exception.Type)),
Exception = GetException(report.Exception),
CreatedAt = fileId.Value.Length == 8 ? DateTimeOffset.UnixEpoch.ToUniversalTime() : date.ToUniversalTime(),
Expand All @@ -277,7 +277,7 @@ private async Task<int> WriteCrashReportsToDatabaseAsync(CancellationToken ct)
Module = entityFactory.GetOrCreateModule(ModuleId.From(x.Id)),
Version = ModuleVersion.From(x.Version),
NexusModsMod = NexusModsModId.TryParseUrl(x.Url, out var modId) ? entityFactory.GetOrCreateNexusModsMod(modId) : null,
IsInvolved = report.InvolvedModules.Any(y => y.ModuleId == x.Id),
IsInvolved = report.InvolvedModules.Any(y => y.ModuleOrLoaderPluginId == x.Id),
}));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public interface ICrashReporterClient
{
Task<string> GetCrashReportAsync(CrashReportFileId id, CancellationToken ct);
Task<CrashReportModel?> GetCrashReportModelAsync(CrashReportFileId id, CancellationToken ct);
IAsyncEnumerable<CrashReportFileMetadata?> GetNewCrashReportMetadatasAsync(DateTime dateTime, [EnumeratorCancellation] CancellationToken ct);
IAsyncEnumerable<CrashReportFileMetadata?> GetCrashReportMetadatasAsync(IEnumerable<CrashReportFileId> filenames, [EnumeratorCancellation] CancellationToken ct);
IAsyncEnumerable<CrashReportFileMetadata?> GetNewCrashReportMetadatasAsync(DateTime dateTime, CancellationToken ct);
IAsyncEnumerable<CrashReportFileMetadata?> GetCrashReportMetadatasAsync(IEnumerable<CrashReportFileId> filenames, CancellationToken ct);
}

public sealed class CrashReporterClient : ICrashReporterClient
Expand Down

0 comments on commit b0d9763

Please sign in to comment.