@@ -127,10 +127,10 @@ internal FileContent(ILogger logger,
127
127
public FileContent ( ILogger logger , IEnumerable < string > files ) : this ( logger , files , new UnsafeFileReader ( ) )
128
128
{ }
129
129
130
- private static string GetGroup ( ReadOnlySpan < char > input , ValueMatch valueMatch , string groupPrefix , bool toLower )
130
+ private static string GetGroup ( ReadOnlySpan < char > input , ValueMatch valueMatch , string groupPrefix )
131
131
{
132
132
var match = input . Slice ( valueMatch . Index , valueMatch . Length ) ;
133
- var includeIndex = match . IndexOf ( groupPrefix , StringComparison . InvariantCultureIgnoreCase ) ;
133
+ var includeIndex = match . IndexOf ( groupPrefix , StringComparison . OrdinalIgnoreCase ) ;
134
134
if ( includeIndex == - 1 )
135
135
{
136
136
return string . Empty ;
@@ -141,22 +141,15 @@ private static string GetGroup(ReadOnlySpan<char> input, ValueMatch valueMatch,
141
141
var quoteIndex1 = match . IndexOf ( "\" " ) ;
142
142
var quoteIndex2 = match . Slice ( quoteIndex1 + 1 ) . IndexOf ( "\" " ) ;
143
143
144
- var result = match . Slice ( quoteIndex1 + 1 , quoteIndex2 ) . ToString ( ) ;
145
-
146
- if ( toLower )
147
- {
148
- result = result . ToLowerInvariant ( ) ;
149
- }
150
-
151
- return result ;
144
+ return match . Slice ( quoteIndex1 + 1 , quoteIndex2 ) . ToString ( ) ;
152
145
}
153
146
154
147
private static bool IsGroupMatch ( ReadOnlySpan < char > line , Regex regex , string groupPrefix , string value )
155
148
{
156
149
foreach ( var valueMatch in regex . EnumerateMatches ( line ) )
157
150
{
158
151
// We can't get the group from the ValueMatch, so doing it manually:
159
- if ( GetGroup ( line , valueMatch , groupPrefix , toLower : true ) == value . ToLowerInvariant ( ) )
152
+ if ( string . Equals ( GetGroup ( line , valueMatch , groupPrefix ) , value , StringComparison . OrdinalIgnoreCase ) )
160
153
{
161
154
return true ;
162
155
}
@@ -172,12 +165,11 @@ private void DoInitialize()
172
165
{
173
166
foreach ( ReadOnlySpan < char > line in unsafeFileReader . ReadLines ( file ) )
174
167
{
175
-
176
168
// Find all the packages.
177
169
foreach ( var valueMatch in PackageReference ( ) . EnumerateMatches ( line ) )
178
170
{
179
171
// We can't get the group from the ValueMatch, so doing it manually:
180
- var packageName = GetGroup ( line , valueMatch , "Include" , toLower : true ) ;
172
+ var packageName = GetGroup ( line , valueMatch , "Include" ) . ToLowerInvariant ( ) ;
181
173
if ( ! string . IsNullOrEmpty ( packageName ) )
182
174
{
183
175
allPackages . Add ( packageName ) ;
@@ -189,24 +181,23 @@ private void DoInitialize()
189
181
|| IsGroupMatch ( line , ProjectSdk ( ) , "Sdk" , "Microsoft.NET.Sdk.Web" )
190
182
|| IsGroupMatch ( line , FrameworkReference ( ) , "Include" , "Microsoft.AspNetCore.App" ) ;
191
183
192
-
193
184
// Determine if implicit usings are used.
194
185
useImplicitUsings = useImplicitUsings
195
- || line . Contains ( "<ImplicitUsings>enable</ImplicitUsings>" . AsSpan ( ) , StringComparison . Ordinal )
196
- || line . Contains ( "<ImplicitUsings>true</ImplicitUsings>" . AsSpan ( ) , StringComparison . Ordinal ) ;
186
+ || line . Contains ( "<ImplicitUsings>enable</ImplicitUsings>" . AsSpan ( ) , StringComparison . OrdinalIgnoreCase )
187
+ || line . Contains ( "<ImplicitUsings>true</ImplicitUsings>" . AsSpan ( ) , StringComparison . OrdinalIgnoreCase ) ;
197
188
198
189
// Determine if WPF is used.
199
190
useWpf = useWpf
200
- || line . Contains ( "<UseWPF>true</UseWPF>" . AsSpan ( ) , StringComparison . Ordinal ) ;
191
+ || line . Contains ( "<UseWPF>true</UseWPF>" . AsSpan ( ) , StringComparison . OrdinalIgnoreCase ) ;
201
192
202
193
// Determine if Windows Forms is used.
203
194
useWindowsForms = useWindowsForms
204
- || line . Contains ( "<UseWindowsForms>true</UseWindowsForms>" . AsSpan ( ) , StringComparison . Ordinal ) ;
195
+ || line . Contains ( "<UseWindowsForms>true</UseWindowsForms>" . AsSpan ( ) , StringComparison . OrdinalIgnoreCase ) ;
205
196
206
197
// Find all custom implicit usings.
207
198
foreach ( var valueMatch in CustomImplicitUsingDeclarations ( ) . EnumerateMatches ( line ) )
208
199
{
209
- var ns = GetGroup ( line , valueMatch , "Include" , toLower : false ) ;
200
+ var ns = GetGroup ( line , valueMatch , "Include" ) ;
210
201
if ( ! string . IsNullOrEmpty ( ns ) )
211
202
{
212
203
implicitUsingNamespaces . Add ( ns ) ;
0 commit comments