diff options
author | Mikayla Hutchinson <m.j.hutchinson@gmail.com> | 2018-04-17 20:22:00 +0300 |
---|---|---|
committer | Mikayla Hutchinson <m.j.hutchinson@gmail.com> | 2018-04-17 20:22:43 +0300 |
commit | 37e0e3f5eb83b5ccf92979089600e70c6616cf10 (patch) | |
tree | 3706b77aed9237af7870f40ece4fab2350942945 /main/src/core | |
parent | 8252fc4d04e507264ba4b59c26862e5bb5c51c12 (diff) |
Minor perf fixes in sln file format
Diffstat (limited to 'main/src/core')
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs index b74c2c1c54..af80a19a13 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs @@ -29,16 +29,10 @@ using System; using System.Collections.Generic; using System.IO; -using System.Text; -using System.Text.RegularExpressions; - -using MonoDevelop.Projects; -using MonoDevelop.Core.Serialization; -using MonoDevelop.Projects.Extensions; -using MonoDevelop.Core; -using System.Reflection; using System.Linq; +using System.Reflection; using System.Threading.Tasks; +using MonoDevelop.Core; namespace MonoDevelop.Projects.MSBuild { @@ -276,7 +270,7 @@ namespace MonoDevelop.Projects.MSBuild // are missing "{"..."}" in their guid. This is not generally a problem since it // is a valid GUID format. However the solution file format requires that these are present. string itemGuid = item.ItemId; - if (!itemGuid.StartsWith ("{") && !itemGuid.EndsWith ("}")) + if (!itemGuid.StartsWith ("{", StringComparison.Ordinal) && !itemGuid.EndsWith ("}", StringComparison.Ordinal)) itemGuid = "{" + itemGuid + "}"; var pset = col.GetOrCreatePropertySet (itemGuid, ignoreCase:true); @@ -419,10 +413,8 @@ namespace MonoDevelop.Projects.MSBuild var solDirectory = Path.GetDirectoryName (sol.FileName); foreach (SlnProject sec in sln.Projects) { - try { - // Valid guid? - new Guid (sec.TypeGuid); - } catch (FormatException) { + // Valid guid? + if (!Guid.TryParse(sec.TypeGuid, out _)) { monitor.Step (1); //Use default guid as projectGuid LoggingService.LogDebug (GettextCatalog.GetString ( @@ -458,7 +450,7 @@ namespace MonoDevelop.Projects.MSBuild continue; } - if (projectPath.StartsWith("http://")) { + if (projectPath.StartsWith("http://", StringComparison.Ordinal)) { monitor.ReportWarning (GettextCatalog.GetString ( "{0}({1}): Projects with non-local source (http://...) not supported. '{2}'.", sol.FileName, sec.Line, projectPath)); @@ -580,7 +572,7 @@ namespace MonoDevelop.Projects.MSBuild foreach (var e in sln.Sections) { string name = e.Id; - if (name.StartsWith ("MonoDevelopProperties.")) { + if (name.StartsWith ("MonoDevelopProperties.", StringComparison.Ordinal)) { int i = name.IndexOf ('.'); LoadMonoDevelopConfigurationProperties (name.Substring (i+1), e, sol, monitor); } @@ -650,13 +642,13 @@ namespace MonoDevelop.Projects.MSBuild string projConfig = prop.Value; string left = prop.Key; - if (left.EndsWith (".ActiveCfg")) { + if (left.EndsWith (".ActiveCfg", StringComparison.Ordinal)) { action = "ActiveCfg"; left = left.Substring (0, left.Length - 10); - } else if (left.EndsWith (".Build.0")) { + } else if (left.EndsWith (".Build.0", StringComparison.Ordinal)) { action = "Build.0"; left = left.Substring (0, left.Length - 8); - } else if (left.EndsWith (".Deploy.0")) { + } else if (left.EndsWith (".Deploy.0", StringComparison.Ordinal)) { action = "Deploy.0"; left = left.Substring (0, left.Length - 9); } else { |