@@ -127,10 +127,10 @@ internal FileContent(ILogger logger,
127127 public FileContent ( ILogger logger , IEnumerable < string > files ) : this ( logger , files , new UnsafeFileReader ( ) )
128128 { }
129129
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 )
131131 {
132132 var match = input . Slice ( valueMatch . Index , valueMatch . Length ) ;
133- var includeIndex = match . IndexOf ( groupPrefix , StringComparison . InvariantCultureIgnoreCase ) ;
133+ var includeIndex = match . IndexOf ( groupPrefix , StringComparison . OrdinalIgnoreCase ) ;
134134 if ( includeIndex == - 1 )
135135 {
136136 return string . Empty ;
@@ -141,22 +141,15 @@ private static string GetGroup(ReadOnlySpan<char> input, ValueMatch valueMatch,
141141 var quoteIndex1 = match . IndexOf ( "\" " ) ;
142142 var quoteIndex2 = match . Slice ( quoteIndex1 + 1 ) . IndexOf ( "\" " ) ;
143143
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 ( ) ;
152145 }
153146
154147 private static bool IsGroupMatch ( ReadOnlySpan < char > line , Regex regex , string groupPrefix , string value )
155148 {
156149 foreach ( var valueMatch in regex . EnumerateMatches ( line ) )
157150 {
158151 // 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 ) )
160153 {
161154 return true ;
162155 }
@@ -172,12 +165,11 @@ private void DoInitialize()
172165 {
173166 foreach ( ReadOnlySpan < char > line in unsafeFileReader . ReadLines ( file ) )
174167 {
175-
176168 // Find all the packages.
177169 foreach ( var valueMatch in PackageReference ( ) . EnumerateMatches ( line ) )
178170 {
179171 // 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 ( ) ;
181173 if ( ! string . IsNullOrEmpty ( packageName ) )
182174 {
183175 allPackages . Add ( packageName ) ;
@@ -189,24 +181,23 @@ private void DoInitialize()
189181 || IsGroupMatch ( line , ProjectSdk ( ) , "Sdk" , "Microsoft.NET.Sdk.Web" )
190182 || IsGroupMatch ( line , FrameworkReference ( ) , "Include" , "Microsoft.AspNetCore.App" ) ;
191183
192-
193184 // Determine if implicit usings are used.
194185 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 ) ;
197188
198189 // Determine if WPF is used.
199190 useWpf = useWpf
200- || line . Contains ( "<UseWPF>true</UseWPF>" . AsSpan ( ) , StringComparison . Ordinal ) ;
191+ || line . Contains ( "<UseWPF>true</UseWPF>" . AsSpan ( ) , StringComparison . OrdinalIgnoreCase ) ;
201192
202193 // Determine if Windows Forms is used.
203194 useWindowsForms = useWindowsForms
204- || line . Contains ( "<UseWindowsForms>true</UseWindowsForms>" . AsSpan ( ) , StringComparison . Ordinal ) ;
195+ || line . Contains ( "<UseWindowsForms>true</UseWindowsForms>" . AsSpan ( ) , StringComparison . OrdinalIgnoreCase ) ;
205196
206197 // Find all custom implicit usings.
207198 foreach ( var valueMatch in CustomImplicitUsingDeclarations ( ) . EnumerateMatches ( line ) )
208199 {
209- var ns = GetGroup ( line , valueMatch , "Include" , toLower : false ) ;
200+ var ns = GetGroup ( line , valueMatch , "Include" ) ;
210201 if ( ! string . IsNullOrEmpty ( ns ) )
211202 {
212203 implicitUsingNamespaces . Add ( ns ) ;
0 commit comments