forked from chrislee0419/EnhancedSearchAndFilters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPluginConfig.cs
124 lines (115 loc) · 4.25 KB
/
PluginConfig.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
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
using System;
using BS_Utils.Utilities;
namespace EnhancedSearchAndFilters
{
internal static class PluginConfig
{
static private readonly Config config = new Config("EnhancedSearchAndFilters");
/// <summary>
/// The maximum number of songs that can be displayed as an intermediate search result.
/// </summary>
static public int MaxSearchResults
{
get
{
int value = config.GetInt("EnhancedSearchAndFilters", "MaxSearchResults", MaxSearchResultsDefaultValue, true);
return Math.Min(Math.Max(value, MaxSearchResultsMinValue), MaxSearchResultsMaxValue);
}
set
{
config.SetInt("EnhancedSearchAndFilters", "MaxSearchResults", value);
}
}
public const int MaxSearchResultsDefaultValue = 14;
public const int MaxSearchResultsMaxValue = 28;
public const int MaxSearchResultsMinValue = 7;
/// <summary>
/// Determine whether to strip symbols from song details when performing a search
/// </summary>
static public bool StripSymbols
{
get
{
return config.GetBool("EnhancedSearchAndFilters", "StripSymbolsFromSearch", StripSymbolsDefaultValue, true);
}
set
{
config.SetBool("EnhancedSearchAndFilters", "StripSymbolsFromSearch", value);
}
}
public const bool StripSymbolsDefaultValue = true;
/// <summary>
/// Determine whether to query each word independently (A word is any cluster of characters separated by a space)
/// </summary>
static public bool SplitQueryByWords
{
get
{
return config.GetBool("EnhancedSearchAndFilters", "SplitQueryByWords", SplitQueryByWordsDefaultValue, true);
}
set
{
config.SetBool("EnhancedSearchAndFilters", "SplitQueryByWords", value);
}
}
public const bool SplitQueryByWordsDefaultValue = true;
/// <summary>
/// Determine which parts of a beatmap's details to search
/// </summary>
static public SearchableSongFields SongFieldsToSearch
{
get
{
int value = config.GetInt("EnhancedSearchAndFilters", "SongFieldsToSearch", (int)SongFieldsToSearchDefaultValue, true);
return Enum.IsDefined(typeof(SearchableSongFields), value) ? (SearchableSongFields)value : SongFieldsToSearchDefaultValue;
}
set
{
config.SetInt("EnhancedSearchAndFilters", "SongFieldsToSearch", (int)value);
}
}
public const SearchableSongFields SongFieldsToSearchDefaultValue = SearchableSongFields.All;
/// <summary>
/// Use the compact, single-screen keyboard in the search screen.
/// </summary>
static public bool CompactSearchMode
{
get
{
return config.GetBool("EnhancedSearchAndFilters", "CompactSearchMode", CompactSearchModeDefaultValue, true);
}
set
{
config.SetBool("EnhancedSearchAndFilters", "CompactSearchMode", value);
}
}
public const bool CompactSearchModeDefaultValue = false;
/// <summary>
/// The number of songs to search through in one frame. This setting is not exposed in the UI and can only be edited in the config.
/// </summary>
static public int MaxSongsToSearchInOneFrame
{
get
{
return config.GetInt("EnhancedSearchAndFilters", "MaxSongsToSearchInOneFrame", 100, true);
}
}
static public bool ShowFirstTimeLoadingText
{
get
{
return config.GetBool("EnhancedSearchAndFilters", "ShowFirstTimeLoadingText", true, true);
}
set
{
config.SetBool("EnhancedSearchAndFilters", "ShowFirstTimeLoadingText", value);
}
}
}
internal enum SearchableSongFields
{
All = 0,
TitleAndAuthor = 1,
TitleOnly = 2
}
}