|
1 | 1 | using System.Text.Json.Serialization; |
2 | 2 |
|
3 | | -namespace GhostDraw.Core |
| 3 | +namespace GhostDraw.Core; |
| 4 | + |
| 5 | +/// <summary> |
| 6 | +/// Application settings that persist across sessions |
| 7 | +/// </summary> |
| 8 | +public class AppSettings |
4 | 9 | { |
5 | 10 | /// <summary> |
6 | | - /// Application settings that persist across sessions |
| 11 | + /// Brush color in hex format (e.g., "#FF0000" for red) |
7 | 12 | /// </summary> |
8 | | - public class AppSettings |
9 | | - { |
10 | | - /// <summary> |
11 | | - /// Brush color in hex format (e.g., "#FF0000" for red) |
12 | | - /// </summary> |
13 | | - [JsonPropertyName("brushColor")] |
14 | | - public string BrushColor { get; set; } = "#FF0000"; |
| 13 | + [JsonPropertyName("brushColor")] |
| 14 | + public string BrushColor { get; set; } = "#FF0000"; |
15 | 15 |
|
16 | | - /// <summary> |
17 | | - /// Brush thickness in pixels |
18 | | - /// </summary> |
19 | | - [JsonPropertyName("brushThickness")] |
20 | | - public double BrushThickness { get; set; } = 3.0; |
| 16 | + /// <summary> |
| 17 | + /// Brush thickness in pixels |
| 18 | + /// </summary> |
| 19 | + [JsonPropertyName("brushThickness")] |
| 20 | + public double BrushThickness { get; set; } = 3.0; |
21 | 21 |
|
22 | | - /// <summary> |
23 | | - /// Minimum allowed brush thickness |
24 | | - /// </summary> |
25 | | - [JsonPropertyName("minBrushThickness")] |
26 | | - public double MinBrushThickness { get; set; } = 1.0; |
| 22 | + /// <summary> |
| 23 | + /// Minimum allowed brush thickness |
| 24 | + /// </summary> |
| 25 | + [JsonPropertyName("minBrushThickness")] |
| 26 | + public double MinBrushThickness { get; set; } = 1.0; |
27 | 27 |
|
28 | | - /// <summary> |
29 | | - /// Maximum allowed brush thickness |
30 | | - /// </summary> |
31 | | - [JsonPropertyName("maxBrushThickness")] |
32 | | - public double MaxBrushThickness { get; set; } = 20.0; |
| 28 | + /// <summary> |
| 29 | + /// Maximum allowed brush thickness |
| 30 | + /// </summary> |
| 31 | + [JsonPropertyName("maxBrushThickness")] |
| 32 | + public double MaxBrushThickness { get; set; } = 20.0; |
33 | 33 |
|
34 | | - /// <summary> |
35 | | - /// Virtual key codes for the hotkey combination |
36 | | - /// </summary> |
37 | | - [JsonPropertyName("hotkeyVirtualKeys")] |
38 | | - public List<int> HotkeyVirtualKeys { get; set; } = new() { 0xA2, 0xA4, 0x44 }; // Default: Ctrl+Alt+D |
| 34 | + /// <summary> |
| 35 | + /// Virtual key codes for the hotkey combination |
| 36 | + /// </summary> |
| 37 | + [JsonPropertyName("hotkeyVirtualKeys")] |
| 38 | + public List<int> HotkeyVirtualKeys { get; set; } = new() { 0xA2, 0xA4, 0x44 }; // Default: Ctrl+Alt+D |
39 | 39 |
|
40 | | - /// <summary> |
41 | | - /// Gets the user-friendly display name of the hotkey combination |
42 | | - /// (Computed property - not serialized) |
43 | | - /// </summary> |
44 | | - [JsonIgnore] |
45 | | - public string HotkeyDisplayName => Helpers.VirtualKeyHelper.GetCombinationDisplayName(HotkeyVirtualKeys); |
| 40 | + /// <summary> |
| 41 | + /// Gets the user-friendly display name of the hotkey combination |
| 42 | + /// (Computed property - not serialized) |
| 43 | + /// </summary> |
| 44 | + [JsonIgnore] |
| 45 | + public string HotkeyDisplayName => Helpers.VirtualKeyHelper.GetCombinationDisplayName(HotkeyVirtualKeys); |
46 | 46 |
|
47 | | - /// <summary> |
48 | | - /// If true, drawing mode locks on first hotkey press and unlocks on second press |
49 | | - /// If false, drawing mode is active only while hotkey is held down |
50 | | - /// </summary> |
51 | | - [JsonPropertyName("lockDrawingMode")] |
52 | | - public bool LockDrawingMode { get; set; } = false; |
| 47 | + /// <summary> |
| 48 | + /// If true, drawing mode locks on first hotkey press and unlocks on second press |
| 49 | + /// If false, drawing mode is active only while hotkey is held down |
| 50 | + /// </summary> |
| 51 | + [JsonPropertyName("lockDrawingMode")] |
| 52 | + public bool LockDrawingMode { get; set; } = false; |
53 | 53 |
|
54 | | - /// <summary> |
55 | | - /// Log level (Verbose, Debug, Information, Warning, Error, Fatal) |
56 | | - /// </summary> |
57 | | - [JsonPropertyName("logLevel")] |
58 | | - public string LogLevel { get; set; } = "Information"; |
| 54 | + /// <summary> |
| 55 | + /// Log level (Verbose, Debug, Information, Warning, Error, Fatal) |
| 56 | + /// </summary> |
| 57 | + [JsonPropertyName("logLevel")] |
| 58 | + public string LogLevel { get; set; } = "Information"; |
59 | 59 |
|
60 | | - /// <summary> |
61 | | - /// Available color palette for quick cycling |
62 | | - /// </summary> |
63 | | - [JsonPropertyName("colorPalette")] |
64 | | - public List<string> ColorPalette { get; set; } = new() |
65 | | - { |
66 | | - "#FF0000", // Red |
67 | | - "#00FF00", // Green |
68 | | - "#0000FF", // Blue |
69 | | - "#FFFF00", // Yellow |
70 | | - "#FF00FF", // Magenta |
71 | | - "#00FFFF", // Cyan |
72 | | - "#FFFFFF", // White |
73 | | - "#000000", // Black |
74 | | - "#FFA500", // Orange |
75 | | - "#800080" // Purple |
76 | | - }; |
| 60 | + /// <summary> |
| 61 | + /// Available color palette for quick cycling |
| 62 | + /// </summary> |
| 63 | + [JsonPropertyName("colorPalette")] |
| 64 | + public List<string> ColorPalette { get; set; } = new() |
| 65 | + { |
| 66 | + "#FF0000", // Red |
| 67 | + "#00FF00", // Green |
| 68 | + "#0000FF", // Blue |
| 69 | + "#FFFF00", // Yellow |
| 70 | + "#FF00FF", // Magenta |
| 71 | + "#00FFFF", // Cyan |
| 72 | + "#FFFFFF", // White |
| 73 | + "#000000", // Black |
| 74 | + "#FFA500", // Orange |
| 75 | + "#800080" // Purple |
| 76 | + }; |
77 | 77 |
|
78 | | - /// <summary> |
79 | | - /// Creates a deep copy of the settings |
80 | | - /// </summary> |
81 | | - public AppSettings Clone() |
| 78 | + /// <summary> |
| 79 | + /// Creates a deep copy of the settings |
| 80 | + /// </summary> |
| 81 | + public AppSettings Clone() |
| 82 | + { |
| 83 | + return new AppSettings |
82 | 84 | { |
83 | | - return new AppSettings |
84 | | - { |
85 | | - BrushColor = BrushColor, |
86 | | - BrushThickness = BrushThickness, |
87 | | - MinBrushThickness = MinBrushThickness, |
88 | | - MaxBrushThickness = MaxBrushThickness, |
89 | | - HotkeyVirtualKeys = new List<int>(HotkeyVirtualKeys), |
90 | | - LockDrawingMode = LockDrawingMode, |
91 | | - LogLevel = LogLevel, |
92 | | - ColorPalette = new List<string>(ColorPalette) |
93 | | - }; |
94 | | - } |
| 85 | + BrushColor = BrushColor, |
| 86 | + BrushThickness = BrushThickness, |
| 87 | + MinBrushThickness = MinBrushThickness, |
| 88 | + MaxBrushThickness = MaxBrushThickness, |
| 89 | + HotkeyVirtualKeys = new List<int>(HotkeyVirtualKeys), |
| 90 | + LockDrawingMode = LockDrawingMode, |
| 91 | + LogLevel = LogLevel, |
| 92 | + ColorPalette = new List<string>(ColorPalette) |
| 93 | + }; |
95 | 94 | } |
96 | 95 | } |
0 commit comments