Skip to content

Commit 6582da8

Browse files
committed
editor networking updates
1 parent 5cccd3a commit 6582da8

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed
0 Bytes
Binary file not shown.

Intersect.Editor/Networking/Network.cs

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,50 @@
1818
namespace Intersect.Editor.Networking
1919
{
2020

21+
internal sealed class VirtualApplicationContext : IApplicationContext
22+
{
23+
public VirtualApplicationContext(IPacketHelper packetHelper)
24+
{
25+
PacketHelper = packetHelper;
26+
}
27+
28+
public bool HasErrors => throw new NotImplementedException();
29+
30+
public bool IsDisposed => throw new NotImplementedException();
31+
32+
public bool IsStarted => throw new NotImplementedException();
33+
34+
public bool IsRunning => throw new NotImplementedException();
35+
36+
public ICommandLineOptions StartupOptions => throw new NotImplementedException();
37+
38+
public Logger Logger => throw new NotImplementedException();
39+
40+
public IPacketHelper PacketHelper { get; }
41+
42+
public List<IApplicationService> Services => throw new NotImplementedException();
43+
44+
public void Dispose()
45+
{
46+
throw new NotImplementedException();
47+
}
48+
49+
public TApplicationService GetService<TApplicationService>() where TApplicationService : IApplicationService
50+
{
51+
throw new NotImplementedException();
52+
}
53+
54+
public void Start(bool lockUntilShutdown = true)
55+
{
56+
throw new NotImplementedException();
57+
}
58+
59+
public LockingActionQueue StartWithActionQueue()
60+
{
61+
throw new NotImplementedException();
62+
}
63+
}
64+
2165
internal static partial class Network
2266
{
2367

@@ -52,12 +96,13 @@ public static void InitNetwork()
5296
ClientConfiguration.Instance.Host, ClientConfiguration.Instance.Port
5397
);
5498

99+
var virtualApplicationContext = new VirtualApplicationContext(packetHelper);
55100
var assembly = Assembly.GetExecutingAssembly();
56101
using (var stream = assembly.GetManifestResourceStream("Intersect.Editor.network.handshake.bkey.pub"))
57102
{
58103
var rsaKey = new RsaKey(stream);
59104
Debug.Assert(rsaKey != null, "rsaKey != null");
60-
EditorLidgrenNetwork = new ClientNetwork(packetHelper, config, rsaKey.Parameters);
105+
EditorLidgrenNetwork = new ClientNetwork(virtualApplicationContext, config, rsaKey.Parameters);
61106
}
62107

63108
EditorLidgrenNetwork.Handler = PacketHandler.HandlePacket;

Intersect.Editor/Networking/PacketHandler.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ private sealed partial class VirtualPacketSender : IPacketSender
2525
{
2626
public IApplicationContext ApplicationContext { get; }
2727

28+
public INetwork Network => Networking.Network.EditorLidgrenNetwork;
29+
2830
public VirtualPacketSender(IApplicationContext applicationContext) =>
2931
ApplicationContext = applicationContext ?? throw new ArgumentNullException(nameof(applicationContext));
3032

@@ -35,7 +37,7 @@ public bool Send(IPacket packet)
3537
{
3638
if (packet is IntersectPacket intersectPacket)
3739
{
38-
Network.SendPacket(intersectPacket);
40+
Networking.Network.SendPacket(intersectPacket);
3941

4042
return true;
4143
}

0 commit comments

Comments
 (0)