Skip to content

Commit 3ae8853

Browse files
committed
refactor: Moved RufflesTransport to its own project
1 parent c80edb2 commit 3ae8853

File tree

7 files changed

+59
-44
lines changed

7 files changed

+59
-44
lines changed

.releaserc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
["@semantic-release/github", {
1010
"assets": [
1111
{"path": "MLAPI/bin/Release/net35/MLAPI.dll"},
12-
{"path": "MLAPI/bin/Release/net35/Ruffles.dll"},
1312
{"path": "*.unitypackage"}
1413
]
1514
}]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<Import Project="../common.props" />
3+
<PropertyGroup>
4+
<ImplicitlyExpandNETStandardFacades>false</ImplicitlyExpandNETStandardFacades>
5+
<DisableHandlePackageFileConflicts>true</DisableHandlePackageFileConflicts>
6+
<AssemblyTitle>MLAPI.RufflesTransport</AssemblyTitle>
7+
<Product>MLAPI.RufflesTransport</Product>
8+
<Description>Ruffles Transport for MLAPI</Description>
9+
<Version>1.0.0</Version>
10+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11+
<TargetFrameworks>net35;net471;net45;netstandard2.0</TargetFrameworks>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
16+
<HintPath>..\Libraries\Unity\UnityEngine.dll</HintPath>
17+
<SpecificVersion>False</SpecificVersion>
18+
<Private>false</Private>
19+
</Reference>
20+
</ItemGroup>
21+
<ItemGroup>
22+
<PackageReference Include="Ruffles" Version="1.0.5" />
23+
</ItemGroup>
24+
<ItemGroup>
25+
<ProjectReference Include="..\MLAPI\MLAPI.csproj" />
26+
</ItemGroup>
27+
</Project>

MLAPI/Transports/Ruffles/RufflesTransport.cs renamed to MLAPI.RufflesTransport/RufflesTransport.cs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@
44
using Ruffles.Core;
55
using Ruffles.Configuration;
66
using System.Net;
7+
using MLAPI.Transports;
78

8-
namespace MLAPI.Transports.Ruffles
9+
namespace MLAPI.RufflesTransport
910
{
1011
public class RufflesTransport : Transport
1112
{
13+
[Serializable]
14+
public class RufflesChannel
15+
{
16+
public string Name;
17+
public Ruffles.Channeling.ChannelType Type;
18+
}
19+
1220
// Inspector / settings
1321
public int MessageBufferSize = 1024 * 5;
1422
public int MaxConnections = 100;
@@ -23,10 +31,10 @@ public class RufflesTransport : Transport
2331
private bool isConnector = false;
2432

2533
// Lookup / translation
26-
private readonly Dictionary<ulong, global::Ruffles.Connections.Connection> connections = new Dictionary<ulong, global::Ruffles.Connections.Connection>();
34+
private readonly Dictionary<ulong, Ruffles.Connections.Connection> connections = new Dictionary<ulong, Ruffles.Connections.Connection>();
2735
private readonly Dictionary<string, byte> channelNameToId = new Dictionary<string, byte>();
2836
private readonly Dictionary<byte, string> channelIdToName = new Dictionary<byte, string>();
29-
private global::Ruffles.Connections.Connection serverConnection;
37+
private Ruffles.Connections.Connection serverConnection;
3038

3139
// Ruffles
3240
private RuffleSocket socket;
@@ -181,7 +189,7 @@ public ulong GetMLAPIClientId(ulong connectionId, bool isServer)
181189
}
182190
else
183191
{
184-
return (ulong)connectionId + 1;
192+
return connectionId + 1;
185193
}
186194
}
187195

@@ -202,7 +210,7 @@ private SocketConfig GetConfig()
202210
SocketConfig config = new SocketConfig();
203211

204212
int channelCount = MLAPI_CHANNELS.Length + Channels.Count;
205-
config.ChannelTypes = new global::Ruffles.Channeling.ChannelType[channelCount];
213+
config.ChannelTypes = new Ruffles.Channeling.ChannelType[channelCount];
206214

207215
for (byte i = 0; i < MLAPI_CHANNELS.Length; i++)
208216
{
@@ -221,25 +229,24 @@ private SocketConfig GetConfig()
221229
return config;
222230
}
223231

224-
private global::Ruffles.Channeling.ChannelType ConvertChannelType(ChannelType type)
232+
private Ruffles.Channeling.ChannelType ConvertChannelType(ChannelType type)
225233
{
226234
switch (type)
227235
{
228236
case ChannelType.Reliable:
229-
return global::Ruffles.Channeling.ChannelType.Reliable;
237+
return Ruffles.Channeling.ChannelType.Reliable;
230238
case ChannelType.ReliableFragmentedSequenced:
231-
return global::Ruffles.Channeling.ChannelType.ReliableSequenced;
239+
return Ruffles.Channeling.ChannelType.ReliableSequenced;
232240
case ChannelType.ReliableSequenced:
233-
return global::Ruffles.Channeling.ChannelType.ReliableSequenced;
241+
return Ruffles.Channeling.ChannelType.ReliableSequenced;
234242
case ChannelType.StateUpdate:
235-
return global::Ruffles.Channeling.ChannelType.Unreliable;
243+
return Ruffles.Channeling.ChannelType.Unreliable;
236244
case ChannelType.Unreliable:
237-
return global::Ruffles.Channeling.ChannelType.Unreliable;
245+
return Ruffles.Channeling.ChannelType.Unreliable;
238246
}
239247

240-
return global::Ruffles.Channeling.ChannelType.Reliable;
248+
return Ruffles.Channeling.ChannelType.Reliable;
241249
}
242250
}
243251
}
244-
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
245-
252+
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member

MLAPI.sln

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.27130.2027
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MLAPI", "MLAPI\MLAPI.csproj", "{EE431720-A9ED-43DC-9E74-10B693816D38}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLAPI", "MLAPI\MLAPI.csproj", "{EE431720-A9ED-43DC-9E74-10B693816D38}"
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MLAPI-Editor", "MLAPI-Editor\MLAPI-Editor.csproj", "{A45DBD43-D640-4562-9F24-6745269CEDF7}"
99
EndProject
@@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MLAPI-Examples", "MLAPI-Exa
1313
EndProject
1414
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLAPI.EnetTransport", "MLAPI.EnetTransport\MLAPI.EnetTransport.csproj", "{059FA226-17AB-4BD4-92BC-BCE3574FCAA0}"
1515
EndProject
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLAPI.RufflesTransport", "MLAPI.RufflesTransport\MLAPI.RufflesTransport.csproj", "{E05E5DBB-A5E0-4BA1-ABFF-99DC463EA3C0}"
17+
EndProject
1618
Global
1719
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1820
Debug_Lite|Any CPU = Debug_Lite|Any CPU
@@ -61,6 +63,14 @@ Global
6163
{059FA226-17AB-4BD4-92BC-BCE3574FCAA0}.Release_Lite|Any CPU.Build.0 = Debug|Any CPU
6264
{059FA226-17AB-4BD4-92BC-BCE3574FCAA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
6365
{059FA226-17AB-4BD4-92BC-BCE3574FCAA0}.Release|Any CPU.Build.0 = Release|Any CPU
66+
{E05E5DBB-A5E0-4BA1-ABFF-99DC463EA3C0}.Debug_Lite|Any CPU.ActiveCfg = Debug|Any CPU
67+
{E05E5DBB-A5E0-4BA1-ABFF-99DC463EA3C0}.Debug_Lite|Any CPU.Build.0 = Debug|Any CPU
68+
{E05E5DBB-A5E0-4BA1-ABFF-99DC463EA3C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
69+
{E05E5DBB-A5E0-4BA1-ABFF-99DC463EA3C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
70+
{E05E5DBB-A5E0-4BA1-ABFF-99DC463EA3C0}.Release_Lite|Any CPU.ActiveCfg = Debug|Any CPU
71+
{E05E5DBB-A5E0-4BA1-ABFF-99DC463EA3C0}.Release_Lite|Any CPU.Build.0 = Debug|Any CPU
72+
{E05E5DBB-A5E0-4BA1-ABFF-99DC463EA3C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
73+
{E05E5DBB-A5E0-4BA1-ABFF-99DC463EA3C0}.Release|Any CPU.Build.0 = Release|Any CPU
6474
EndGlobalSection
6575
GlobalSection(SolutionProperties) = preSolution
6676
HideSolutionNode = FALSE

MLAPI/MLAPI.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,4 @@
2020
<Private>false</Private>
2121
</Reference>
2222
</ItemGroup>
23-
<ItemGroup>
24-
<PackageReference Include="Ruffles" Version="1.0.5" />
25-
</ItemGroup>
2623
</Project>

MLAPI/Transports/Ruffles/RufflesChannel.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

appveyor.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ for:
3838
- configuration: Debug
3939
artifacts:
4040
- path: 'MLAPI\bin\Debug\*\*MLAPI*'
41-
- path: 'MLAPI\bin\Debug\*\*Ruffles*'
4241
test:
4342
assemblies:
4443
- 'MLAPI-Tests\bin\Debug\*\MLAPI-Tests.dll'
@@ -48,7 +47,6 @@ for:
4847
- configuration: Debug_Lite
4948
artifacts:
5049
- path: 'MLAPI\bin\Lite\Debug\*\*MLAPI*'
51-
- path: 'MLAPI\bin\Lite\Debug\*\*Ruffles*'
5250
test:
5351
assemblies:
5452
- 'MLAPI-Tests\bin\Lite\Debug\*\MLAPI-Tests.dll'
@@ -58,7 +56,6 @@ for:
5856
- configuration: Release
5957
artifacts:
6058
- path: 'MLAPI\bin\Release\*\*MLAPI*'
61-
- path: 'MLAPI\bin\Release\*\*Ruffles*'
6259
test:
6360
assemblies:
6461
- 'MLAPI-Tests\bin\Release\*\MLAPI-Tests.dll'
@@ -74,7 +71,6 @@ for:
7471
- configuration: Release_Lite
7572
artifacts:
7673
- path: 'MLAPI\bin\Lite\Release\*\*MLAPI*'
77-
- path: 'MLAPI\bin\Lite\Release\*\*Ruffles*'
7874
test:
7975
assemblies:
8076
- 'MLAPI-Tests\bin\Lite\Release\*\MLAPI-Tests.dll'

0 commit comments

Comments
 (0)