Skip to content

Commit

Permalink
re-use dependency from game lib
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkyAI committed Jan 8, 2021
1 parent 0f1f301 commit 234c49c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
9 changes: 8 additions & 1 deletion Matterbridge.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@
<Private>False</Private>
</Reference>
-->
<Reference Include="Newtonsoft.Json">
<HintPath>$(VINTAGE_STORY)/Lib/Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="websocket-sharp">
<HintPath>$(VINTAGE_STORY)/Lib/websocket-sharp.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="WebSocket4Net" Version="0.15.2" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion modinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "$Version$",

"description" : "$Description$",
"website": "https://github.com/NikkyAI/vs-matterbridge",
"website": "$Website$",
"authors": [ "$Author$" ],

"side": "Server",
Expand Down
2 changes: 1 addition & 1 deletion src/MatterbridgeMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public override void StartServerSide(ICoreServerAPI api)

public override void Dispose()
{
WebsocketHandler.Close();
WebsocketHandler.Dispose();
base.Dispose();
}

Expand Down
11 changes: 10 additions & 1 deletion src/WebsocketHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Matterbridge
{
internal class WebsocketHandler
internal class WebsocketHandler : IDisposable
{
private readonly ICoreServerAPI _api;
private readonly Mod _mod;
Expand Down Expand Up @@ -236,5 +236,14 @@ private void websocket_MessageReceived(object sender, MessageReceivedEventArgs e
}
}
}

public void Dispose()
{
if (_websocket != null)
{
_websocket.Close();
((IDisposable) _websocket).Dispose();
}
}
}
}

0 comments on commit 234c49c

Please sign in to comment.