Skip to content

Commit 45a8691

Browse files
authored
Merge pull request #179 from MidLevel/refactor
refactor: Remove compiler warnings
2 parents bd990dd + 718676b commit 45a8691

File tree

9 files changed

+345
-825
lines changed

9 files changed

+345
-825
lines changed

MLAPI/Data/MLAPIConstants.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@
33
/// <summary>
44
/// A static class containing MLAPI constants
55
/// </summary>
6-
public static class MLAPIConstants
6+
internal static class MLAPIConstants
77
{
8-
public const string MLAPI_PROTOCOL_VERSION = "6.0.1";
8+
internal const string MLAPI_PROTOCOL_VERSION = "6.0.1";
99

10-
public const byte MLAPI_CERTIFICATE_HAIL = 0;
11-
public const byte MLAPI_CERTIFICATE_HAIL_RESPONSE = 1;
12-
public const byte MLAPI_GREETINGS = 2;
13-
public const byte MLAPI_CONNECTION_REQUEST = 3;
14-
public const byte MLAPI_CONNECTION_APPROVED = 4;
15-
public const byte MLAPI_ADD_OBJECT = 5;
16-
public const byte MLAPI_DESTROY_OBJECT = 6;
17-
public const byte MLAPI_SWITCH_SCENE = 7;
18-
public const byte MLAPI_CLIENT_SWITCH_SCENE_COMPLETED = 8;
19-
public const byte MLAPI_CHANGE_OWNER = 9;
20-
public const byte MLAPI_ADD_OBJECTS = 10;
21-
public const byte MLAPI_TIME_SYNC = 11;
22-
public const byte MLAPI_NETWORKED_VAR_DELTA = 12;
23-
public const byte MLAPI_NETWORKED_VAR_UPDATE = 13;
24-
public const byte MLAPI_SERVER_RPC = 14;
25-
public const byte MLAPI_SERVER_RPC_REQUEST = 15;
26-
public const byte MLAPI_SERVER_RPC_RESPONSE = 16;
27-
public const byte MLAPI_CLIENT_RPC = 17;
28-
public const byte MLAPI_CLIENT_RPC_REQUEST = 18;
29-
public const byte MLAPI_CLIENT_RPC_RESPONSE = 19;
30-
public const byte MLAPI_CUSTOM_MESSAGE = 20;
31-
public const byte INVALID = 32;
32-
33-
public static readonly string[] MESSAGE_NAMES = {
10+
internal const byte MLAPI_CERTIFICATE_HAIL = 0;
11+
internal const byte MLAPI_CERTIFICATE_HAIL_RESPONSE = 1;
12+
internal const byte MLAPI_GREETINGS = 2;
13+
internal const byte MLAPI_CONNECTION_REQUEST = 3;
14+
internal const byte MLAPI_CONNECTION_APPROVED = 4;
15+
internal const byte MLAPI_ADD_OBJECT = 5;
16+
internal const byte MLAPI_DESTROY_OBJECT = 6;
17+
internal const byte MLAPI_SWITCH_SCENE = 7;
18+
internal const byte MLAPI_CLIENT_SWITCH_SCENE_COMPLETED = 8;
19+
internal const byte MLAPI_CHANGE_OWNER = 9;
20+
internal const byte MLAPI_ADD_OBJECTS = 10;
21+
internal const byte MLAPI_TIME_SYNC = 11;
22+
internal const byte MLAPI_NETWORKED_VAR_DELTA = 12;
23+
internal const byte MLAPI_NETWORKED_VAR_UPDATE = 13;
24+
internal const byte MLAPI_SERVER_RPC = 14;
25+
internal const byte MLAPI_SERVER_RPC_REQUEST = 15;
26+
internal const byte MLAPI_SERVER_RPC_RESPONSE = 16;
27+
internal const byte MLAPI_CLIENT_RPC = 17;
28+
internal const byte MLAPI_CLIENT_RPC_REQUEST = 18;
29+
internal const byte MLAPI_CLIENT_RPC_RESPONSE = 19;
30+
internal const byte MLAPI_CUSTOM_MESSAGE = 20;
31+
internal const byte INVALID = 32;
32+
33+
internal static readonly string[] MESSAGE_NAMES = {
3434
"MLAPI_CERTIFICATE_HAIL", // 0
3535
"MLAPI_CERTIFICATE_HAIL_RESPONSE",
3636
"MLAPI_GREETINGS",

MLAPI/MLAPI.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,8 @@
2222
</ItemGroup>
2323
<ItemGroup>
2424
</ItemGroup>
25+
<ItemGroup>
26+
<Compile Remove="NetworkingManagerComponents\Binary\BitWriterDeprecated.cs" />
27+
<Compile Remove="NetworkingManagerComponents\Binary\BitReaderDeprecated.cs" />
28+
</ItemGroup>
2529
</Project>

MLAPI/MonoBehaviours/Prototyping/NetworkedAnimator.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ public class NetworkedAnimator : NetworkedBehaviour
3636

3737

3838
// tracking - these should probably move to a Preview component. -- Comment from HLAPI. Needs clarification
39+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
3940
public string param0;
4041
public string param1;
4142
public string param2;
4243
public string param3;
4344
public string param4;
4445
public string param5;
46+
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
47+
4548

4649
/// <summary>
4750
/// Gets or sets the animator component used for syncing the animations

MLAPI/NetworkingManagerComponents/Binary/Arithmetic.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
namespace MLAPI.Serialization
22
{
3+
/// <summary>
4+
/// Arithmetic helper class
5+
/// </summary>
36
public static class Arithmetic
47
{
58
// Sign bits for different data types
6-
public const long SIGN_BIT_64 = -9223372036854775808;
7-
public const int SIGN_BIT_32 = -2147483648;
8-
public const short SIGN_BIT_16 = -32768;
9-
public const sbyte SIGN_BIT_8 = -128;
9+
internal const long SIGN_BIT_64 = -9223372036854775808;
10+
internal const int SIGN_BIT_32 = -2147483648;
11+
internal const short SIGN_BIT_16 = -32768;
12+
internal const sbyte SIGN_BIT_8 = -128;
1013

1114
// Ceiling function that doesn't deal with floating point values
1215
// these only work correctly with possitive numbers
13-
public static ulong CeilingExact(ulong u1, ulong u2) => (u1 + u2 - 1) / u2;
14-
public static long CeilingExact(long u1, long u2) => (u1 + u2 - 1) / u2;
15-
public static uint CeilingExact(uint u1, uint u2) => (u1 + u2 - 1) / u2;
16-
public static int CeilingExact(int u1, int u2) => (u1 + u2 - 1) / u2;
17-
public static ushort CeilingExact(ushort u1, ushort u2) => (ushort)((u1 + u2 - 1) / u2);
18-
public static short CeilingExact(short u1, short u2) => (short)((u1 + u2 - 1) / u2);
19-
public static byte CeilingExact(byte u1, byte u2) => (byte)((u1 + u2 - 1) / u2);
20-
public static sbyte CeilingExact(sbyte u1, sbyte u2) => (sbyte)((u1 + u2 - 1) / u2);
16+
internal static ulong CeilingExact(ulong u1, ulong u2) => (u1 + u2 - 1) / u2;
17+
internal static long CeilingExact(long u1, long u2) => (u1 + u2 - 1) / u2;
18+
internal static uint CeilingExact(uint u1, uint u2) => (u1 + u2 - 1) / u2;
19+
internal static int CeilingExact(int u1, int u2) => (u1 + u2 - 1) / u2;
20+
internal static ushort CeilingExact(ushort u1, ushort u2) => (ushort)((u1 + u2 - 1) / u2);
21+
internal static short CeilingExact(short u1, short u2) => (short)((u1 + u2 - 1) / u2);
22+
internal static byte CeilingExact(byte u1, byte u2) => (byte)((u1 + u2 - 1) / u2);
23+
internal static sbyte CeilingExact(sbyte u1, sbyte u2) => (sbyte)((u1 + u2 - 1) / u2);
2124

2225
/// <summary>
2326
/// ZigZag encodes a signed integer and maps it to a unsigned integer

MLAPI/NetworkingManagerComponents/Binary/BinaryHelpers.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
namespace MLAPI.Serialization
22
{
3+
/// <summary>
4+
/// Binary helper class
5+
/// </summary>
36
public static class BinaryHelpers
47
{
5-
// Swap endianness of a given integer
8+
/// <summary>
9+
/// Swaps the endianness of a given integer
10+
/// </summary>
11+
/// <returns>The integer with swapped endianness</returns>
12+
/// <param name="value">The integer to swap endianess</param>
613
public static uint SwapEndian(uint value) => (uint)(((value >> 24) & (255 << 0)) | ((value >> 8) & (255 << 8)) | ((value << 8) & (255 << 16)) | ((value << 24) & (255 << 24)));
14+
/// <summary>
15+
/// Swaps the endianness of a given integer
16+
/// </summary>
17+
/// <returns>The integer with swapped endianness</returns>
18+
/// <param name="value">The integer to swap endianess</param>
719
public static ulong SwapEndian(ulong value) =>
820
((value >> 56) & 0xFF) |
921
((value >> 40) & (0xFFUL << 8)) |

0 commit comments

Comments
 (0)