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
@@ -271,7 +271,7 @@ namespace Barotrauma.Networking
XDocument doc = null;
if (File.Exists(SettingsFile))
{
doc = ToolBox.TryLoadXml(SettingsFile);
doc = XMLExtensions.TryLoadXml(SettingsFile);
}
if (doc == null || doc.Root == null)
@@ -281,7 +281,7 @@ namespace Barotrauma.Networking
ObjectProperties = ObjectProperty.InitProperties(this, doc.Root);
AutoRestart = ToolBox.GetAttributeBool(doc.Root, "autorestart", false);
AutoRestart = doc.Root.GetAttributeBool("autorestart", false);
#if CLIENT
if (autoRestart)
{
@@ -290,15 +290,15 @@ namespace Barotrauma.Networking
#endif
subSelectionMode = SelectionMode.Manual;
Enum.TryParse<SelectionMode>(ToolBox.GetAttributeString(doc.Root, "SubSelection", "Manual"), out subSelectionMode);
Enum.TryParse<SelectionMode>(doc.Root.GetAttributeString("SubSelection", "Manual"), out subSelectionMode);
Voting.AllowSubVoting = subSelectionMode == SelectionMode.Vote;
modeSelectionMode = SelectionMode.Manual;
Enum.TryParse<SelectionMode>(ToolBox.GetAttributeString(doc.Root, "ModeSelection", "Manual"), out modeSelectionMode);
Enum.TryParse<SelectionMode>(doc.Root.GetAttributeString("ModeSelection", "Manual"), out modeSelectionMode);
Voting.AllowModeVoting = modeSelectionMode == SelectionMode.Vote;
var traitorsEnabled = TraitorsEnabled;
Enum.TryParse<YesNoMaybe>(ToolBox.GetAttributeString(doc.Root, "TraitorsEnabled", "No"), out traitorsEnabled);
Enum.TryParse<YesNoMaybe>(doc.Root.GetAttributeString("TraitorsEnabled", "No"), out traitorsEnabled);
TraitorsEnabled = traitorsEnabled;
GameMain.NetLobbyScreen.SetTraitorsEnabled(traitorsEnabled);
@@ -308,7 +308,7 @@ namespace Barotrauma.Networking
#endif
)
{
GameMain.NetLobbyScreen.ServerMessageText = ToolBox.GetAttributeString(doc.Root, "ServerMessage", "");
GameMain.NetLobbyScreen.ServerMessageText = doc.Root.GetAttributeString("ServerMessage", "");
}
#if CLIENT