public static CallResponse fetchMyMostPlayed(string username, int appcode)
        {
            string cnts = new System.Net.WebClient().DownloadString(String.Format("https://burkeblack.tv/api/v1/soundbyte_application/account/{0}/play_count", appcode));
            JObject decoded = JObject.Parse(cnts);
            CallResponse resp;
            if ((bool)decoded.SelectToken("success") == true)
            {
                myMostPlayedListings[] myMPListing = new myMostPlayedListings[decoded.SelectToken("play_count").Count()];
                int i = 0;
                foreach (JToken sb in decoded.SelectToken("play_count"))
                {
                    myMostPlayedListings temp = new myMostPlayedListings(sb.SelectToken("name").ToString(), sb.SelectToken("genre").ToString(),
                        sb.SelectToken("horror").ToString(), sb.SelectToken("author").ToString(), sb.SelectToken("plays").ToString());
                    myMPListing[i] = temp;
                    i += 1;
                }

                resp = new CallResponse(CallResponse.responseType.SUCCESS, myMPListing);
            }
            else
            {
                resp = new CallResponse(CallResponse.responseType.FAILURE, null, decoded.SelectToken("message").ToString());
            }
            return resp;
        }
 public static CallResponse checkForAvailableUpdate(double currentVersion)
 {
     string cnts = new System.Net.WebClient().DownloadString(Properties.Settings.Default.gitVersion);
     double downloadedVersion;
     double.TryParse(cnts, out downloadedVersion);
     CallResponse resp;
     if (downloadedVersion > currentVersion)
     {
         resp = new CallResponse(CallResponse.responseType.SUCCESS, true);
     }
     else
     {
         resp = new CallResponse(CallResponse.responseType.SUCCESS, false);
     }
     return resp;
 }
 public static CallResponse fetchSoundbytePlayLeaderboard()
 {
     string cnts = new System.Net.WebClient().DownloadString("https://burkeblack.tv/api/v1/soundbyte_application/soundbytes/leaderboard");
     JObject decoded = JObject.Parse(cnts);
     CallResponse resp;
     if ((bool)decoded.SelectToken("success") == true)
     {
         JToken leaderboard = decoded.SelectToken("leaderboard");
         sbLeaderboardListing[] sbLeaderBoardListings = new sbLeaderboardListing[leaderboard.Count()];
         for (int i = 0; i < sbLeaderBoardListings.Length; i++)
         {
             int plays = -1;
             string name = leaderboard[i].SelectToken("name").ToString();
             string genre = leaderboard[i].SelectToken("genre").ToString();
             string uploaded_by = leaderboard[i].SelectToken("uploaded_by").ToString();
             int.TryParse(leaderboard[i].SelectToken("plays").ToString(), out plays);
             string last_played_by = leaderboard[i].SelectToken("last_played_by").ToString();
             sbLeaderBoardListings[i] = new sbLeaderboardListing(name, genre, uploaded_by, plays, last_played_by);
         }
         object[] leaderboardAndTotalPlays = new object[2];
         leaderboardAndTotalPlays[0] = sbLeaderBoardListings;
         leaderboardAndTotalPlays[1] = decoded.SelectToken("total_plays").ToString();
         resp = new CallResponse(CallResponse.responseType.SUCCESS, leaderboardAndTotalPlays);
     }
     else
     {
         resp = new CallResponse(CallResponse.responseType.FAILURE, null, decoded.SelectToken("message").ToString());
     }
     return resp;
 }
        public static CallResponse getSoundbytes()
        {
            string cnts = new System.Net.WebClient().DownloadString("https://burkeblack.tv/api/v1/soundbyte_application/soundbytes/audio");
            JObject decoded = JObject.Parse(cnts);
            CallResponse resp;
            if ((bool)decoded.SelectToken("success") == true)
            {
                JToken soundbytes = decoded.SelectToken("audio");
                soundbyte[] allSoundbytes = new soundbyte[soundbytes.Count()];
                for (int i = 0; i < allSoundbytes.Length; i++)
                {
                    int sbID, sbHorrorNight;
                    string sbName, sbLocation, sbUploadedBy, sbGenre;
                    int.TryParse(soundbytes[i].SelectToken("id").ToString(), out sbID);
                    int.TryParse(soundbytes[i].SelectToken("horror").ToString(), out sbHorrorNight);
                    sbName = soundbytes[i].SelectToken("name").ToString();
                    sbLocation = soundbytes[i].SelectToken("location").ToString();
                    sbUploadedBy = soundbytes[i].SelectToken("uploaded_by").ToString();
                    sbGenre = soundbytes[i].SelectToken("genre").ToString();
                    soundbyte.HorrorNightTypes enumHorrorNight = soundbyte.HorrorNightTypes.NOT_AVAILBLE_ON_HORROR_NIGHT;
                    switch (sbHorrorNight)
                    {
                        case 0:
                            enumHorrorNight = soundbyte.HorrorNightTypes.NOT_AVAILBLE_ON_HORROR_NIGHT;
                            break;

                        case 1:
                            enumHorrorNight = soundbyte.HorrorNightTypes.AVAILABLE_ALL_THE_TIME;
                            break;

                        case 2:
                            enumHorrorNight = soundbyte.HorrorNightTypes.AVAILABLE_ONLY_ON_HORROR_NIGHT;
                            break;
                    }
                    allSoundbytes[i] = new soundbyte(sbID, sbName, sbGenre, enumHorrorNight, sbLocation, sbUploadedBy);
                }
                resp = new CallResponse(CallResponse.responseType.SUCCESS, allSoundbytes);
            }
            else
            {
                resp = new CallResponse(CallResponse.responseType.FAILURE, decoded.SelectToken("data").ToString());
            }
            return resp;
        }
 public static CallResponse getGenres()
 {
     string cnts = new System.Net.WebClient().DownloadString("https://burkeblack.tv/api/v1/soundbyte_application/soundbytes/genres");
     JObject decoded = JObject.Parse(cnts);
     CallResponse resp;
     if ((bool)decoded.SelectToken("success") == true)
     {
         JToken genres = decoded.SelectToken("genres");
         genre[] allGenres = new genre[genres.Count()];
         for (int i = 0; i < allGenres.Length; i++)
         {
             int genreID;
             string genreName;
             int.TryParse(genres[i].SelectToken("id").ToString(), out genreID);
             genreName = genres[i].SelectToken("genre").ToString();
             allGenres[i] = new genre(genreID, genreName);
         }
         resp = new CallResponse(CallResponse.responseType.SUCCESS, allGenres);
     } else {
         resp = new CallResponse(CallResponse.responseType.FAILURE, null, "An issue occurred while downloading genre list.");
     }
     return resp;
 }