Converted the GetAttribute methods in the ToolBox class to extension methods

This commit is contained in:
Joonas Rikkonen
2017-10-04 18:38:40 +03:00
parent 6c7c97a875
commit 1ff2054ca8
99 changed files with 854 additions and 875 deletions
@@ -55,16 +55,16 @@ namespace Barotrauma
public JobPrefab(XElement element)
{
Name = ToolBox.GetAttributeString(element, "name", "name not found");
Name = element.GetAttributeString("name", "name not found");
Description = ToolBox.GetAttributeString(element, "description", "");
Description = element.GetAttributeString("description", "");
MinNumber = ToolBox.GetAttributeInt(element, "minnumber", 0);
MaxNumber = ToolBox.GetAttributeInt(element, "maxnumber", 10);
MinNumber = element.GetAttributeInt("minnumber", 0);
MaxNumber = element.GetAttributeInt("maxnumber", 10);
Commonness = ToolBox.GetAttributeInt(element, "commonness", 10);
Commonness = element.GetAttributeInt("commonness", 10);
AllowAlways = ToolBox.GetAttributeBool(element, "allowalways", false);
AllowAlways = element.GetAttributeBool("allowalways", false);
ItemNames = new List<string>();
@@ -78,7 +78,7 @@ namespace Barotrauma
Items = subElement;
foreach (XElement itemElement in subElement.Elements())
{
string itemName = ToolBox.GetAttributeString(itemElement, "name", "");
string itemName = itemElement.GetAttributeString("name", "");
if (!string.IsNullOrWhiteSpace(itemName)) ItemNames.Add(itemName);
}
break;
@@ -105,7 +105,7 @@ namespace Barotrauma
foreach (string filePath in filePaths)
{
XDocument doc = ToolBox.TryLoadXml(filePath);
XDocument doc = XMLExtensions.TryLoadXml(filePath);
if (doc == null || doc.Root == null) return;
foreach (XElement element in doc.Root.Elements())