private void Instance_OnReceivedGlobalSettings(object sender, ReceivedGlobalSettingsPayload payload)
 {
     if (payload?.Settings != null)
     {
         TwitchGlobalSettings global = payload.Settings.ToObject <TwitchGlobalSettings>();
         initialAlertColor = global.InitialAlertColor;
     }
 }
 private void Instance_OnReceivedGlobalSettings(object sender, ReceivedGlobalSettingsPayload payload)
 {
     if (payload?.Settings != null)
     {
         global = payload.Settings.ToObject <TwitchGlobalSettings>();
         SetClearTimerInterval();
     }
 }
 private void Instance_OnReceivedGlobalSettings(object sender, ReceivedGlobalSettingsPayload payload)
 {
     if (payload?.Settings != null)
     {
         global = payload.Settings.ToObject <TwitchGlobalSettings>();
         InitializeSettings();
     }
 }
 public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload)
 {
     if (payload?.Settings != null)
     {
         TwitchGlobalSettings global = payload.Settings.ToObject <TwitchGlobalSettings>();
         twoLettersPerKey = global.TwoLettersPerKey;
         CalculateStringIndex();
     }
 }
 public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload)
 {
     globalSettingsLoaded = true;
     // Global Settings exist
     if (payload?.Settings != null && payload.Settings.Count > 0)
     {
         global = payload.Settings.ToObject <TwitchGlobalSettings>();
         TwitchChat.Instance.SetChatMessage(global.ChatMessage);
         TwitchChat.Instance.SetPageCommand(global.PageCommand);
         Settings.ChatMessage         = TwitchChat.Instance.ChatMessage;
         Settings.PageCommand         = TwitchChat.Instance.PageCommand;
         Settings.FullScreenAlert     = global.FullScreenAlert;
         Settings.TwoLettersPerKey    = global.TwoLettersPerKey;
         Settings.AlwaysAlert         = global.AlwaysAlert;
         Settings.AlertColor          = global.InitialAlertColor;
         Settings.SaveToFile          = global.SaveToFile;
         Settings.PageFileName        = global.PageFileName;
         Settings.FilePrefix          = global.FilePrefix;
         Settings.ClearFileSeconds    = global.ClearFileSeconds;
         Settings.PubsubNotifications = global.PubsubNotifications;
         Settings.BitsChatMessage     = global.BitsChatMessage;
         Settings.BitsFlashColor      = global.BitsFlashColor;
         Settings.BitsFlashMessage    = global.BitsFlashMessage;
         Settings.FollowChatMessage   = global.FollowChatMessage;
         Settings.FollowFlashColor    = global.FollowFlashColor;
         Settings.FollowFlashMessage  = global.FollowFlashMessage;
         Settings.SubChatMessage      = global.SubChatMessage;
         Settings.SubFlashColor       = global.SubFlashColor;
         Settings.SubFlashMessage     = global.SubFlashMessage;
         Settings.PointsChatMessage   = global.PointsChatMessage;
         Settings.PointsFlashColor    = global.PointsFlashColor;
         Settings.PointsFlashMessage  = global.PointsFlashMessage;
         previousViewersCount         = global.PreviousViewersCount;
         if (!String.IsNullOrEmpty(global.ViewersBrush))
         {
             try
             {
                 viewersBrush = new SolidBrush(ColorTranslator.FromHtml(global.ViewersBrush));
             }
             catch (Exception ex)
             {
                 Logger.Instance.LogMessage(TracingLevel.ERROR, $"Invalid global ViewersBrush {global.ViewersBrush} - {ex}");
             }
         }
         SetClearTimerInterval();
         SaveSettings();
     }
     else // Global settings do not exist
     {
         Logger.Instance.LogMessage(TracingLevel.WARN, "TwitchPagerAction: Global Settings do not exist!");
         Settings.ChatMessage = TwitchChat.Instance.ChatMessage;
         Settings.PageCommand = TwitchChat.Instance.PageCommand;
         SetGlobalSettings();
     }
 }
        private bool SetGlobalSettings()
        {
            if (!globalSettingsLoaded)
            {
                Logger.Instance.LogMessage(TracingLevel.INFO, "Ignoring SetGlobalSettings as they were not yet loaded");
                return(false);
            }

            if (global == null)
            {
                Logger.Instance.LogMessage(TracingLevel.WARN, "SetGlobalSettings called while Global Settings are null");
                global = new TwitchGlobalSettings();
            }

            global.ChatMessage             = Settings.ChatMessage;
            global.PageCommand             = Settings.PageCommand;
            global.FullScreenAlert         = Settings.FullScreenAlert;
            global.TwoLettersPerKey        = Settings.TwoLettersPerKey;
            global.AlwaysAlert             = Settings.AlwaysAlert;
            global.InitialAlertColor       = Settings.AlertColor;
            global.SaveToFile              = Settings.SaveToFile;
            global.PageFileName            = Settings.PageFileName;
            global.FilePrefix              = Settings.FilePrefix;
            global.ClearFileSeconds        = Settings.ClearFileSeconds;
            global.PubsubNotifications     = Settings.PubsubNotifications;
            global.BitsChatMessage         = Settings.BitsChatMessage;
            global.BitsFlashColor          = Settings.BitsFlashColor;
            global.BitsFlashMessage        = Settings.BitsFlashMessage;
            global.FollowChatMessage       = Settings.FollowChatMessage;
            global.FollowFlashColor        = Settings.FollowFlashColor;
            global.FollowFlashMessage      = Settings.FollowFlashMessage;
            global.SubChatMessage          = Settings.SubChatMessage;
            global.SubFlashColor           = Settings.SubFlashColor;
            global.SubFlashMessage         = Settings.SubFlashMessage;
            global.PointsChatMessage       = Settings.PointsChatMessage;
            global.PointsFlashColor        = Settings.PointsFlashColor;
            global.PointsFlashMessage      = Settings.PointsFlashMessage;
            global.RaidChatMessage         = Settings.RaidChatMessage;
            global.RaidFlashColor          = Settings.RaidFlashColor;
            global.RaidFlashMessage        = Settings.RaidFlashMessage;
            global.AutoStopPage            = Settings.AutoStopPage;
            global.PlaybackDevice          = Settings.PlaybackDevice;
            global.PlaySoundOnChat         = Settings.PlaySoundOnChat;
            global.PlaySoundOnNotification = Settings.PlaySoundOnNotification;
            global.PlaySoundFile           = Settings.PlaySoundFile;
            global.ViewersBrush            = viewersBrush.ToHex();
            global.PreviousViewersCount    = previousViewersCount;
            global.SoundCooldown           = soundCooldown;
            global.MutedUsers              = Settings.MutedUsers;
            Connection.SetGlobalSettingsAsync(JObject.FromObject(global));

            return(true);
        }
Beispiel #7
0
        private void SetGlobalSettings()
        {
            if (global == null)
            {
                Logger.Instance.LogMessage(TracingLevel.WARN, "SetGlobalSettings called while Global Settings are null");
                global = new TwitchGlobalSettings();
            }

            global.ChatMessage       = settings.ChatMessage;
            global.TwoLettersPerKey  = settings.TwoLettersPerKey;
            global.InitialAlertColor = settings.AlertColor;
            Connection.SetGlobalSettingsAsync(JObject.FromObject(global));
        }
Beispiel #8
0
 public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload)
 {
     // Global Settings exist
     if (payload?.Settings != null && payload.Settings.Count > 0)
     {
         global = payload.Settings.ToObject <TwitchGlobalSettings>();
         TwitchChat.Instance.SetChatMessage(global.ChatMessage);
         settings.ChatMessage      = TwitchChat.Instance.ChatMessage;
         settings.TwoLettersPerKey = global.TwoLettersPerKey;
         settings.AlertColor       = global.InitialAlertColor;
         SaveSettings();
     }
     else // Global settings do not exist
     {
         global                   = new TwitchGlobalSettings();
         global.ChatMessage       = TwitchChat.Instance.ChatMessage;
         global.TwoLettersPerKey  = settings.TwoLettersPerKey;
         global.InitialAlertColor = settings.AlertColor;
         Connection.SetGlobalSettingsAsync(JObject.FromObject(global));
     }
 }