File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -270,7 +270,8 @@ int GetIndex(Vector3 position)
270270 }
271271
272272 string first160BytesOfSTLFile = System . Text . Encoding . UTF8 . GetString ( first160Bytes , startOfString , first160Bytes . Length - startOfString ) ;
273- if ( first160BytesOfSTLFile . StartsWith ( "solid" ) && first160BytesOfSTLFile . Contains ( "facet" ) )
273+ if ( first160BytesOfSTLFile . StartsWith ( "solid" , StringComparison . OrdinalIgnoreCase )
274+ && first160BytesOfSTLFile . IndexOf ( "facet" , StringComparison . OrdinalIgnoreCase ) >= 0 )
274275 {
275276 stlStream . Position = 0 ;
276277 var stlReader = new StreamReader ( stlStream ) ;
@@ -283,7 +284,7 @@ int GetIndex(Vector3 position)
283284 while ( line != null )
284285 {
285286 line = line . Trim ( ) ;
286- if ( line . StartsWith ( "vertex" ) )
287+ if ( line . StartsWith ( "vertex" , StringComparison . OrdinalIgnoreCase ) )
287288 {
288289 vectorIndex ++ ;
289290 switch ( vectorIndex )
@@ -341,7 +342,7 @@ int GetIndex(Vector3 position)
341342 long bytesForAttributs = numTriangles * 2 ;
342343 currentPosition += 4 ;
343344 long numBytesRequiredForVertexData = currentPosition + bytesForNormals + bytesForVertices + bytesForAttributs ;
344- if ( fileContents . Length < numBytesRequiredForVertexData || numTriangles < 4 )
345+ if ( fileContents . Length < numBytesRequiredForVertexData || numTriangles < 1 )
345346 {
346347 stlStream . Close ( ) ;
347348 return null ;
You can’t perform that action at this time.
0 commit comments