-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControllerCompatibilitySettings.cs
More file actions
140 lines (123 loc) · 3.98 KB
/
ControllerCompatibilitySettings.cs
File metadata and controls
140 lines (123 loc) · 3.98 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
using Playnite.SDK;
using System.Collections.Generic;
using System.ComponentModel;
namespace ControllerCompatibility
{
public class ControllerCompatibilitySettings : System.Collections.Generic.ObservableObject, Playnite.SDK.ISettings
{
private bool showControllerStatus = true;
private bool showCompatibilityWarnings = true;
private bool autoDetectCompatibility = true;
private bool enableCommunityDatabase = true;
private bool autoDetectionCompleted = false;
private int controllerCheckInterval = 1000;
private List<string> ignoredGames = new List<string>();
public bool ShowControllerStatus
{
get => showControllerStatus;
set
{
showControllerStatus = value;
OnPropertyChanged();
}
}
public bool ShowCompatibilityWarnings
{
get => showCompatibilityWarnings;
set
{
showCompatibilityWarnings = value;
OnPropertyChanged();
}
}
public bool AutoDetectCompatibility
{
get => autoDetectCompatibility;
set
{
autoDetectCompatibility = value;
OnPropertyChanged();
}
}
public bool EnableCommunityDatabase
{
get => enableCommunityDatabase;
set
{
enableCommunityDatabase = value;
OnPropertyChanged();
}
}
public bool AutoDetectionCompleted
{
get => autoDetectionCompleted;
set
{
autoDetectionCompleted = value;
OnPropertyChanged();
}
}
public int ControllerCheckInterval
{
get => controllerCheckInterval;
set
{
controllerCheckInterval = value;
OnPropertyChanged();
}
}
public List<string> IgnoredGames
{
get => ignoredGames;
set
{
ignoredGames = value;
OnPropertyChanged();
}
}
// Parameterless constructor for serialization
public ControllerCompatibilitySettings()
{
}
// Constructor for plugin initialization
public ControllerCompatibilitySettings(ControllerCompatibilityPlugin plugin)
{
var savedSettings = plugin.LoadPluginSettings<ControllerCompatibilitySettings>();
if (savedSettings != null)
{
ShowControllerStatus = savedSettings.ShowControllerStatus;
ShowCompatibilityWarnings = savedSettings.ShowCompatibilityWarnings;
AutoDetectCompatibility = savedSettings.AutoDetectCompatibility;
EnableCommunityDatabase = savedSettings.EnableCommunityDatabase;
AutoDetectionCompleted = savedSettings.AutoDetectionCompleted;
ControllerCheckInterval = savedSettings.ControllerCheckInterval;
IgnoredGames = savedSettings.IgnoredGames ?? new List<string>();
}
}
public void BeginEdit()
{
// Called when settings editing starts
}
public void CancelEdit()
{
// Called when settings editing is cancelled
}
public void EndEdit()
{
// Called when settings editing ends
}
public bool VerifySettings(out List<string> errors)
{
errors = new List<string>();
if (ControllerCheckInterval < 100)
{
errors.Add("Controller check interval must be at least 100ms");
}
if (ControllerCheckInterval > 10000)
{
errors.Add("Controller check interval should not exceed 10 seconds");
}
return errors.Count == 0;
}
}
}