summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/ServerInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/ServerInfo.cs')
-rw-r--r--Client/Assembly-CSharp/ServerInfo.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/ServerInfo.cs b/Client/Assembly-CSharp/ServerInfo.cs
new file mode 100644
index 0000000..f952619
--- /dev/null
+++ b/Client/Assembly-CSharp/ServerInfo.cs
@@ -0,0 +1,43 @@
+using System;
+using System.IO;
+using System.Net;
+
+public class ServerInfo
+{
+ public string Name = "Custom";
+
+ public string Ip = "0.0.0.0";
+
+ public bool Default;
+
+ public void Serialize(BinaryWriter writer)
+ {
+ writer.Write(this.Name);
+ writer.Write(this.Ip);
+ writer.Write(this.Default);
+ }
+
+ public static ServerInfo Deserialize(BinaryReader reader)
+ {
+ ServerInfo serverInfo = new ServerInfo();
+ serverInfo.Name = reader.ReadString();
+ serverInfo.Ip = reader.ReadString();
+ IPAddress ipaddress;
+ if (!IPAddress.TryParse(serverInfo.Ip, out ipaddress))
+ {
+ return null;
+ }
+ serverInfo.Default = reader.ReadBoolean();
+ return serverInfo;
+ }
+
+ internal static ServerInfo Deserialize(string[] parts)
+ {
+ return new ServerInfo
+ {
+ Name = parts[0],
+ Ip = parts[1],
+ Default = bool.Parse(parts[2])
+ };
+ }
+}