aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1/Package_Grabber.cs
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-05-01 20:23:48 -0400
committerMichaelTheShifter <[email protected]>2016-05-01 20:23:48 -0400
commit0085241d2366f266b5416488dbead174184420b0 (patch)
treebb496c70c8235998ac343e8a63ced5a96d318a03 /source/WindowsFormsApplication1/Package_Grabber.cs
parentca5438be3956ee012a1bbcdab59512029a47fff2 (diff)
downloadshiftos-c--0085241d2366f266b5416488dbead174184420b0.tar.gz
shiftos-c--0085241d2366f266b5416488dbead174184420b0.tar.bz2
shiftos-c--0085241d2366f266b5416488dbead174184420b0.zip
Beta 2.2 Patch 1
Commit for Beta 2.2 Patch 1 - Removed unused "Linux Mint 7" and "NetSockets" files from Resources.resx - Added a better server startup pool, no longer hardcoded. - Added a server blacklist for disabling servers that break the rules of the playshiftos.ml/forum server showcase
Diffstat (limited to 'source/WindowsFormsApplication1/Package_Grabber.cs')
-rw-r--r--source/WindowsFormsApplication1/Package_Grabber.cs55
1 files changed, 42 insertions, 13 deletions
diff --git a/source/WindowsFormsApplication1/Package_Grabber.cs b/source/WindowsFormsApplication1/Package_Grabber.cs
index c9948b0..a041910 100644
--- a/source/WindowsFormsApplication1/Package_Grabber.cs
+++ b/source/WindowsFormsApplication1/Package_Grabber.cs
@@ -54,29 +54,58 @@ namespace ShiftOS
{
clients = new Dictionary<string, NetObjectClient>();
}
- var client = new NetObjectClient();
- client.OnReceived += (object s, NetReceivedEventArgs<NetObject> a) => {
- try {
- var obj = (ObjectModel)a.Data.Object;
- if (obj.Command == "set_ident")
+ bool blacklisted = false;
+ string blacklist = new WebClient().DownloadString("http://playshiftos.ml/server/blacklist");
+ string[] splitter = blacklist.Split(';');
+ foreach (string addr in splitter)
+ {
+ try
+ {
+ string[] addSplitter = addr.Split(':');
+ string host = addSplitter[0];
+ int prt = Convert.ToInt32(addSplitter[1]);
+ if(address == host && port == prt)
{
- this_id = obj.SysId;
+ blacklisted = true;
}
}
catch
{
}
- };
-
- try
+ }
+ if (!blacklisted)
{
- client.Connect(address, port);
- clients.Add(client.RemoteHost, client);
+ var client = new NetObjectClient();
+ client.OnReceived += (object s, NetReceivedEventArgs<NetObject> a) =>
+ {
+ try
+ {
+ var obj = (ObjectModel)a.Data.Object;
+ if (obj.Command == "set_ident")
+ {
+ this_id = obj.SysId;
+ }
+ }
+ catch
+ {
+
+ }
+ };
+
+ try
+ {
+ client.Connect(address, port);
+ clients.Add(client.RemoteHost, client);
+ }
+ catch (Exception ex)
+ {
+ API.CreateInfoboxSession("Server Connection Error", $"{ex.Message}", infobox.InfoboxMode.Info);
+ }
}
- catch(Exception ex)
+ else
{
- MessageBox.Show($"Error: {ex.Message}");
+ API.CreateInfoboxSession("Server Connection Error", "The server you are trying to connect to has been blacklisted for breaking the rules of the Server Showcase, therefore you may not connect to it.", infobox.InfoboxMode.Info);
}
}