-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuickRatingsSettings.cs
61 lines (51 loc) · 2.16 KB
/
QuickRatingsSettings.cs
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
using Playnite.SDK;
using System.Collections.Generic;
namespace QuickRatings
{
public class QuickRatingsSettings : ISettings
{
private readonly QuickRatings plugin;
public bool IncludeHalfStars { get; set; } = false;
public bool AddStarsAsTags { get; set; } = false;
// Parameterless constructor must exist if you want to use LoadPluginSettings method.
public QuickRatingsSettings()
{
}
public QuickRatingsSettings(QuickRatings plugin)
{
// Injecting your plugin instance is required for Save/Load method because Playnite saves data to a location based on what plugin requested the operation.
this.plugin = plugin;
// Load saved settings.
var savedSettings = plugin.LoadPluginSettings<QuickRatingsSettings>();
// LoadPluginSettings returns null if not saved data is available.
if (savedSettings != null)
{
IncludeHalfStars = savedSettings.IncludeHalfStars;
AddStarsAsTags = savedSettings.AddStarsAsTags;
}
}
public void BeginEdit()
{
// Code executed when settings view is opened and user starts editing values.
}
public void CancelEdit()
{
// Code executed when user decides to cancel any changes made since BeginEdit was called.
// This method should revert any changes made to Option1 and Option2.
}
public void EndEdit()
{
// Code executed when user decides to confirm changes made since BeginEdit was called.
// This method should save settings made to Option1 and Option2.
plugin.SavePluginSettings(this);
}
public bool VerifySettings(out List<string> errors)
{
// Code execute when user decides to confirm changes made since BeginEdit was called.
// Executed before EndEdit is called and EndEdit is not called if false is returned.
// List of errors is presented to user if verification fails.
errors = new List<string>();
return true;
}
}
}