@@ -17,7 +17,7 @@ public Search(RepositoryDataManager repoData, IUser user)
17
17
this . user = user ;
18
18
}
19
19
20
- public int RunCommand ( CKAN . GameInstance ksp , object raw_options )
20
+ public int RunCommand ( CKAN . GameInstance instance , object raw_options )
21
21
{
22
22
SearchOptions options = ( SearchOptions ) raw_options ;
23
23
@@ -32,11 +32,11 @@ public int RunCommand(CKAN.GameInstance ksp, object raw_options)
32
32
return Exit . BADOPT ;
33
33
}
34
34
35
- var matching_compatible = PerformSearch ( ksp , options . search_term , options . author_term , false ) ;
35
+ var matching_compatible = PerformSearch ( instance , options . search_term , options . author_term , false ) ;
36
36
var matching_incompatible = new List < CkanModule > ( ) ;
37
37
if ( options . all )
38
38
{
39
- matching_incompatible = PerformSearch ( ksp , options . search_term , options . author_term , true ) ;
39
+ matching_incompatible = PerformSearch ( instance , options . search_term , options . author_term , true ) ;
40
40
}
41
41
42
42
// Show how many matches we have.
@@ -94,10 +94,10 @@ public int RunCommand(CKAN.GameInstance ksp, object raw_options)
94
94
user . RaiseMessage ( Properties . Resources . SearchIncompatibleModsHeader ) ;
95
95
foreach ( CkanModule mod in matching_incompatible )
96
96
{
97
- CkanModule . GetMinMaxVersions ( new List < CkanModule > { mod } , out _ , out _ , out var minKsp , out var maxKsp ) ;
98
- var gv = GameVersionRange . VersionSpan ( ksp . game ,
99
- minKsp ?? GameVersion . Any ,
100
- maxKsp ?? GameVersion . Any )
97
+ CkanModule . GetMinMaxVersions ( new List < CkanModule > { mod } , out _ , out _ , out var mininstance , out var maxinstance ) ;
98
+ var gv = GameVersionRange . VersionSpan ( instance . game ,
99
+ mininstance ?? GameVersion . Any ,
100
+ maxinstance ?? GameVersion . Any )
101
101
. ToString ( ) ;
102
102
103
103
user . RaiseMessage ( Properties . Resources . SearchIncompatibleMod ,
@@ -125,15 +125,15 @@ public int RunCommand(CKAN.GameInstance ksp, object raw_options)
125
125
}
126
126
127
127
/// <summary>
128
- /// Searches for the term in the list of compatible or incompatible modules for the ksp instance.
128
+ /// Searches for the term in the list of compatible or incompatible modules for the instance instance.
129
129
/// Looks in name, identifier and description fields, and if given, restricts to authors matching the author term.
130
130
/// </summary>
131
131
/// <returns>List of matching modules.</returns>
132
- /// <param name="ksp ">The KSP instance to perform the search for.</param>
132
+ /// <param name="instance ">The instance instance to perform the search for.</param>
133
133
/// <param name="term">The search term. Case insensitive.</param>
134
134
/// <param name="author">Name of author to find</param>
135
135
/// <param name="searchIncompatible">True to look for incompatible modules, false (default) to look for compatible</param>
136
- public List < CkanModule > PerformSearch ( CKAN . GameInstance ksp ,
136
+ public List < CkanModule > PerformSearch ( CKAN . GameInstance instance ,
137
137
string ? term ,
138
138
string ? author = null ,
139
139
bool searchIncompatible = false )
@@ -142,11 +142,12 @@ public List<CkanModule> PerformSearch(CKAN.GameInstance ksp,
142
142
term = string . IsNullOrWhiteSpace ( term ) ? string . Empty : CkanModule . nonAlphaNums . Replace ( term , "" ) ;
143
143
author = string . IsNullOrWhiteSpace ( author ) ? string . Empty : CkanModule . nonAlphaNums . Replace ( author , "" ) ;
144
144
145
- var registry = RegistryManager . Instance ( ksp , repoData ) . registry ;
145
+ var registry = RegistryManager . Instance ( instance , repoData ) . registry ;
146
146
147
147
return searchIncompatible
148
148
? registry
149
- . IncompatibleModules ( ksp . VersionCriteria ( ) )
149
+ . IncompatibleModules ( instance . StabilityToleranceConfig ,
150
+ instance . VersionCriteria ( ) )
150
151
// Look for a match in each string.
151
152
. Where ( module => ( module . SearchableName . IndexOf ( term , StringComparison . OrdinalIgnoreCase ) > - 1
152
153
|| module . SearchableIdentifier . IndexOf ( term , StringComparison . OrdinalIgnoreCase ) > - 1
@@ -155,7 +156,8 @@ public List<CkanModule> PerformSearch(CKAN.GameInstance ksp,
155
156
&& module . SearchableAuthors . Any ( ( auth ) => auth . IndexOf ( author , StringComparison . OrdinalIgnoreCase ) > - 1 ) )
156
157
. ToList ( )
157
158
: registry
158
- . CompatibleModules ( ksp . VersionCriteria ( ) )
159
+ . CompatibleModules ( instance . StabilityToleranceConfig ,
160
+ instance . VersionCriteria ( ) )
159
161
// Look for a match in each string.
160
162
. Where ( module => ( module . SearchableName . IndexOf ( term , StringComparison . OrdinalIgnoreCase ) > - 1
161
163
|| module . SearchableIdentifier . IndexOf ( term , StringComparison . OrdinalIgnoreCase ) > - 1
@@ -190,9 +192,10 @@ private static string CaseInsensitiveExactMatch(List<CkanModule> mods, string mo
190
192
/// <param name="modules">List of strings to convert, format 'identifier' or 'identifier=version'</param>
191
193
public static void AdjustModulesCase ( CKAN . GameInstance instance , Registry registry , List < string > modules )
192
194
{
195
+ var stabilityTolerance = instance . StabilityToleranceConfig ;
193
196
// Get the list of all compatible and incompatible mods
194
- List < CkanModule > mods = registry . CompatibleModules ( instance . VersionCriteria ( ) ) . ToList ( ) ;
195
- mods . AddRange ( registry . IncompatibleModules ( instance . VersionCriteria ( ) ) ) ;
197
+ var mods = registry . CompatibleModules ( stabilityTolerance , instance . VersionCriteria ( ) ) . ToList ( ) ;
198
+ mods . AddRange ( registry . IncompatibleModules ( stabilityTolerance , instance . VersionCriteria ( ) ) ) ;
196
199
for ( int i = 0 ; i < modules . Count ; ++ i )
197
200
{
198
201
Match match = CkanModule . idAndVersionMatcher . Match ( modules [ i ] ) ;
0 commit comments