diff --git a/RageCoop.Client/FodyWeavers.xml b/RageCoop.Client/FodyWeavers.xml
index a5dcf04..2835016 100644
--- a/RageCoop.Client/FodyWeavers.xml
+++ b/RageCoop.Client/FodyWeavers.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/RageCoop.Client/Menus/Sub/ServersMenu.cs b/RageCoop.Client/Menus/Sub/ServersMenu.cs
index 0a648fe..44c66f7 100644
--- a/RageCoop.Client/Menus/Sub/ServersMenu.cs
+++ b/RageCoop.Client/Menus/Sub/ServersMenu.cs
@@ -5,32 +5,10 @@ using System.Collections.Generic;
using System.Drawing;
using System.Net;
using System.Threading;
+using RageCoop.Core;
namespace RageCoop.Client.Menus
{
- internal class ServerListClass
- {
- [JsonProperty("address")]
- public string Address { get; set; }
-
- [JsonProperty("port")]
- public string Port { get; set; }
-
- [JsonProperty("name")]
- public string Name { get; set; }
-
- [JsonProperty("version")]
- public string Version { get; set; }
-
- [JsonProperty("players")]
- public int Players { get; set; }
-
- [JsonProperty("maxPlayers")]
- public int MaxPlayers { get; set; }
-
- [JsonProperty("country")]
- public string Country { get; set; }
- }
///
/// Don't use it!
@@ -76,9 +54,9 @@ namespace RageCoop.Client.Menus
private static void GetAllServers()
{
- List serverList = null;
+ List serverList = null;
var realUrl = Main.Settings.MasterServer;
- serverList = JsonConvert.DeserializeObject>(DownloadString(realUrl));
+ serverList = JsonConvert.DeserializeObject>(DownloadString(realUrl));
// Need to be processed in main thread
Main.QueueAction(() =>
@@ -94,7 +72,7 @@ namespace RageCoop.Client.Menus
return;
}
CleanUpList();
- foreach (ServerListClass server in serverList)
+ foreach (ServerInfo server in serverList)
{
string address = $"{server.Address}:{server.Port}";
NativeItem tmpItem = new NativeItem($"[{server.Country}] {server.Name}", $"~b~{address}~s~~n~~g~Version {server.Version}.x~s~") { AltTitle = $"[{server.Players}/{server.MaxPlayers}]" };
diff --git a/RageCoop.Core/Networking/ServerInfo.cs b/RageCoop.Core/Networking/ServerInfo.cs
new file mode 100644
index 0000000..fd1996f
--- /dev/null
+++ b/RageCoop.Core/Networking/ServerInfo.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Newtonsoft.Json;
+
+namespace RageCoop.Core
+{
+
+ internal class ServerInfo
+ {
+ [JsonProperty("address")]
+ public string Address { get; set; }
+
+ [JsonProperty("port")]
+ public int Port { get; set; }
+
+ [JsonProperty("name")]
+ public string Name { get; set; }
+
+ [JsonProperty("version")]
+ public string Version { get; set; }
+
+ [JsonProperty("players")]
+ public int Players { get; set; }
+
+ [JsonProperty("maxPlayers")]
+ public int MaxPlayers { get; set; }
+
+ [JsonProperty("country")]
+ public string Country { get; set; }
+
+ [JsonProperty("description")]
+ public string Description { get; set; }
+
+ [JsonProperty("website")]
+ public string Website { get; set; }
+
+ [JsonProperty("gameMode")]
+ public string GameMode { get; set; }
+
+ [JsonProperty("language")]
+ public string Language { get; set; }
+ }
+}
diff --git a/RageCoop.Server/FodyWeavers.xml b/RageCoop.Server/FodyWeavers.xml
index 5029e70..d32720a 100644
--- a/RageCoop.Server/FodyWeavers.xml
+++ b/RageCoop.Server/FodyWeavers.xml
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file
diff --git a/RageCoop.Server/Networking/Server.cs b/RageCoop.Server/Networking/Server.cs
index 9026526..6c3dcbc 100644
--- a/RageCoop.Server/Networking/Server.cs
+++ b/RageCoop.Server/Networking/Server.cs
@@ -39,7 +39,7 @@ namespace RageCoop.Server
///
public API API { get; private set; }
internal readonly BaseScript BaseScript;
- internal readonly ServerSettings Settings;
+ internal readonly Settings Settings;
internal NetServer MainNetServer;
internal ServerEntities Entities;
@@ -68,7 +68,7 @@ namespace RageCoop.Server
///
///
///
- public Server(ServerSettings settings,Logger logger=null)
+ public Server(Settings settings,Logger logger=null)
{
Settings = settings;
if (settings==null) { throw new ArgumentNullException("Server settings cannot be null!"); }
@@ -142,20 +142,21 @@ namespace RageCoop.Server
}
while (!_stopping)
{
- string msg =
- "{ " +
- "\"address\": \"" + info.Address + "\", " +
- "\"port\": \"" + Settings.Port + "\", " +
- "\"country\": \"" + info.Country + "\", " +
- "\"name\": \"" + Settings.Name + "\", " +
- "\"version\": \"" + _compatibleVersion.Replace("_", ".") + "\", " +
- "\"players\": \"" + MainNetServer.ConnectionsCount + "\", " +
- "\"maxPlayers\": \"" + Settings.MaxPlayers + "\", " +
- "\"description\": \"" + Settings.Description + "\", " +
- "\"website\": \"" + Settings.Website + "\", " +
- "\"gameMode\": \"" + Settings.GameMode + "\", " +
- "\"language\": \"" + Settings.Language + "\"" +
- " }";
+ var serverInfo = new ServerInfo
+ {
+ Address = info.Address,
+ Port=Settings.Port,
+ Country=info.Country,
+ Name=Settings.Name,
+ Version=_compatibleVersion.Replace("_", "."),
+ Players=MainNetServer.ConnectionsCount,
+ MaxPlayers=Settings.MaxPlayers,
+ Description=Settings.Description,
+ Website=Settings.Website,
+ GameMode=Settings.GameMode,
+ Language=Settings.Language,
+ };
+ string msg = JsonConvert.SerializeObject(serverInfo);
HttpResponseMessage response = null;
try
{
diff --git a/RageCoop.Server/Program.cs b/RageCoop.Server/Program.cs
index de20164..b3fcd77 100644
--- a/RageCoop.Server/Program.cs
+++ b/RageCoop.Server/Program.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
using RageCoop.Core;
+using Newtonsoft.Json;
namespace RageCoop.Server
{
class Program
@@ -20,7 +21,7 @@ namespace RageCoop.Server
try
{
Console.Title = "RAGECOOP";
- var setting = Util.Read("Settings.xml");
+ var setting = Util.Read("Settings.xml");
#if DEBUG
setting.LogLevel=0;
#endif