-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventBridge.cs
More file actions
63 lines (56 loc) · 1.79 KB
/
Copy pathEventBridge.cs
File metadata and controls
63 lines (56 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using OBSWebsocketDotNet.Communication;
using OBSWebsocketDotNet.Types.Events;
using SSC.Properties;
using SuiBot_TwitchSocket.API.EventSub;
using System;
using System.Windows.Forms;
namespace SSC
{
public class EventBridgeTwitch
{
public Action<ES_ChatMessage> OnChannelMessage;
public Action<ES_ChannelPoints.ES_ChannelPointRedeemRequest> OnChannelPointsRedeem;
public Action<ES_ChannelGoal> OnChannelGoalAchieved;
public Action<ES_AdBreakBeginNotification> OnAdBreakStarted;
public Action<ES_AdBreakBeginNotification, int> OnAdBreakFinished;
public Action OnAdPrerollsActive;
public Action<ES_ChannelRaid> OnChannelRaid;
internal void Clear()
{
OnChannelMessage = null;
OnChannelPointsRedeem = null;
OnChannelGoalAchieved = null;
OnAdBreakStarted = null;
OnAdBreakFinished = null;
OnAdPrerollsActive = null;
OnChannelRaid = null;
}
}
public class EventBridgeOBS
{
public Action OnOBSConnected;
public Action OnOBSDisconnected;
public Action<string> OnMediaSourceStoppedPlaying;
internal void RegisterEvents(OBSWebsocketDotNet.OBSWebsocket OBS)
{
OBS.Connected += OBS_Connected;
OBS.Disconnected += OBS_Disconnected;
//OBS.ExitStarted += OBS_ExitStarted;
OBS.MediaInputPlaybackEnded += OBS_MediaInputPlaybackEnded;
}
private void OBS_MediaInputPlaybackEnded(object sender, MediaInputPlaybackEndedEventArgs e)
{
OnMediaSourceStoppedPlaying?.Invoke(e.InputName);
}
private void OBS_Connected(object sender, EventArgs e)
{
MainForm.Instance.ThreadSafeAddPreviewText("OBS Connected", LineType.WebSocket);
OnOBSConnected?.Invoke();
}
private void OBS_Disconnected(object sender, ObsDisconnectionInfo e)
{
MainForm.Instance.ThreadSafeAddPreviewText("OBS Disconnected", LineType.WebSocket);
OnOBSDisconnected?.Invoke();
}
}
}