Example #1
0
        private static void LoadEmotes(Task <WebResponse> obj)
        {
            var response       = obj.Result;
            var responseStream = response.GetResponseStream();
            var streamReader   = new StreamReader(responseStream);
            var text           = streamReader.ReadToEnd();

            File.WriteAllText("TwitchEmotes.EMOTES", text);
            response.Close();
            _emotes = JsonConvert.DeserializeObject <TW_EmotesInfo>(text);
        }
Example #2
0
        public static void Init()
        {
            _updateRealTimeTimer = new Timer(x => UpdateRealtimeTwitchVariables(), null, 0, 60000); // 1 min

            var emotesFileName = "TwitchEmotes.EMOTES";

            if (File.Exists(emotesFileName))
            {
                _emotes = JsonConvert.DeserializeObject <TW_EmotesInfo>(File.ReadAllText(emotesFileName));
            }
            else
            {
                var request = WebRequest.Create("https://api.twitch.tv/kraken/chat/emoticons");
                request.GetResponseAsync().ContinueWith(LoadEmotes);
            }
        }