Skip to content

Commit 2358706

Browse files
committed
Changed _address and _port to private fields
1 parent 03a2ede commit 2358706

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

MCQuery/Connection.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace MCQuery
77
{
88
public abstract class Connection : IDisposable
99
{
10-
protected internal string _address = "";
11-
protected internal int _port = 0;
10+
private string _address = "";
11+
private int _port = 0;
1212

1313
private UdpClient _udpClient;
1414
private TcpClient _tcpClient;

MCQuery/Query.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5-
using System.Threading.Tasks;
65
using System.Timers;
76

87
namespace MCQuery
98
{
10-
public class Query : Connection
9+
public class Query : Connection
1110
{
1211
//Byte[] - Magic Number
1312
private readonly byte[] _magic = { 0xFE, 0xFD };
@@ -98,7 +97,7 @@ private byte[] GetFullStat(string address, int port)
9897

9998
public Server GetBasicServerInfo()
10099
{
101-
byte[] responseData = GetBasicStat(_address, _port);
100+
byte[] responseData = GetBasicStat(base.Address, base.Port);
102101

103102
if (responseData.Length != 0)
104103
{
@@ -139,7 +138,7 @@ public Server GetBasicServerInfo()
139138

140139
public Server GetFullServerInfo()
141140
{
142-
byte[] responseData = GetFullStat(_address, _port);
141+
byte[] responseData = GetFullStat(base.Address, base.Port);
143142

144143
if (responseData.Length != 0)
145144
{
@@ -223,7 +222,7 @@ private byte[] GetChallengeToken(byte[] message)
223222
private void RegenerateChallengeToken(Object sender, ElapsedEventArgs e)
224223
{
225224
//Run handshake again to obtain new challenge token.
226-
Handshake(_address, _port);
225+
Handshake(base.Address, base.Port);
227226
}
228227

229228
public override bool IsConnected => _challengeToken != null || _challengeToken.Length > 0;

MCQuery/Rcon.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public bool Login()
4040
message.AddRange(Encoding.UTF8.GetBytes(_password));
4141
message.AddRange(_twoBytePad);
4242

43-
byte[] response = SendByTcp(_address, _port, message.ToArray());
43+
byte[] response = SendByTcp(base.Address, base.Port, message.ToArray());
4444

4545
foreach (byte item in response)
4646
{
@@ -66,7 +66,7 @@ public bool SendCommand(string command)
6666
message.AddRange(Encoding.UTF8.GetBytes(command));
6767
message.AddRange(_twoBytePad);
6868

69-
byte[] response = SendByTcp(_address, _port, message.ToArray());
69+
byte[] response = SendByTcp(base.Address, base.Port, message.ToArray());
7070
bool didSucceeed = false;
7171

7272
foreach (byte item in response)

0 commit comments

Comments
 (0)