-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeybindingConfiguration.cs
More file actions
60 lines (51 loc) · 1.96 KB
/
Copy pathKeybindingConfiguration.cs
File metadata and controls
60 lines (51 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2023-2026 ktsu-dev contributors
namespace ktsu.Keybinding.Core.Models;
using ktsu.Keybinding.Core.Contracts;
/// <summary>
/// Default implementation of keybinding configuration
/// </summary>
public sealed class KeybindingConfiguration : IKeybindingConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="KeybindingConfiguration"/> class with default values
/// </summary>
public KeybindingConfiguration()
{
DataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Keybinding");
DefaultProfileId = "default";
DefaultProfileName = "Default";
AutoSave = true;
AutoSaveIntervalMilliseconds = 5000; // 5 seconds
}
/// <summary>
/// Initializes a new instance of the <see cref="KeybindingConfiguration"/> class with custom values
/// </summary>
/// <param name="dataDirectory">The data directory for storing keybinding files</param>
/// <param name="defaultProfileId">The default profile ID</param>
/// <param name="defaultProfileName">The default profile name</param>
/// <param name="autoSave">Whether to enable auto-save</param>
/// <param name="autoSaveIntervalMilliseconds">The auto-save interval in milliseconds</param>
public KeybindingConfiguration(
string dataDirectory,
string defaultProfileId = "default",
string defaultProfileName = "Default",
bool autoSave = true,
int autoSaveIntervalMilliseconds = 5000)
{
DataDirectory = Ensure.NotNull(dataDirectory);
DefaultProfileId = Ensure.NotNull(defaultProfileId);
DefaultProfileName = Ensure.NotNull(defaultProfileName);
AutoSave = autoSave;
AutoSaveIntervalMilliseconds = Math.Max(0, autoSaveIntervalMilliseconds);
}
/// <inheritdoc/>
public string DataDirectory { get; }
/// <inheritdoc/>
public string DefaultProfileId { get; }
/// <inheritdoc/>
public string DefaultProfileName { get; }
/// <inheritdoc/>
public bool AutoSave { get; }
/// <inheritdoc/>
public int AutoSaveIntervalMilliseconds { get; }
}