Esempio n. 1
0
        /// <summary>
        /// Generates an empty key bitmap with the default height and width.
        /// New: To get the StreamDeckType use Connection.DeviceInfo()
        /// </summary>
        /// <param name="streamDeckType"></param>
        /// <param name="graphics"></param>
        /// <returns></returns>
        public static Bitmap GenerateKeyImage(StreamDeckDeviceType streamDeckType, out Graphics graphics)
        {
            int height = GetKeyDefaultHeight(streamDeckType);
            int width  = GetKeyDefaultWidth(streamDeckType);

            return(GenerateKeyImage(height, width, out graphics));
        }
Esempio n. 2
0
        public TwitchPager(SDConnection connection, InitialPayload payload) : base(connection, payload)
        {
            if (payload.Settings == null || payload.Settings.Count == 0)
            {
                this.settings = PluginSettings.CreateDefaultSettings();
            }
            else
            {
                this.settings = payload.Settings.ToObject <PluginSettings>();
            }
            TwitchStreamInfoManager.Instance.TwitchStreamInfoChanged += Instance_TwitchStreamInfoChanged;
            TwitchTokenManager.Instance.TokenStatusChanged           += Instance_TokenStatusChanged;
            Connection.StreamDeckConnection.OnSendToPlugin           += StreamDeckConnection_OnSendToPlugin;
            TwitchChat.Instance.PageRaised += Chat_PageRaised;

            this.settings.ChatMessage = TwitchChat.Instance.ChatMessage;
            settings.TokenExists      = TwitchTokenManager.Instance.TokenExists;
            ResetChat();
            deviceType = Connection.DeviceInfo().Type;

            tmrPage.Interval = 200;
            tmrPage.Elapsed += TmrPage_Elapsed;
            SaveSettings();
            Connection.GetGlobalSettingsAsync();
        }
        public TwitchPagerAction(SDConnection connection, InitialPayload payload) : base(connection, payload)
        {
            if (payload.Settings == null || payload.Settings.Count == 0)
            {
                this.Settings = PluginSettings.CreateDefaultSettings();
            }
            else
            {
                this.Settings = payload.Settings.ToObject <PluginSettings>();
            }
            MyTwitchChannelInfo.Instance.TwitchStreamInfoChanged += Instance_TwitchStreamInfoChanged;
            AlertManager.Instance.TwitchPagerShown += Instance_TwitchPagerShown;
            TwitchChat.Instance.PageRaised         += Chat_PageRaised;
            TwitchPubSubManager.Instance.Initialize();

            this.Settings.ChatMessage = TwitchChat.Instance.ChatMessage;
            this.Settings.PageCommand = TwitchChat.Instance.PageCommand;
            Settings.TokenExists      = TwitchTokenManager.Instance.TokenExists;
            AlertManager.Instance.Initialize(Connection);
            ResetChat();
            deviceType = Connection.DeviceInfo().Type;
            InitializeStreamInfo();

            tmrPage.Interval = 200;
            tmrPage.Elapsed += TmrPage_Elapsed;
            SaveSettings();
            Connection.GetGlobalSettingsAsync();
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the key default width in pixels.
        /// To get the StreamDeckType use Connection.DeviceInfo()
        /// </summary>
        /// <param name="streamDeckType"></param>
        /// <returns></returns>
        public static int GetKeyDefaultWidth(StreamDeckDeviceType streamDeckType)
        {
            switch (streamDeckType)
            {
            case StreamDeckDeviceType.StreamDeckClassic:
            case StreamDeckDeviceType.StreamDeckMini:
            case StreamDeckDeviceType.StreamDeckMobile:
                return(CLASSIC_KEY_DEFAULT_WIDTH);

            case StreamDeckDeviceType.StreamDeckXL:
                return(XL_KEY_DEFAULT_WIDTH);

            default:
                Logger.Instance.LogMessage(TracingLevel.ERROR, $"SDTools GetKeyDefaultHeight Error: Invalid StreamDeckDeviceType: {streamDeckType}");
                break;
            }
            return(1);
        }
Esempio n. 5
0
        public AlertFlasher(SDConnection connection, InitialPayload payload) : base(connection, payload)
        {
            Logger.Instance.LogMessage(TracingLevel.DEBUG, $"[{Thread.CurrentThread.ManagedThreadId}] AlertFlasher loading");
            var deviceInfo = payload.DeviceInfo.Devices.Where(d => d.Id == connection.DeviceId).FirstOrDefault();

            stringMessageIndex = -1;
            sequentialKey      = 0;
            if (deviceInfo != null && payload?.Coordinates != null)
            {
                deviceColumns  = deviceInfo.Size.Cols;
                locationRow    = payload.Coordinates.Row;
                locationColumn = payload.Coordinates.Column;
                sequentialKey  = (deviceColumns * locationRow) + locationColumn;
            }
            deviceType = Connection.DeviceInfo().Type;
            Connection.GetGlobalSettingsAsync();
            AlertManager.Instance.FlashStatusChanged     += Instance_FlashStatusChanged;
            AlertManager.Instance.ActiveStreamersChanged += Instance_ActiveStreamersChanged;
            AlertManager.Instance.ChatMessageListChanged += Instance_ChatMessageListChanged;
            Logger.Instance.LogMessage(TracingLevel.DEBUG, $"[{Thread.CurrentThread.ManagedThreadId}] AlertFlasher up: {sequentialKey}");
        }
Esempio n. 6
0
        private static void FindProfiles(StreamDeckDeviceType streamDeckDeviceType, ManifestData manifest)
        {
            var profileDictionary = new Dictionary <ProfileType, ProfileData>();

            foreach (var profile in manifest.Profiles.Where(x => x.DeviceType == streamDeckDeviceType))
            {
                var profileType = GetProfileType(profile.Name);

                if (profileType != null)
                {
                    profileDictionary.Add((ProfileType)profileType, profile);

                    Logger.Instance.LogMessage(TracingLevel.INFO,
                                               "Profile Found : " + profile.Name + " for " + profile.DeviceType);
                }
            }

            if (profileDictionary.Count > 1)
            {
                Profiles.Add(streamDeckDeviceType, profileDictionary);
            }
        }
        public DisplayAction(SDConnection connection, InitialPayload payload) : base(connection, payload)
        {
            Logger.Instance.LogMessage(TracingLevel.DEBUG, $"[{Thread.CurrentThread.ManagedThreadId}] DisplayAction loading");

            var deviceInfo = payload.DeviceInfo.Devices.Where(d => d.Id == connection.DeviceId).FirstOrDefault();

            sequentialKey = 0;
            if (deviceInfo != null && payload?.Coordinates != null)
            {
                coordinates    = payload.Coordinates;
                deviceColumns  = deviceInfo.Size.Cols;
                locationRow    = coordinates.Row;
                locationColumn = coordinates.Column;
                sequentialKey  = (deviceColumns * locationRow) + locationColumn;
            }
            else
            {
                Logger.Instance.LogMessage(TracingLevel.ERROR, $"DisplayAction invalid ctor settings Device: {deviceInfo} Payload: {payload}");
            }
            deviceType = Connection.DeviceInfo().Type;

            UIManager.Instance.UIActionEvent += Instance_UIActionEvent;
            Logger.Instance.LogMessage(TracingLevel.DEBUG, $"[{Thread.CurrentThread.ManagedThreadId}] DisplayAction up: {sequentialKey}");
        }
 public StreamDeckDeviceInfo(StreamDeckDeviceSize size, StreamDeckDeviceType type, string deviceId)
 {
     Size = size;
     Type = type;
     Id   = deviceId;
 }