Added checks and fixes
This commit is contained in:
parent
3da514d0f4
commit
4f37f0a3b9
@ -51,6 +51,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".gitignore" />
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
18
Program.cs
18
Program.cs
@ -36,6 +36,11 @@ namespace GiantsLauncher
|
||||
string server_ok = "";
|
||||
foreach (string server in SERVERS)
|
||||
{
|
||||
if (server.Length > 15)
|
||||
{
|
||||
Console.WriteLine("Server {0} has length > 15, skipping.", server);
|
||||
continue;
|
||||
}
|
||||
Console.WriteLine("Testing {0}", server);
|
||||
if (TestServer(server))
|
||||
{
|
||||
@ -53,7 +58,15 @@ namespace GiantsLauncher
|
||||
Byte[] data = System.Text.Encoding.ASCII.GetBytes(server_ok);
|
||||
writer.Seek(offset, SeekOrigin.Begin); //move cursor to the position
|
||||
writer.Write(data);//write it
|
||||
// add padding
|
||||
for (int i = 0; i < 15 - data.Length; i++)
|
||||
{
|
||||
writer.Write((byte)0);//write it
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
Console.WriteLine("No working master server found... RIP.");
|
||||
}
|
||||
Process.Start(GIANTS_PATH);
|
||||
}
|
||||
@ -133,6 +146,11 @@ namespace GiantsLauncher
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!client.Connected)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NetworkStream stream = client.GetStream();
|
||||
|
||||
// Buffer to store the response bytes.
|
||||
|
Reference in New Issue
Block a user