Networking bugfixes & optimization

This commit is contained in:
Regalis
2015-08-18 18:13:40 +03:00
parent bc4ea098f7
commit 00c64f0b20
35 changed files with 320 additions and 188 deletions
+17 -13
View File
@@ -52,6 +52,21 @@ namespace Subsurface
GraphicsHeight = int.Parse(graphicsMode.Attribute("height").Value);
FullScreenEnabled = graphicsMode.Attribute("fullscreen").Value == "true";
MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", "");
foreach (XElement subElement in doc.Root.Elements())
{
switch (subElement.Name.ToString().ToLower())
{
case "contentpackage":
string path = ToolBox.GetAttributeString(subElement, "path", "");
SelectedContentPackage = ContentPackage.list.Find(cp => cp.Path == path);
if (SelectedContentPackage == null) SelectedContentPackage = new ContentPackage(path);
break;
}
}
}
catch
{
@@ -60,20 +75,7 @@ namespace Subsurface
}
MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", "");
foreach (XElement subElement in doc.Root.Elements())
{
switch (subElement.Name.ToString().ToLower())
{
case "contentpackage":
string path = ToolBox.GetAttributeString(subElement, "path", "");
SelectedContentPackage = ContentPackage.list.Find(cp => cp.Path == path);
if (SelectedContentPackage == null) SelectedContentPackage = new ContentPackage(path);
break;
}
}
}
@@ -86,6 +88,8 @@ namespace Subsurface
doc.Add(new XElement("config"));
}
doc.Root.Add(new XAttribute("masterserverurl", MasterServerUrl));
XElement gMode = doc.Root.Element("graphicsmode");
if (gMode == null)
{