Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/LageBuch.App/Services/SystemAlarmService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private void PlayBlocking(AlarmSound sound, byte[] bytes)
}
}

[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[DllImport("winmm.dll", CharSet = CharSet.Auto)]
private static extern bool PlaySound(byte[]? data, IntPtr hModule, uint flags);
}
2 changes: 1 addition & 1 deletion src/LageBuch.AppLogic/Services/IncidentStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace LageBuch.AppLogic.Services;

public sealed class IncidentStore : IIncidentStore
{
private readonly IIncidentFileStore _fileStore = new IncidentFileStore();
private readonly IncidentFileStore _fileStore = new IncidentFileStore();

public void Save(string path, Incident incident) => IncidentRepository.Save(path, incident);

Expand Down
12 changes: 6 additions & 6 deletions src/LageBuch.AppLogic/ViewModels/FilesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ private async Task OpenFileAsync(IncidentFileRow row)

// Mirrors IncidentFile.AllowedContentTypes' extensions — the picker already restricts choice to
// these, this just maps the chosen local path back to the MIME type the domain expects.
private static string ContentTypeFor(string path) => Path.GetExtension(path).ToLowerInvariant() switch
private static string ContentTypeFor(string path) => Path.GetExtension(path).ToUpperInvariant() switch
{
".jpg" or ".jpeg" => "image/jpeg",
".png" => "image/png",
".gif" => "image/gif",
".webp" => "image/webp",
".pdf" => "application/pdf",
".JPG" or ".JPEG" => "image/jpeg",
".PNG" => "image/png",
".GIF" => "image/gif",
".WEBP" => "image/webp",
".PDF" => "application/pdf",
_ => "application/octet-stream"
};
}
4 changes: 2 additions & 2 deletions src/LageBuch.AppLogic/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public MainWindowViewModel(HomeViewModel home, MasterDataEditorViewModel editor,
// away (IncidentWorkspaceViewModel.GoHomeRequested). LeaveAsync is a no-op for a local session.
private void ShowWorkspace(IncidentWorkspaceViewModel ws)
{
ws.GoHomeRequested = () =>
ws.GoHomeRequested = async () =>
{
_ = ws.LeaveAsync();
await ws.LeaveAsync();
CurrentView = _home;
};
CurrentView = ws;
Expand Down
2 changes: 1 addition & 1 deletion src/LageBuch.Domain/Atemschutz/AtemschutzTrupp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public static bool IsLpaTrupp(string designation) =>
public static int RequiredMemberCount(string designation) =>
IsChemicalTrupp(designation) ? ChemicalMemberCount : StandardMemberCount;

private static void ValidateCrew(string designation, IReadOnlyList<TruppMember> crew)
private static void ValidateCrew(string designation, List<TruppMember> crew)
{
// Atemschutz is never a solo activity -- a Trupp is the unit that goes under air together,
// and the monitoring sheet has no concept of a single wearer. Enforcing the count here
Expand Down
12 changes: 7 additions & 5 deletions src/LageBuch.Persistence/MasterData/MasterDataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ public sealed record MasterDataSet(
/// </summary>
public static class MasterDataJson
{
private static readonly JsonSerializerOptions ExportOptions = new()
{
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
};

public static MasterDataSet Parse(Stream json)
{
using var doc = JsonDocument.Parse(json);
Expand Down Expand Up @@ -400,10 +406,6 @@ public static string Serialize(MasterDataSet set)
},
};

return JsonSerializer.Serialize(model, new JsonSerializerOptions
{
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
});
return JsonSerializer.Serialize(model, ExportOptions);
}
}
2 changes: 1 addition & 1 deletion src/LageBuch.Persistence/MasterData/MasterDataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private static void InsertChecklistTemplate(
}
}

private static IEnumerable<(string Key, int Value)> SettingsRows(IncidentSettings s) => new[]
private static (string Key, int Value)[] SettingsRows(IncidentSettings s) => new[]
{
("ils_reminder_interval_minutes", s.IlsReminderIntervalMinutes),
("ils_reminder_follow_up_interval_minutes", s.IlsReminderFollowUpIntervalMinutes),
Expand Down
2 changes: 2 additions & 0 deletions src/LageBuch.Sync/SyncCommand.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
using LageBuch.Domain.CoMeasurement;
using LageBuch.Domain.Etb;
Expand Down Expand Up @@ -113,6 +114,7 @@ public sealed record CloseIncidentCommand(OperatorDto Operator) : SyncCommand;

// Bytes ride this one-shot upload command (System.Text.Json base64-encodes byte[] automatically),
// but never the broadcast snapshot that follows every command — see IncidentSnapshot/IncidentFileDto.
[SuppressMessage("Performance", "CA1819", Justification = "byte[] is the wire representation System.Text.Json base64-encodes; a read-only wrapper would need a custom converter.")]
public sealed record AddFileCommand(OperatorDto Operator, string FileName, string ContentType, byte[] Bytes) : SyncCommand;

// No operator on the wire: renaming is a silent label correction (no ETB entry), unlike every
Expand Down
Loading