예제 #1
0
 public static bool channelExists(string channel) {
     try
     {
         using (var client = new NewWebClient())
         {
             client.HeadOnly = true;
             // fine, if channel exists
             // throws Exception on 404
             client.DownloadString("http://goodgame.ru/chat/" + channel);
         }
         return true;
     }
     catch(WebException)
     {
         return false;
     }
 }
예제 #2
0
 public static bool channelExists(string channel)
 {
     try
     {
         using (var client = new NewWebClient())
         {
             client.HeadOnly = true;
             // fine, no content downloaded
             // throws 404
             client.DownloadString("http://cybergame.tv/" + channel);
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
예제 #3
0
 public static bool channelExists(string channel) {
     try
     {
         using (var client = new NewWebClient())
         {
            string s = client.DownloadString(String.Format(channelInfoUrl, channel));
            if (s.Contains("mvc.js', null)"))
                return false;
         }
         return true;
     }
     catch
     {
         return false;
     }
 
 }
예제 #4
0
 public string getViewers() {
     JObject jObject;
     string info;
     try
     {
         using (NewWebClient cl = new NewWebClient()) {
             info = cl.DownloadString(String.Format(infoUrl, channelName));
         }
         jObject = JsonConvert.DeserializeObject<JObject>(info);
         return jObject["spectators"].ToString();
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Viewers exception: " + ex.Message);
         return "0";
     }
 }