Skip to content

Commit 7b42bbf

Browse files
committed
Added XML documentation to public methods
1 parent d531798 commit 7b42bbf

13 files changed

+439
-12
lines changed

MLAPI/Attributes/SyncedVar.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33
namespace MLAPI.Attributes
44
{
5+
/// <summary>
6+
/// The attribute to use for variables that should be automatically. replicated from Server to Client.
7+
/// </summary>
58
[AttributeUsage(AttributeTargets.Field)]
69
public class SyncedVar : Attribute
710
{
11+
/// <summary>
12+
/// The method name to invoke when the SyncVar get's updated.
13+
/// </summary>
814
public string hook;
915

1016
public SyncedVar()

MLAPI/Data/ClientIdKey.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
namespace MLAPI.Data
22
{
3-
struct ClientIdKey
3+
/// <summary>
4+
/// A struct representing a client. Contains a hostId and a connectionId.
5+
/// </summary>
6+
internal struct ClientIdKey
47
{
8+
/// <summary>
9+
/// The NetworkTransport hostId
10+
/// </summary>
511
internal readonly int hostId;
12+
/// <summary>
13+
/// The NetworkTransport connectionId
14+
/// </summary>
615
internal readonly int connectionId;
716

17+
/// <summary>
18+
/// Creates a new ClientIdKey
19+
/// </summary>
20+
/// <param name="hostId">The NetworkTransport hostId</param>
21+
/// <param name="connectionId">The NetworkTransport connectionId</param>
822
internal ClientIdKey (int hostId, int connectionId)
923
{
1024
this.hostId = hostId;

MLAPI/Data/FieldType.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace MLAPI.Data
22
{
3+
/// <summary>
4+
/// The datatype used to classify SyncedVars
5+
/// </summary>
36
internal enum FieldType
47
{
58
Bool,

MLAPI/Data/NetworkedClient.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,26 @@
33

44
namespace MLAPI
55
{
6+
/// <summary>
7+
/// A NetworkedClient
8+
/// </summary>
69
public class NetworkedClient
710
{
11+
/// <summary>
12+
/// The Id of the NetworkedClient
13+
/// </summary>
814
public int ClientId;
15+
/// <summary>
16+
/// The PlayerObject of the Client
17+
/// </summary>
918
public GameObject PlayerObject;
19+
/// <summary>
20+
/// The NetworkedObject's owned by this Client
21+
/// </summary>
1022
public List<NetworkedObject> OwnedObjects = new List<NetworkedObject>();
23+
/// <summary>
24+
/// The encryption key used for this client
25+
/// </summary>
1126
public byte[] AesKey;
1227
}
1328
}

MLAPI/Data/NetworkingConfiguration.cs

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,123 @@ namespace MLAPI
88
{
99
public class NetworkingConfiguration
1010
{
11+
/// <summary>
12+
/// The protocol version. Different versions doesn't talk to each other.
13+
/// </summary>
1114
public ushort ProtocolVersion = 0;
15+
/// <summary>
16+
/// Channels used by the NetworkedTransport
17+
/// </summary>
1218
public SortedDictionary<string, QosType> Channels = new SortedDictionary<string, QosType>();
19+
/// <summary>
20+
/// Registered MessageTypes
21+
/// </summary>
1322
public List<string> MessageTypes = new List<string>();
23+
/// <summary>
24+
/// List of MessageTypes that can be passed through by Server. MessageTypes in this list should thus not be trusted to as great of an extent as normal messages.
25+
/// </summary>
1426
public List<string> PassthroughMessageTypes = new List<string>();
27+
/// <summary>
28+
/// Internal collection of Passthrough MessageTypes
29+
/// </summary>
1530
internal HashSet<ushort> RegisteredPassthroughMessageTypes = new HashSet<ushort>();
31+
/// <summary>
32+
/// Set of channels that will have all message contents encrypted when used
33+
/// </summary>
1634
public HashSet<int> EncryptedChannels = new HashSet<int>();
35+
/// <summary>
36+
/// A list of SceneNames that can be used during networked games.
37+
/// </summary>
1738
public List<string> RegisteredScenes = new List<string>();
39+
/// <summary>
40+
/// The size of the receive message buffer. This is the max message size.
41+
/// </summary>
1842
public int MessageBufferSize = 65535;
43+
/// <summary>
44+
/// Amount of times per second the receive queue is emptied and all messages inside are processed.
45+
/// </summary>
1946
public int ReceiveTickrate = 64;
47+
/// <summary>
48+
/// The max amount of messages to process per ReceiveTickrate. This is to prevent flooding.
49+
/// </summary>
2050
public int MaxReceiveEventsPerTickRate = 500;
51+
/// <summary>
52+
/// The amount of times per second every pending message will be sent away.
53+
/// </summary>
2154
public int SendTickrate = 64;
55+
/// <summary>
56+
/// The amount of times per second internal frame events will occur, examples include SyncedVar send checking.
57+
/// </summary>
2258
public int EventTickrate = 64;
59+
/// <summary>
60+
/// The max amount of Clients that can connect.
61+
/// </summary>
2362
public int MaxConnections = 100;
63+
/// <summary>
64+
/// The port for the NetworkTransport to use
65+
/// </summary>
2466
public int Port = 7777;
67+
/// <summary>
68+
/// The address to connect to
69+
/// </summary>
2570
public string Address = "127.0.0.1";
71+
/// <summary>
72+
/// The amount of seconds to wait for handshake to complete before timing out a client
73+
/// </summary>
2674
public int ClientConnectionBufferTimeout = 10;
75+
/// <summary>
76+
/// Wheter or not to use connection approval
77+
/// </summary>
2778
public bool ConnectionApproval = false;
79+
/// <summary>
80+
/// The callback to invoke when a connection has to be decided if it should get approved
81+
/// </summary>
2882
public Action<byte[], int, Action<int, bool>> ConnectionApprovalCallback = null;
83+
/// <summary>
84+
/// The data to send during connection which can be used to decide on if a client should get accepted
85+
/// </summary>
2986
public byte[] ConnectionData = new byte[0];
87+
/// <summary>
88+
/// The amount of seconds to keep a lag compensation position history
89+
/// </summary>
3090
public float SecondsHistory = 5;
91+
/// <summary>
92+
/// Wheter or not to make the library handle object spawning
93+
/// </summary>
3194
public bool HandleObjectSpawning = true;
32-
95+
/// <summary>
96+
/// Wheter or not to enable encryption
97+
/// </summary>
3398
public bool EnableEncryption = true;
99+
/// <summary>
100+
/// Wheter or not to enable signed diffie hellman key exchange.
101+
/// </summary>
34102
public bool SignKeyExchange = true;
103+
/// <summary>
104+
/// Private RSA XML key to use for signing key exchange
105+
/// </summary>
35106
public string RSAPrivateKey = "<RSAKeyValue><Modulus>vBEvOQki/EftWOgwh4G8/nFRvcDJLylc8P7Dhz5m/hpkkNtAMzizNKYUrGbs7sYWlEuMYBOWrzkIDGOMoOsYc9uCi+8EcmNoHDlIhK5yNfZUexYBF551VbvZ625LSBR7kmBxkyo4IPuA09fYCHeUFm3prt4h6aTD0Hjc7ZsJHUU=</Modulus><Exponent>EQ==</Exponent><P>ydgcrq5qLJOdDQibD3m9+o3/dkKoFeCC110dnMgdpEteCruyBdL0zjGKKvjjgy3XTSSp43EN591NiXaBp0JtDw==</P><Q>7obHrUnUCsSHUsIJ7+JOrupcGrQ0XaYcQ+Uwb2v7d2YUzwZ46U4gI9snfD2J0tc3DGEh3v3G0Q8q7bxEe3H4aw==</Q><DP>L34k3c6vkgSdbHp+1nb/hj+HZx6+I0PijQbZyolwYuSOmR0a1DGjA1bzVWe9D86NAxevgM9OkOjG8yrxVIgZqQ==</DP><DQ>OB+2gyBuIKa2bdNNodrlVlVC2RtXnZB/HwjAGjeGdnJfP8VJoE6eJo3rLEq3BG7fxq1xYaUfuLhGVg4uOyngGQ==</DQ><InverseQ>o97PimYu58qH5eFmySRCIsyhBr/tK2GM17Zd9QQPJZRSorrhIJn1m6gwQ/G5aJLIM/3Yl04CoyqmQGsPXMzW2w==</InverseQ><D>CxAR1i22w4vCquB7U0Pd8Nl9R2Wxez6rHTwpnoszPB+rkAzlqKj7e5FMgpykhoQfciKPyWqQZKkAeTMIRbN56JinvpAt5POId/28HDd5xjGymHE81k3RzoHqzQXFIOF1TSYKUWzjPPF/TU4nn7auD4i6lOODATsMqtLr5DRBN/0=</D></RSAKeyValue>"; //CHANGE THESE FOR PRODUCTION!
107+
/// <summary>
108+
/// Public RSA XML key to use for signing key exchange
109+
/// </summary>
36110
public string RSAPublicKey = "<RSAKeyValue><Modulus>vBEvOQki/EftWOgwh4G8/nFRvcDJLylc8P7Dhz5m/hpkkNtAMzizNKYUrGbs7sYWlEuMYBOWrzkIDGOMoOsYc9uCi+8EcmNoHDlIhK5yNfZUexYBF551VbvZ625LSBR7kmBxkyo4IPuA09fYCHeUFm3prt4h6aTD0Hjc7ZsJHUU=</Modulus><Exponent>EQ==</Exponent></RSAKeyValue>"; //CHANGE THESE FOR PRODUCTION!
37-
111+
/// <summary>
112+
/// Wheter or not to allow any type of passthrough messages
113+
/// </summary>
38114
public bool AllowPassthroughMessages = true;
115+
/// <summary>
116+
/// Wheter or not to enable scene switching
117+
/// </summary>
39118
public bool EnableSceneSwitching = false;
40119

41120
//Cached config hash
42121
private byte[] ConfigHash = null;
122+
123+
/// <summary>
124+
/// Gets a SHA256 hash of parts of the NetworkingConfiguration instance
125+
/// </summary>
126+
/// <param name="cache"></param>
127+
/// <returns></returns>
43128
public byte[] GetConfig(bool cache = true)
44129
{
45130
if (ConfigHash != null && cache)
@@ -92,6 +177,11 @@ public byte[] GetConfig(bool cache = true)
92177
}
93178
}
94179

180+
/// <summary>
181+
/// Compares a SHA256 hash with the current NetworkingConfiguration instances hash
182+
/// </summary>
183+
/// <param name="hash"></param>
184+
/// <returns></returns>
95185
public bool CompareConfig(byte[] hash)
96186
{
97187
byte[] localConfigHash = GetConfig();

0 commit comments

Comments
 (0)