Beispiel #1
0
        private void updateOnline()
        {
            for (int i = 0; i < entries.Length; i++)
            {
                if (abortThread)
                {
                    return;
                }
                string name = entries[i];
                string s    = "\"stream\":null";
                if (!IsLinux)
                {
                    //ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;
                    WebClient wc = new WebClient();
                    s = wc.UploadString("http://api.twitch.tv/kraken/streams/" +
                                        TwitchApi.GetName(name), "");
                    wc.Dispose();
                }
                else
                {
                    Process p = new Process();
                    p.StartInfo.FileName  = "wget";
                    p.StartInfo.Arguments = "-q -O - https://api.twitch.tv/kraken/streams/" +
                                            TwitchApi.GetName(name);
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.UseShellExecute        = false;
                    p.Start();
                    while (!p.HasExited)
                    {
                        if (abortThread)
                        {
                            p.Kill();
                            return;
                        }
                    }
                    //p.BeginOutputReadLine();
                    s = p.StandardOutput.ReadToEnd();
                }
                if (s.Contains("\"stream\":null"))
                {
                    isOnline[i] = false;
                }
                else
                {
                    isOnline[i] = true;
                    if (abortThread)
                    {
                        return;
                    }
                    Console.Clear();
                    DrawMenue();
                }
            }

            loaded = true;
            Console.Clear();
            DrawMenue();
        }