@@ -372,9 +372,9 @@ private void DoConvert()
372372 {
373373 // Make sure we were passed in non-empty source and destination project
374374 // file names.
375- error . VerifyThrowArgument ( ( this . oldProjectFile != null ) && ( this . oldProjectFile . Length > 0 ) ,
375+ error . VerifyThrowArgument ( ! string . IsNullOrEmpty ( this . oldProjectFile ) ,
376376 "MissingOldProjectFile" ) ;
377- error . VerifyThrowArgument ( ( this . newProjectFile != null ) && ( this . newProjectFile . Length > 0 ) ,
377+ error . VerifyThrowArgument ( ! string . IsNullOrEmpty ( this . newProjectFile ) ,
378378 "MissingNewProjectFile" ) ;
379379
380380 ConvertInMemoryToMSBuildProject ( ) ;
@@ -425,7 +425,7 @@ private void ConvertInMemoryToMSBuildProject()
425425 {
426426 // Make sure we were passed in non-empty source and destination project
427427 // file names.
428- error . VerifyThrowArgument ( ( this . oldProjectFile != null ) && ( this . oldProjectFile . Length > 0 ) ,
428+ error . VerifyThrowArgument ( ! string . IsNullOrEmpty ( this . oldProjectFile ) ,
429429 "MissingOldProjectFile" ) ;
430430
431431 // Make sure the source project file exists.
@@ -1438,7 +1438,7 @@ XmlElementWithLocation visualStudioProjectElement
14381438 // to convert a VC++ or some other type of project, and give a more friendly
14391439 // error message.
14401440 string projectType = visualStudioProjectElement . GetAttribute ( VSProjectAttributes . projectType ) ;
1441- ProjectErrorUtilities . VerifyThrowInvalidProject ( ( projectType == null ) || ( projectType . Length == 0 ) ,
1441+ ProjectErrorUtilities . VerifyThrowInvalidProject ( string . IsNullOrEmpty ( projectType ) ,
14421442 visualStudioProjectElement . Location , "ProjectTypeCannotBeConverted" , projectType ) ;
14431443
14441444 // Make sure the <VisualStudioProject> tag doesn't have any attributes.
@@ -1518,8 +1518,8 @@ XmlElementWithLocation languageElement
15181518 // Get the project type for this project file. We only support "Local". We do not
15191519 // convert web projects -- that's Venus's job.
15201520 string projectType = languageElement . GetAttribute ( VSProjectAttributes . projectType ) ;
1521- ProjectErrorUtilities . VerifyThrowInvalidProject ( projectType == null || projectType . Length == 0 ||
1522- ( String . Equals ( projectType , VSProjectAttributes . local , StringComparison . OrdinalIgnoreCase ) ) ,
1521+ ProjectErrorUtilities . VerifyThrowInvalidProject ( string . IsNullOrEmpty ( projectType ) ||
1522+ ( String . Compare ( projectType , VSProjectAttributes . local , StringComparison . OrdinalIgnoreCase ) == 0 ) ,
15231523 languageElement . Location , "ProjectTypeCannotBeConverted" , projectType ) ;
15241524
15251525 // All of the attributes on the language tag get converted to XMake
@@ -1557,7 +1557,7 @@ XmlElementWithLocation languageElement
15571557 // -----------------------------------------------------------------------
15581558
15591559 string originalMyType = languageElement . GetAttribute ( XMakeProjectStrings . myType ) ;
1560- if ( ( originalMyType != null ) && ( originalMyType . Length != 0 ) )
1560+ if ( ! string . IsNullOrEmpty ( originalMyType ) )
15611561 {
15621562 // Flag the fact that the Everett project already had a MyType property in there,
15631563 // so we don't try to override it later.
@@ -1710,7 +1710,7 @@ private void AddFinalPropertiesAndImports(XmlElementWithLocation languageElement
17101710 ! isTriumphProject // Doesn't apply to Triumph->Trinity conversions.
17111711 )
17121712 {
1713- if ( this . outputType != null && this . outputType . Length > 0 )
1713+ if ( ! string . IsNullOrEmpty ( this . outputType ) )
17141714 {
17151715 if ( String . Equals ( this . outputType , XMakeProjectStrings . winExe , StringComparison . OrdinalIgnoreCase ) )
17161716 {
@@ -2070,7 +2070,7 @@ XmlElementWithLocation configElement
20702070
20712071 // Get the "Name" attribute of the <Config> element.
20722072 string configName = configElement . GetAttribute ( VSProjectAttributes . name ) ;
2073- ProjectErrorUtilities . VerifyThrowInvalidProject ( ( configName != null ) && ( configName . Length > 0 ) ,
2073+ ProjectErrorUtilities . VerifyThrowInvalidProject ( ! string . IsNullOrEmpty ( configName ) ,
20742074 configElement . Location , "MissingAttribute" , VSProjectElements . config , VSProjectAttributes . name ) ;
20752075
20762076 // In the case of VSD projects, the "Name" attribute will have a pipe in it,
@@ -2108,7 +2108,7 @@ XmlElementWithLocation configElement
21082108
21092109 // Process OutputPath attribute separately to ensure it contains trailing backslash
21102110 string outputPath = configElement . GetAttribute ( VSProjectAttributes . outputPath ) ;
2111- if ( outputPath != null && outputPath . Length > 0 )
2111+ if ( ! string . IsNullOrEmpty ( outputPath ) )
21122112 {
21132113 if ( outputPath [ outputPath . Length - 1 ] != Path . DirectorySeparatorChar )
21142114 outputPath += Path . DirectorySeparatorChar ;
@@ -2133,7 +2133,7 @@ XmlElementWithLocation configElement
21332133
21342134 // Get rid of the "IncrementalBuild" attribute
21352135 string incrementalBuild = configElement . GetAttribute ( VSProjectAttributes . incrementalBuild ) ;
2136- if ( incrementalBuild != null && incrementalBuild . Length > 0 )
2136+ if ( ! string . IsNullOrEmpty ( incrementalBuild ) )
21372137 {
21382138 configElement . RemoveAttribute ( VSProjectAttributes . incrementalBuild ) ;
21392139 }
@@ -2278,7 +2278,7 @@ XmlElementWithLocation platformElement
22782278
22792279 // Get the "Name" attribute of the <Platform> element.
22802280 platformForVSD = platformElement . GetAttribute ( VSProjectAttributes . name ) ;
2281- ProjectErrorUtilities . VerifyThrowInvalidProject ( ( platformForVSD != null ) && ( platformForVSD . Length > 0 ) ,
2281+ ProjectErrorUtilities . VerifyThrowInvalidProject ( ! string . IsNullOrEmpty ( platformForVSD ) ,
22822282 platformElement . Location , "MissingAttribute" , VSProjectElements . platform , VSProjectAttributes . name ) ;
22832283
22842284 // Create a new property group, and add all of the XML attributes as XMake
@@ -2502,7 +2502,7 @@ ProjectItemGroupElement referencesItemGroup
25022502 // "-Designer", we need to disregard this reference entirely.
25032503
25042504 string platform = referenceElement . GetAttribute ( VSProjectAttributes . platform ) ;
2505- if ( ( platform != null ) && ( platform . Length > 0 ) )
2505+ if ( ! string . IsNullOrEmpty ( platform ) )
25062506 {
25072507 if ( platform . IndexOf ( "-Designer" , 0 , platform . Length , StringComparison . Ordinal ) != - 1 )
25082508 {
@@ -2517,7 +2517,7 @@ ProjectItemGroupElement referencesItemGroup
25172517 // Get the "Name" attribute. This is a required attribute in the VS7/
25182518 // Everett format.
25192519 string referenceName = referenceElement . GetAttribute ( VSProjectAttributes . name ) ;
2520- ProjectErrorUtilities . VerifyThrowInvalidProject ( ( referenceName != null ) && ( referenceName . Length > 0 ) ,
2520+ ProjectErrorUtilities . VerifyThrowInvalidProject ( ! string . IsNullOrEmpty ( referenceName ) ,
25212521 referenceElement . Location , "MissingAttribute" , VSProjectAttributes . name , VSProjectElements . reference ) ;
25222522
25232523 // Before we go any further, we must special-case some assemblies for VSD projects.
@@ -2559,12 +2559,12 @@ ProjectItemGroupElement referencesItemGroup
25592559 // reference.
25602560 string referencedProjectGuid = referenceElement . GetAttribute ( VSProjectAttributes . project ) ;
25612561
2562- if ( ( comReferenceGuid != null ) && ( comReferenceGuid . Length > 0 ) &&
2562+ if ( ! string . IsNullOrEmpty ( comReferenceGuid ) &&
25632563 ( comReferenceGuid != "{00000000-0000-0000-0000-000000000000}" ) )
25642564 {
25652565 newReferenceItem = ConvertClassicComReference ( referenceElement , referencesItemGroup , referenceName ) ;
25662566 }
2567- else if ( ( referencedProjectGuid != null ) && ( referencedProjectGuid . Length > 0 ) )
2567+ else if ( ! string . IsNullOrEmpty ( referencedProjectGuid ) )
25682568 {
25692569 newReferenceItem = ConvertProjectToProjectReference ( referenceElement , referencesItemGroup , referenceName , ref referencedProjectGuid ) ;
25702570 }
@@ -2738,7 +2738,7 @@ private ProjectItemElement ConvertAssemblyReference(XmlElementWithLocation refer
27382738 // Get the "AssemblyName" attribute. If not found, just use the value from the
27392739 // "Name" attribute. This is what the project loading code does in VS.
27402740 string assemblyName = referenceElement . GetAttribute ( VSProjectAttributes . assemblyName ) ;
2741- if ( ( assemblyName == null ) || ( assemblyName . Length == 0 ) )
2741+ if ( string . IsNullOrEmpty ( assemblyName ) )
27422742 {
27432743 assemblyName = referenceName ;
27442744 }
@@ -3022,7 +3022,7 @@ ProjectItemGroupElement importsItemGroup
30223022
30233023 // Get the required "Namespace" attribute.
30243024 string importNamespace = importElement . GetAttribute ( VSProjectAttributes . importNamespace ) ;
3025- ProjectErrorUtilities . VerifyThrowInvalidProject ( ( importNamespace != null ) && ( importNamespace . Length > 0 ) ,
3025+ ProjectErrorUtilities . VerifyThrowInvalidProject ( ! string . IsNullOrEmpty ( importNamespace ) ,
30263026 importElement . Location , "MissingAttribute" , VSProjectAttributes . importNamespace , VSProjectElements . import ) ;
30273027 // Remove the "Namespace" attribute, so it doesn't show up in our loop later.
30283028 importElement . RemoveAttribute ( VSProjectAttributes . importNamespace ) ;
@@ -3212,7 +3212,7 @@ ProjectItemGroupElement filesItemGroup
32123212
32133213 // Get the required "RelPath" attribute.
32143214 string relPath = fileElement . GetAttribute ( VSProjectAttributes . relPath ) ;
3215- ProjectErrorUtilities . VerifyThrowInvalidProject ( ( relPath != null ) && ( relPath . Length > 0 ) ,
3215+ ProjectErrorUtilities . VerifyThrowInvalidProject ( ! string . IsNullOrEmpty ( relPath ) ,
32163216 fileElement . Location , "MissingAttribute" , VSProjectAttributes . relPath , VSProjectElements . file ) ;
32173217 // Remove the "RelPath" attribute, so we don't end up adding it twice.
32183218 fileElement . RemoveAttribute ( VSProjectAttributes . relPath ) ;
@@ -3226,7 +3226,7 @@ ProjectItemGroupElement filesItemGroup
32263226 // what the build action is based on the file extension. This is
32273227 // what the project loading code does in VS.
32283228 string buildAction = fileElement . GetAttribute ( VSProjectAttributes . buildAction ) ;
3229- if ( ( buildAction == null ) || ( buildAction . Length == 0 ) )
3229+ if ( string . IsNullOrEmpty ( buildAction ) )
32303230 {
32313231 buildAction = VSProjectAttributes . buildActionNone ;
32323232 }
@@ -3243,7 +3243,7 @@ ProjectItemGroupElement filesItemGroup
32433243 )
32443244 {
32453245 // Add the new item to XMake.
3246- if ( ( linkPath == null ) || ( linkPath . Length == 0 ) )
3246+ if ( string . IsNullOrEmpty ( linkPath ) )
32473247 {
32483248 // Normal item.
32493249
@@ -3338,7 +3338,7 @@ private bool IsFilePresentButEmpty(string relPath, string linkPath)
33383338 // relpath is the filename
33393339 // linkPath, if it exists, is the relative path from the project, or the absolute full path
33403340 string path ;
3341- if ( linkPath == null || linkPath . Length == 0 )
3341+ if ( string . IsNullOrEmpty ( linkPath ) )
33423342 {
33433343 path = Path . Combine ( Path . GetDirectoryName ( oldProjectFile ) , relPath ) ;
33443344 }
@@ -3401,7 +3401,7 @@ ProjectItemGroupElement filesItemGroup
34013401
34023402 // Get the required "RelPath" attribute.
34033403 string relPath = folderElement . GetAttribute ( VSProjectAttributes . relPath ) ;
3404- ProjectErrorUtilities . VerifyThrowInvalidProject ( ( relPath != null ) && ( relPath . Length > 0 ) ,
3404+ ProjectErrorUtilities . VerifyThrowInvalidProject ( ! string . IsNullOrEmpty ( relPath ) ,
34053405 folderElement . Location , "MissingAttribute" , VSProjectAttributes . relPath , VSProjectElements . folder ) ;
34063406 // Remove the "RelPath" attribute, so we don't end up adding it twice.
34073407 folderElement . RemoveAttribute ( VSProjectAttributes . relPath ) ;
@@ -3445,7 +3445,7 @@ ProjectItemGroupElement filesItemGroup
34453445 newFolderItem = filesItemGroup . AddItem ( XMakeProjectStrings . webReferences ,
34463446 ProjectCollection . Escape ( relPath ) ) ;
34473447 }
3448- else if ( ( webReferenceUrl != null ) && ( webReferenceUrl . Length > 0 ) )
3448+ else if ( ! string . IsNullOrEmpty ( webReferenceUrl ) )
34493449 {
34503450 // This is an actual web reference URL.
34513451
@@ -3615,7 +3615,7 @@ ProjectItemGroupElement startupServicesItemGroup
36153615
36163616 // Get the required "ID" attribute.
36173617 string id = serviceElement . GetAttribute ( VSProjectAttributes . id ) ;
3618- ProjectErrorUtilities . VerifyThrowInvalidProject ( ( id != null ) && ( id . Length > 0 ) , serviceElement . Location ,
3618+ ProjectErrorUtilities . VerifyThrowInvalidProject ( ! string . IsNullOrEmpty ( id ) , serviceElement . Location ,
36193619 "MissingAttribute" , VSProjectAttributes . id , VSProjectElements . service ) ;
36203620 // Remove the "ID" attribute, so it doesn't show up in our loop later.
36213621 serviceElement . RemoveAttribute ( VSProjectAttributes . id ) ;
@@ -3814,7 +3814,7 @@ out bool isTriumphProject
38143814 if ( officeDocumentPathAttribute != null )
38153815 {
38163816 string officeDocumentPath = officeDocumentPathAttribute . Value ;
3817- if ( ( officeDocumentPath != null ) && ( officeDocumentPath . Length > 0 ) )
3817+ if ( ! string . IsNullOrEmpty ( officeDocumentPath ) )
38183818 {
38193819 string projectFileDirectory = Path . GetDirectoryName ( Path . GetFullPath ( this . oldProjectFile ) ) ;
38203820 string officeDocumentFullPath = Path . GetFullPath ( Path . Combine ( projectFileDirectory , officeDocumentPath ) ) ;
0 commit comments