Skip to content

Commit 54e4232

Browse files
Added ILMerge as a reference as it wasn't working between different machines (#14)
Tidy of some code Add System.Drawing.Color Extension method "ToUnity"
1 parent 63701b2 commit 54e4232

File tree

8 files changed

+31
-23
lines changed

8 files changed

+31
-23
lines changed

Assemblies/ILMerge.exe

727 KB
Binary file not shown.

TwitchLib.Unity/Api.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
42
using System.Net;
53
using System.Net.Security;
64
using System.Security.Cryptography.X509Certificates;
7-
using System.Text;
85
using System.Threading.Tasks;
96
using TwitchLib.Api;
107
using TwitchLib.Api.Interfaces;
11-
using TwitchLib.Api.Sections;
128
using UnityEngine;
139

1410
namespace TwitchLib.Unity

TwitchLib.Unity/Client.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ public Client() : base(null)
250250
base.OnRitualNewChatter += ((object sender, OnRitualNewChatterArgs e) => { ThreadDispatcher.Instance().Enqueue(() => OnRitualNewChatter?.Invoke(sender, e)); });
251251
base.OnFailureToReceiveJoinConfirmation += ((object sender, OnFailureToReceiveJoinConfirmationArgs e) => { ThreadDispatcher.Instance().Enqueue(() => OnFailureToReceiveJoinConfirmation?.Invoke(sender, e)); });
252252
base.OnUnaccountedFor += ((object sender, OnUnaccountedForArgs e) => { ThreadDispatcher.Instance().Enqueue(() => OnUnaccountedFor?.Invoke(sender, e)); });
253+
base.OnSelfRaidError += ((object sender, EventArgs e) => { ThreadDispatcher.Instance().Enqueue(() => OnSelfRaidError?.Invoke(sender, e)); });
254+
base.OnNoPermissionError += ((object sender, EventArgs e) => { ThreadDispatcher.Instance().Enqueue(() => OnNoPermissionError?.Invoke(sender, e)); });
253255
}
254256
}
255257
}

TwitchLib.Unity/ColorExtension.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace TwitchLib.Unity
8+
{
9+
public static class ColorExtension
10+
{
11+
public static UnityEngine.Color ToUnity(this System.Drawing.Color color)
12+
{
13+
return new UnityEngine.Color(color.R, color.G, color.B, color.A);
14+
}
15+
}
16+
17+
}

TwitchLib.Unity/ThreadDispatcher.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
74
using UnityEngine;
85

96
namespace TwitchLib.Unity

TwitchLib.Unity/TwitchLib.Unity.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@
4242
</Reference>
4343
</ItemGroup>
4444
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
45-
<Exec Command="del $(OutDir)*.pdb&#xD;&#xA;..\packages\ILMerge.2.14.1208\tools\ilmerge /out:$(OutDir)TwitchLib.Unity.dll $(OutDir)TwitchLib.Unity.dll $(OutDir)Microsoft.Extensions.Logging.Abstractions.dll $(OutDir)Newtonsoft.Json.dll $(OutDir)Serilog.dll $(OutDir)Serilog.Extensions.Logging.dll $(OutDir)SuperSocket.ClientEngine.dll $(OutDir)TwitchLib.Api.dll $(OutDir)TwitchLib.Client.dll $(OutDir)TwitchLib.PubSub.dll $(OutDir)WebSocket4Net.dll&#xD;&#xA;del $(OutDir)Microsoft.Extensions.Logging.Abstractions.dll &#xD;&#xA;del $(OutDir)Newtonsoft.Json.dll&#xD;&#xA;del $(OutDir)Serilog.dll &#xD;&#xA;del $(OutDir)Serilog.Extensions.Logging.dll &#xD;&#xA;del $(OutDir)SuperSocket.ClientEngine.dll &#xD;&#xA;del $(OutDir)TwitchLib.Api.dll &#xD;&#xA;del $(OutDir)TwitchLib.Client.dll &#xD;&#xA;del $(OutDir)TwitchLib.PubSub.dll &#xD;&#xA;del $(OutDir)WebSocket4Net.dll&#xD;&#xA;del $(OutDir)UnityEngine.*" />
45+
<Exec Command="del $(OutDir)*.pdb&#xD;&#xA;..\Assemblies\ilmerge /out:$(OutDir)TwitchLib.Unity.dll $(OutDir)TwitchLib.Unity.dll $(OutDir)Microsoft.Extensions.Logging.Abstractions.dll $(OutDir)Newtonsoft.Json.dll $(OutDir)Serilog.dll $(OutDir)Serilog.Extensions.Logging.dll $(OutDir)SuperSocket.ClientEngine.dll $(OutDir)TwitchLib.Api.dll $(OutDir)TwitchLib.Client.dll $(OutDir)TwitchLib.PubSub.dll $(OutDir)WebSocket4Net.dll&#xD;&#xA;del $(OutDir)Microsoft.Extensions.Logging.Abstractions.dll &#xD;&#xA;del $(OutDir)Newtonsoft.Json.dll&#xD;&#xA;del $(OutDir)Serilog.dll &#xD;&#xA;del $(OutDir)Serilog.Extensions.Logging.dll &#xD;&#xA;del $(OutDir)SuperSocket.ClientEngine.dll &#xD;&#xA;del $(OutDir)TwitchLib.Api.dll &#xD;&#xA;del $(OutDir)TwitchLib.Client.dll &#xD;&#xA;del $(OutDir)TwitchLib.PubSub.dll &#xD;&#xA;del $(OutDir)WebSocket4Net.dll&#xD;&#xA;del $(OutDir)UnityEngine.*" />
4646
</Target>
4747
</Project>

TwitchLib.Unity/UnityFollowerService.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
using System;
2-
using System.Net;
32
using UnityEngine;
4-
using TwitchLib.Api;
5-
using TwitchLib.Api.Enums;
63
using TwitchLib.Api.Interfaces;
74
using TwitchLib.Api.Services;
8-
using TwitchLib.Api.Services.Exceptions;
95
using TwitchLib.Api.Services.Events.FollowerService;
106

11-
namespace TwitchLib.Unity {
12-
public class UnityFollowerService : FollowerService {
7+
namespace TwitchLib.Unity
8+
{
9+
public class UnityFollowerService : FollowerService
10+
{
1311
private readonly GameObject _threadDispatcher;
1412

1513
#region Events
@@ -22,7 +20,7 @@ public class UnityFollowerService : FollowerService {
2220
#endregion
2321

2422
public UnityFollowerService(ITwitchAPI api, int checkIntervalSeconds = 60, int queryCount = 25) : base(api, checkIntervalSeconds, queryCount) {
25-
_threadDispatcher = new GameObject("ThreadDispatcher");
23+
_threadDispatcher = new GameObject("UnityFollowerServiceThreadDispatcher");
2624
_threadDispatcher.AddComponent<ThreadDispatcher>();
2725
UnityEngine.Object.DontDestroyOnLoad(_threadDispatcher);
2826

TwitchLib.Unity/UnityLiveStreamMonitor.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
using System;
2-
using System.Net;
32
using UnityEngine;
4-
using TwitchLib.Api;
5-
using TwitchLib.Api.Enums;
63
using TwitchLib.Api.Interfaces;
74
using TwitchLib.Api.Services;
8-
using TwitchLib.Api.Services.Exceptions;
95
using TwitchLib.Api.Services.Events.LiveStreamMonitor;
106

11-
namespace TwitchLib.Unity {
12-
public class UnityLiveStreamMonitor : LiveStreamMonitor {
7+
namespace TwitchLib.Unity
8+
{
9+
public class UnityLiveStreamMonitor : LiveStreamMonitor
10+
{
1311
private readonly GameObject _threadDispatcher;
1412

1513
#region EVENTS
@@ -27,8 +25,8 @@ public class UnityLiveStreamMonitor : LiveStreamMonitor {
2725
public new event EventHandler<OnStreamsSetArgs> OnStreamsSet;
2826
#endregion
2927

30-
public UnityFollowerService(ITwitchAPI api, int checkIntervalSeconds = 60, bool checkStatusOnStart = true, bool invokeEventsOnStart = false) : base(api, checkIntervalSeconds, checkStatusOnStart, invokeEventsOnStart) {
31-
_threadDispatcher = new GameObject("ThreadDispatcher");
28+
public UnityLiveStreamMonitor(ITwitchAPI api, int checkIntervalSeconds = 60, bool checkStatusOnStart = true, bool invokeEventsOnStart = false) : base(api, checkIntervalSeconds, checkStatusOnStart, invokeEventsOnStart) {
29+
_threadDispatcher = new GameObject("UnityLiveStreamMonitorThreadDispatcher");
3230
_threadDispatcher.AddComponent<ThreadDispatcher>();
3331
UnityEngine.Object.DontDestroyOnLoad(_threadDispatcher);
3432

0 commit comments

Comments
 (0)