masterserver finished
This commit is contained in:
@ -21,7 +21,7 @@ namespace CoopClient
|
||||
|
||||
private bool GameLoaded = false;
|
||||
|
||||
internal static readonly string CurrentVersion = "V0_8_0_1";
|
||||
internal static readonly string CurrentVersion = "V0_9_0";
|
||||
|
||||
internal static bool ShareNpcsWithPlayers = false;
|
||||
internal static bool DisableTraffic = false;
|
||||
|
@ -64,7 +64,7 @@ namespace CoopClient.Menus.Sub
|
||||
try
|
||||
{
|
||||
WebClient client = new WebClient();
|
||||
string data = client.DownloadString("http://gtacoopr.000webhostapp.com/");
|
||||
string data = client.DownloadString(Main.MainSettings.MasterServer);
|
||||
serverList = JsonConvert.DeserializeObject<List<ServerListClass>>(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -16,6 +16,10 @@
|
||||
/// <summary>
|
||||
/// Don't use it!
|
||||
/// </summary>
|
||||
public string MasterServer { get; set; } = "http://gtacoopr.000webhostapp.com/servers.php";
|
||||
/// <summary>
|
||||
/// Don't use it!
|
||||
/// </summary>
|
||||
public bool FlipMenu { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Don't use it!
|
||||
|
@ -20,7 +20,7 @@ namespace CoopServer
|
||||
|
||||
internal class Server
|
||||
{
|
||||
private static readonly string CompatibleVersion = "V0_8_0_1";
|
||||
private static readonly string CompatibleVersion = "V0_9_0";
|
||||
|
||||
public static readonly Settings MainSettings = Util.Read<Settings>("CoopSettings.xml");
|
||||
private readonly Blocklist MainBlocklist = Util.Read<Blocklist>("Blocklist.xml");
|
||||
@ -71,8 +71,10 @@ namespace CoopServer
|
||||
}
|
||||
}
|
||||
|
||||
if (1 == 1) // TODO
|
||||
if (MainSettings.AnnounceSelf)
|
||||
{
|
||||
Logging.Info("Announcing to master server...");
|
||||
|
||||
#region -- MASTERSERVER --
|
||||
new Thread(async () =>
|
||||
{
|
||||
@ -110,10 +112,16 @@ namespace CoopServer
|
||||
"\"country\": \"" + info.Country + "\"" +
|
||||
" }";
|
||||
|
||||
HttpResponseMessage response = null;
|
||||
string responseContent = "";
|
||||
try
|
||||
{
|
||||
HttpResponseMessage response = await httpClient.PostAsync("http://gtacoopr.000webhostapp.com/", new StringContent(msg, Encoding.UTF8, "application/json"));
|
||||
response = await httpClient.PostAsync(MainSettings.MasterServer, new StringContent(msg, Encoding.UTF8, "application/json"));
|
||||
if (response == null)
|
||||
{
|
||||
Logging.Error("MasterServer: Something went wrong!");
|
||||
continue;
|
||||
}
|
||||
|
||||
responseContent = await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
@ -123,9 +131,9 @@ namespace CoopServer
|
||||
continue;
|
||||
}
|
||||
|
||||
if (responseContent != "OK")
|
||||
if (response.StatusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
Logging.Error(responseContent);
|
||||
Logging.Error($"MasterServer: {response.StatusCode}");
|
||||
responseError = true;
|
||||
}
|
||||
else
|
||||
@ -137,7 +145,7 @@ namespace CoopServer
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.Error(ex.Message);
|
||||
Logging.Error($"MasterServer: {ex.Message}");
|
||||
}
|
||||
}).Start();
|
||||
#endregion
|
||||
|
@ -11,6 +11,8 @@
|
||||
public bool NpcsAllowed { get; set; } = true;
|
||||
public bool ModsAllowed { get; set; } = false;
|
||||
public bool UPnP { get; set; } = true;
|
||||
public bool AnnounceSelf { get; set; } = true;
|
||||
public string MasterServer { get; set; } = "http://gtacoopr.000webhostapp.com/servers.php";
|
||||
public bool DebugMode { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user