Swapped all System.Root string conversions

to use the `System.RootString` constant.

This saves on integer parsing and reduces the number of
new strings being created.

Since the `System.Root` is `-1`, it didn't need the culture invariant
conversion.
This commit is contained in:
leekelleher
2019-03-29 12:06:23 +00:00
parent 853087a750
commit f4bd0cd1f5
21 changed files with 38 additions and 38 deletions

View File

@@ -35,7 +35,7 @@ namespace Umbraco.Web.Trees
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
{
var path = string.IsNullOrEmpty(id) == false && id != Constants.System.Root.ToInvariantString()
var path = string.IsNullOrEmpty(id) == false && id != Constants.System.RootString
? HttpUtility.UrlDecode(id).TrimStart("/")
: "";
@@ -84,7 +84,7 @@ namespace Umbraco.Web.Trees
{
var root = base.CreateRootNode(queryStrings);
//check if there are any children
root.HasChildren = GetTreeNodes(Constants.System.Root.ToInvariantString(), queryStrings).Any();
root.HasChildren = GetTreeNodes(Constants.System.RootString, queryStrings).Any();
return root;
}
@@ -139,14 +139,14 @@ namespace Umbraco.Web.Trees
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
//if root node no need to visit the filesystem so lets just create the menu and return it
if (id == Constants.System.Root.ToInvariantString())
if (id == Constants.System.RootString)
{
return GetMenuForRootNode(queryStrings);
}
var menu = new MenuItemCollection();
var path = string.IsNullOrEmpty(id) == false && id != Constants.System.Root.ToInvariantString()
var path = string.IsNullOrEmpty(id) == false && id != Constants.System.RootString
? HttpUtility.UrlDecode(id).TrimStart("/")
: "";