Skip to content

Commit

Permalink
EventInfoを渡すように変更 silane#7
Browse files Browse the repository at this point in the history
  • Loading branch information
noriokun4649 committed Mar 15, 2021
1 parent 8677933 commit 505c7b5
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion TVTComment/Model/ChatCollectService/IChatCollectService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public interface IChatCollectService : IDisposable
/// <param name="channel">コメントを取得したい対象チャンネル</param>
/// <param name="time">コメントを取得したい対象時刻</param>
/// <returns>取得したコメント</returns>
IEnumerable<Chat> GetChats(ChannelInfo channel, DateTime time);
IEnumerable<Chat> GetChats(ChannelInfo channel,EventInfo events , DateTime time);

/// <summary>
/// コメント投稿に対応しているか
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ NiconicoUtils.NiconicoLoginSession niconicoLoginSession
commentSender = new NiconicoUtils.NicoLiveCommentSender(niconicoLoginSession);
}

public IEnumerable<Chat> GetChats(ChannelInfo channel, EventInfo _, DateTime time)
{
return GetChats(channel, time);
}

public IEnumerable<Chat> GetChats(ChannelInfo channel, DateTime time)
{
if (chatCollectTask?.IsFaulted ?? false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ public string GetInformationText()
return ret + "サーバーに接続中";
}

public IEnumerable<Chat> GetChats(ChannelInfo channel, EventInfo _, DateTime time)
{
return GetChats(channel, time);
}

public IEnumerable<Chat> GetChats(ChannelInfo channel, DateTime time)
{
if (chatCollectTask != null && chatCollectTask.IsFaulted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public string GetInformationText()
return $"生放送ID: {originalLiveId}" + (liveId != "" ? $" ({liveId})" : "");
}

public IEnumerable<Chat> GetChats(ChannelInfo channel, EventInfo _, DateTime time)
{
return GetChats(channel, time);
}

public IEnumerable<Chat> GetChats(ChannelInfo channel, DateTime time)
{
if (chatCollectTask.IsCanceled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ protected OnceASecondChatCollectService(TimeSpan continuousCallLimit)
this.continuousCallLimit = continuousCallLimit;
}

public IEnumerable<Chat> GetChats(ChannelInfo channel, DateTime time)
public IEnumerable<Chat> GetChats(ChannelInfo channel, EventInfo _, DateTime time)
{
return GetChats(channel, time);
}

public IEnumerable<Chat> GetChats(ChannelInfo channel, DateTime time)
{
List<Chat> ret = new List<Chat>();
if (lastTime <= time && time < lastTime + continuousCallLimit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ await Task.Run(() =>
}, cancel);
}

public IEnumerable<Chat> GetChats(ChannelInfo channel, DateTime time)
public IEnumerable<Chat> GetChats(ChannelInfo channel,EventInfo events, DateTime time)
{
if (ModeSelect == ModeSelectMethod.Auto)
{
Expand Down
5 changes: 3 additions & 2 deletions TVTComment/Model/ChatCollectServiceModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ public ChatCollectServiceModule(ChannelInformationModule channelInformationManag
private void TimerCallback(object state)
{
var channel = channelInformationManager.CurrentChannel.Value;
var events = channelInformationManager.CurrentEvent.Value;
var time = channelInformationManager.CurrentTime.Value;
if (channel != null && time.HasValue)
if (channel != null && time.HasValue && events != null)
{
SynchronizationContext.Post((_) =>
{
Expand All @@ -78,7 +79,7 @@ private void TimerCallback(object state)
ChatCollectService.IChatCollectService service = RegisteredServices[i];
try
{
NewChatProduced?.Invoke(service.GetChats(channel, time.Value + TimeAdjustment.Value).Select(chat =>
NewChatProduced?.Invoke(service.GetChats(channel, events, time.Value + TimeAdjustment.Value).Select(chat =>
{
chat.SetSourceService(service.ServiceEntry);
return chat;
Expand Down

0 comments on commit 505c7b5

Please sign in to comment.