Removed NioTSO client and server

- NioTSO client isn't needed because we're using RayLib
- Added FreeSO's API server to handle most backend operations
This commit is contained in:
Tony Bark 2024-05-01 02:55:43 -04:00
parent f12ba1502b
commit 22191ce648
591 changed files with 53264 additions and 3362 deletions

View file

@ -0,0 +1,43 @@
using System;
using System.Xml;
namespace FSO.Common.Utils
{
public interface IXMLEntity
{
XmlElement Serialize(XmlDocument doc);
void Parse(XmlElement element);
}
public static class XMLUtils
{
public static T Parse<T>(string data) where T : IXMLEntity
{
var doc = new XmlDocument();
doc.LoadXml(data);
T result = (T)Activator.CreateInstance(typeof(T));
result.Parse((XmlElement)doc.FirstChild);
return result;
}
public static void AppendTextNode(this XmlElement e, string nodeName, string value)
{
var node = e.OwnerDocument.CreateElement(nodeName);
node.AppendChild(e.OwnerDocument.CreateTextNode(value));
e.AppendChild(node);
}
public static string ReadTextNode(this XmlElement e, string nodeName)
{
foreach (XmlElement child in e.ChildNodes)
{
if (child.Name == nodeName && child.FirstChild != null)
{
return child.FirstChild?.Value;
}
}
return null;
}
}
}