mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Fix OverflowException for server port
Change short to int. Bug report by 1092CQ.
This commit is contained in:
parent
cd0fe0e85a
commit
dc06cef704
3 changed files with 8 additions and 8 deletions
|
|
@ -53,7 +53,7 @@ namespace MinecraftClient
|
||||||
/// <param name="port">The server port to use</param>
|
/// <param name="port">The server port to use</param>
|
||||||
/// <param name="protocolversion">Minecraft protocol version to use</param>
|
/// <param name="protocolversion">Minecraft protocol version to use</param>
|
||||||
|
|
||||||
public McTcpClient(string username, string uuid, string sessionID, int protocolversion, string server_ip, short port)
|
public McTcpClient(string username, string uuid, string sessionID, int protocolversion, string server_ip, int port)
|
||||||
{
|
{
|
||||||
StartClient(username, uuid, sessionID, server_ip, port, protocolversion, false, "");
|
StartClient(username, uuid, sessionID, server_ip, port, protocolversion, false, "");
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,7 @@ namespace MinecraftClient
|
||||||
/// <param name="protocolversion">Minecraft protocol version to use</param>
|
/// <param name="protocolversion">Minecraft protocol version to use</param>
|
||||||
/// <param name="command">The text or command to send.</param>
|
/// <param name="command">The text or command to send.</param>
|
||||||
|
|
||||||
public McTcpClient(string username, string uuid, string sessionID, string server_ip, short port, int protocolversion, string command)
|
public McTcpClient(string username, string uuid, string sessionID, string server_ip, int port, int protocolversion, string command)
|
||||||
{
|
{
|
||||||
StartClient(username, uuid, sessionID, server_ip, port, protocolversion, true, command);
|
StartClient(username, uuid, sessionID, server_ip, port, protocolversion, true, command);
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +86,7 @@ namespace MinecraftClient
|
||||||
/// <param name="singlecommand">If set to true, the client will send a single command and then disconnect from the server</param>
|
/// <param name="singlecommand">If set to true, the client will send a single command and then disconnect from the server</param>
|
||||||
/// <param name="command">The text or command to send. Will only be sent if singlecommand is set to true.</param>
|
/// <param name="command">The text or command to send. Will only be sent if singlecommand is set to true.</param>
|
||||||
|
|
||||||
private void StartClient(string user, string uuid, string sessionID, string server_ip, short port, int protocolversion, bool singlecommand, string command)
|
private void StartClient(string user, string uuid, string sessionID, string server_ip, int port, int protocolversion, bool singlecommand, string command)
|
||||||
{
|
{
|
||||||
this.sessionid = sessionID;
|
this.sessionid = sessionID;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ namespace MinecraftClient.Protocol
|
||||||
/// <param name="protocolversion">Will contain protocol version, if ping successful</param>
|
/// <param name="protocolversion">Will contain protocol version, if ping successful</param>
|
||||||
/// <returns>TRUE if ping was successful</returns>
|
/// <returns>TRUE if ping was successful</returns>
|
||||||
|
|
||||||
public static bool GetServerInfo(string serverIP, short serverPort, ref int protocolversion)
|
public static bool GetServerInfo(string serverIP, int serverPort, ref int protocolversion)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace MinecraftClient
|
||||||
public static string Username = "";
|
public static string Username = "";
|
||||||
public static string Password = "";
|
public static string Password = "";
|
||||||
public static string ServerIP = "";
|
public static string ServerIP = "";
|
||||||
public static short ServerPort = 25565;
|
public static int ServerPort = 25565;
|
||||||
public static string ServerVersion = "";
|
public static string ServerVersion = "";
|
||||||
public static string SingleCommand = "";
|
public static string SingleCommand = "";
|
||||||
public static string ConsoleTitle = "";
|
public static string ConsoleTitle = "";
|
||||||
|
|
@ -90,7 +90,7 @@ namespace MinecraftClient
|
||||||
//Custom app variables and Minecraft accounts
|
//Custom app variables and Minecraft accounts
|
||||||
private static Dictionary<string, string> AppVars = new Dictionary<string, string>();
|
private static Dictionary<string, string> AppVars = new Dictionary<string, string>();
|
||||||
private static Dictionary<string, KeyValuePair<string, string>> Accounts = new Dictionary<string, KeyValuePair<string, string>>();
|
private static Dictionary<string, KeyValuePair<string, string>> Accounts = new Dictionary<string, KeyValuePair<string, string>>();
|
||||||
private static Dictionary<string, KeyValuePair<string, short>> Servers = new Dictionary<string, KeyValuePair<string, short>>();
|
private static Dictionary<string, KeyValuePair<string, int>> Servers = new Dictionary<string, KeyValuePair<string, int>>();
|
||||||
|
|
||||||
private enum ParseMode { Default, Main, AppVars, Proxy, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl };
|
private enum ParseMode { Default, Main, AppVars, Proxy, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl };
|
||||||
|
|
||||||
|
|
@ -186,7 +186,7 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
//Backup current server info
|
//Backup current server info
|
||||||
string server_host_temp = ServerIP;
|
string server_host_temp = ServerIP;
|
||||||
short server_port_temp = ServerPort;
|
int server_port_temp = ServerPort;
|
||||||
|
|
||||||
foreach (string server_line in File.ReadAllLines(argValue))
|
foreach (string server_line in File.ReadAllLines(argValue))
|
||||||
{
|
{
|
||||||
|
|
@ -198,7 +198,7 @@ namespace MinecraftClient
|
||||||
&& !server_data[0].Contains('.')
|
&& !server_data[0].Contains('.')
|
||||||
&& setServerIP(server_data[1]))
|
&& setServerIP(server_data[1]))
|
||||||
Servers[server_data[0]]
|
Servers[server_data[0]]
|
||||||
= new KeyValuePair<string, short>(ServerIP, ServerPort);
|
= new KeyValuePair<string, int>(ServerIP, ServerPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restore current server info
|
//Restore current server info
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue