country road, take me home...
This commit is contained in:
@ -10,9 +10,12 @@ namespace RageCoop.Client.Menus
|
|||||||
{
|
{
|
||||||
internal class ServerListClass
|
internal class ServerListClass
|
||||||
{
|
{
|
||||||
[JsonProperty("ip")]
|
[JsonProperty("address")]
|
||||||
public string IP { get; set; }
|
public string Address { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("port")]
|
||||||
|
public string Port { get; set; }
|
||||||
|
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
@ -24,6 +27,9 @@ namespace RageCoop.Client.Menus
|
|||||||
|
|
||||||
[JsonProperty("maxPlayers")]
|
[JsonProperty("maxPlayers")]
|
||||||
public int MaxPlayers { get; set; }
|
public int MaxPlayers { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("country")]
|
||||||
|
public string Country { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -53,7 +59,6 @@ namespace RageCoop.Client.Menus
|
|||||||
Menu.Add(ResultItem = new NativeItem("Loading..."));
|
Menu.Add(ResultItem = new NativeItem("Loading..."));
|
||||||
|
|
||||||
// Prevent freezing
|
// Prevent freezing
|
||||||
if (GetServersThread!=null && GetServersThread.IsAlive) { GetServersThread?.Abort(); }
|
|
||||||
GetServersThread=new Thread(()=> GetAllServers());
|
GetServersThread=new Thread(()=> GetAllServers());
|
||||||
GetServersThread.Start();
|
GetServersThread.Start();
|
||||||
};
|
};
|
||||||
@ -85,32 +90,31 @@ namespace RageCoop.Client.Menus
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ResultItem.Title = "Download failed!";
|
Main.QueueAction(() =>
|
||||||
ResultItem.Description = ex.Message;
|
{
|
||||||
|
ResultItem.Title = "Download failed!";
|
||||||
|
ResultItem.Description = ex.Message;
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serverList == null)
|
|
||||||
{
|
|
||||||
ResultItem.Title = "Something went wrong!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (serverList.Count == 0)
|
|
||||||
{
|
|
||||||
ResultItem.Title = "No server was found!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Need to be processed in main thread
|
// Need to be processed in main thread
|
||||||
Main.QueueAction(() =>
|
Main.QueueAction(() =>
|
||||||
{
|
{
|
||||||
|
if (serverList == null)
|
||||||
|
{
|
||||||
|
ResultItem.Title = "Something went wrong!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (serverList.Count == 0)
|
||||||
|
{
|
||||||
|
ResultItem.Title = "No server was found!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
CleanUpList();
|
CleanUpList();
|
||||||
foreach (ServerListClass server in serverList)
|
foreach (ServerListClass server in serverList)
|
||||||
{
|
{
|
||||||
string address = server.IP;
|
string address = $"{server.Address}:{server.Port}";
|
||||||
NativeItem tmpItem = new NativeItem($"{server.Name}", $"~b~{address}~s~~n~~g~Version {server.Version}.x~s~") { AltTitle = $"[{server.Players}/{server.MaxPlayers}]" };
|
NativeItem tmpItem = new NativeItem($"[{server.Country}] {server.Name}", $"~b~{address}~s~~n~~g~Version {server.Version}.x~s~") { AltTitle = $"[{server.Players}/{server.MaxPlayers}]" };
|
||||||
tmpItem.Activated += (object sender, EventArgs e) =>
|
tmpItem.Activated += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -18,7 +18,7 @@ namespace RageCoop.Client
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MasterServer { get; set; } = "https://ragecoop.000webhostapp.com/master.php";
|
public string MasterServer { get; set; } = "https://masterserver.ragecoop.online/";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -77,7 +77,6 @@ namespace RageCoop.Server
|
|||||||
|
|
||||||
if (MainSettings.AnnounceSelf)
|
if (MainSettings.AnnounceSelf)
|
||||||
{
|
{
|
||||||
Program.Logger.Info("Announcing to master server...");
|
|
||||||
|
|
||||||
#region -- MASTERSERVER --
|
#region -- MASTERSERVER --
|
||||||
new Thread(async () =>
|
new Thread(async () =>
|
||||||
@ -102,7 +101,7 @@ namespace RageCoop.Server
|
|||||||
|
|
||||||
string content = await response.Content.ReadAsStringAsync();
|
string content = await response.Content.ReadAsStringAsync();
|
||||||
info = JsonConvert.DeserializeObject<IpInfo>(content);
|
info = JsonConvert.DeserializeObject<IpInfo>(content);
|
||||||
Program.Logger.Info($"Your public IP is {info.Address}");
|
Program.Logger.Info($"Your public IP is {info.Address}, announcing to master server...");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
public string Resource { get; set; } = "";
|
public string Resource { get; set; } = "";
|
||||||
public bool UPnP { get; set; } = true;
|
public bool UPnP { get; set; } = true;
|
||||||
public bool AnnounceSelf { get; set; } = false;
|
public bool AnnounceSelf { get; set; } = false;
|
||||||
public string MasterServer { get; set; } = "https://ragecoop.000webhostapp.com/master.php";
|
public string MasterServer { get; set; } = "https://masterserver.ragecoop.online/";
|
||||||
public bool DebugMode { get; set; } = false;
|
public bool DebugMode { get; set; } = false;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// NPC data won't be sent to a player if their distance is greater than this value. -1 for unlimited.
|
/// NPC data won't be sent to a player if their distance is greater than this value. -1 for unlimited.
|
||||||
|
Reference in New Issue
Block a user