Archive meeting workflow and screenshot changes

This commit is contained in:
2026-05-27 12:55:19 +02:00
parent 2422236ef7
commit 12832dde84
48 changed files with 3041 additions and 43 deletions
@@ -11,11 +11,27 @@ public interface ILaunchProfileOptionsProvider
public sealed record LaunchProfile(string Name, MeetingAssistantOptions Options);
public sealed record LaunchProfileHotkey(string ProfileName, string Toggle);
public enum LaunchProfileHotkeyAction
{
ToggleRecording,
AbortRecording,
CaptureScreenshot
}
public sealed record LaunchProfileHotkey(
string ProfileName,
string Hotkey,
LaunchProfileHotkeyAction Action);
public sealed class ConfigurationLaunchProfileOptionsProvider : ILaunchProfileOptionsProvider
{
public const string DefaultProfileName = "default";
private static readonly HotkeyDescriptor[] HotkeyDescriptors =
[
new("Hotkey:Toggle", options => options.Hotkey.Toggle, LaunchProfileHotkeyAction.ToggleRecording),
new("Hotkey:Abort", options => options.Hotkey.Abort, LaunchProfileHotkeyAction.AbortRecording),
new("Screenshots:Hotkey", options => options.Screenshots.Hotkey, LaunchProfileHotkeyAction.CaptureScreenshot)
];
private readonly IConfiguration configuration;
@@ -47,25 +63,47 @@ public sealed class ConfigurationLaunchProfileOptionsProvider : ILaunchProfileOp
public IReadOnlyList<LaunchProfileHotkey> GetHotkeys()
{
var hotkeys = GetProfileNames()
.Select(profileName =>
{
var profile = GetRequiredProfile(profileName);
return new LaunchProfileHotkey(profile.Name, profile.Options.Hotkey.Toggle);
})
.Where(hotkey => !string.IsNullOrWhiteSpace(hotkey.Toggle))
.SelectMany(CreateHotkeys)
.ToList();
var duplicate = hotkeys
.GroupBy(hotkey => hotkey.Toggle.Trim(), StringComparer.OrdinalIgnoreCase)
.GroupBy(hotkey => hotkey.Hotkey.Trim(), StringComparer.OrdinalIgnoreCase)
.FirstOrDefault(group => group.Count() > 1);
if (duplicate is not null)
{
throw new InvalidOperationException(
$"Launch profile hotkey '{duplicate.Key}' is configured more than once for profiles {string.Join(", ", duplicate.Select(hotkey => hotkey.ProfileName))}.");
$"Launch profile hotkey '{duplicate.Key}' is configured more than once for profiles {string.Join(", ", duplicate.Select(hotkey => $"{hotkey.ProfileName}:{hotkey.Action}"))}.");
}
return hotkeys;
}
private IEnumerable<LaunchProfileHotkey> CreateHotkeys(string profileName)
{
var profile = GetRequiredProfile(profileName);
var isDefaultProfile = profileName.Equals(DefaultProfileName, StringComparison.OrdinalIgnoreCase);
var profileSection = isDefaultProfile
? null
: GetProfilesSection().GetSection(profileName);
foreach (var descriptor in HotkeyDescriptors)
{
var hotkey = descriptor.GetValue(profile.Options);
if (ShouldRegisterHotkey(isDefaultProfile, profileSection?.GetSection(descriptor.SectionPath)) &&
!string.IsNullOrWhiteSpace(hotkey))
{
yield return new LaunchProfileHotkey(
profile.Name,
hotkey,
descriptor.Action);
}
}
}
private static bool ShouldRegisterHotkey(bool isDefaultProfile, IConfigurationSection? profileHotkeySection)
{
return isDefaultProfile || profileHotkeySection?.Exists() == true;
}
private IReadOnlyList<string> GetProfileNames()
{
return new[] { DefaultProfileName }
@@ -150,4 +188,9 @@ public sealed class ConfigurationLaunchProfileOptionsProvider : ILaunchProfileOp
.Select(value => value!.Value)
.ToArray();
}
private sealed record HotkeyDescriptor(
string SectionPath,
Func<MeetingAssistantOptions, string> GetValue,
LaunchProfileHotkeyAction Action);
}