public PreviousRaffleWinner(JToken previousWinnerData) { username = previousWinnerData.SelectToken("username").ToString(); if (previousWinnerData.SelectToken("affect_win_limit").ToString() == "False") { affectWinLimit = false; } switch (previousWinnerData.SelectToken("giveaway_type").ToString()) { case "!games": giveawayType = Common.GiveawayTypes.EXGAMES; break; case "steam_trade": giveawayType = Common.GiveawayTypes.STEAMTRADE; break; case "steam_gift": giveawayType = Common.GiveawayTypes.STEAMGIFT; break; case "steam_code": giveawayType = Common.GiveawayTypes.STEAMCODE; break; case "origin_code": giveawayType = Common.GiveawayTypes.ORIGINCODE; break; case "humblebundle": giveawayType = Common.GiveawayTypes.HUMBLEBUNDLE; break; case "code": giveawayType = Common.GiveawayTypes.SERIALCODE; break; case "logitech": giveawayType = Common.GiveawayTypes.LOGITECH; break; case "soundbyte": giveawayType = Common.GiveawayTypes.SOUND_BYTES; break; case "other": giveawayType = Common.GiveawayTypes.OTHER; break; default: giveawayType = Common.GiveawayTypes.OTHER; break; } }
public PreviousRaffleWinner(JToken previousWinnerData) { username = previousWinnerData.SelectToken("username").ToString(); if (previousWinnerData.SelectToken("affect_win_limit").ToString() == "False") affectWinLimit = false; switch(previousWinnerData.SelectToken("giveaway_type").ToString()) { case "!games": giveawayType = Common.GiveawayTypes.EXGAMES; break; case "steam_trade": giveawayType = Common.GiveawayTypes.STEAMTRADE; break; case "steam_gift": giveawayType = Common.GiveawayTypes.STEAMGIFT; break; case "steam_code": giveawayType = Common.GiveawayTypes.STEAMCODE; break; case "origin_code": giveawayType = Common.GiveawayTypes.ORIGINCODE; break; case "humblebundle": giveawayType = Common.GiveawayTypes.HUMBLEBUNDLE; break; case "code": giveawayType = Common.GiveawayTypes.SERIALCODE; break; case "logitech": giveawayType = Common.GiveawayTypes.LOGITECH; break; case "soundbyte": giveawayType = Common.GiveawayTypes.SOUND_BYTES; break; case "other": giveawayType = Common.GiveawayTypes.OTHER; break; default: giveawayType = Common.GiveawayTypes.OTHER; break; } }
// RaffleProperties constructor accepts JSON data from API public RaffleProperties(JToken giveawayProperties) { raffleLength = int.Parse(giveawayProperties.SelectToken("raffle_length").ToString()); if (raffleLength < 3) { raffleLength = 3; } raffleClaimLength = int.Parse(giveawayProperties.SelectToken("raffle_claim_length").ToString()); if (raffleClaimLength < 1) { raffleClaimLength = 1; } raffleMinimumEntries = int.Parse(giveawayProperties.SelectToken("raffle_min_entries").ToString()); raffleFilterAmount = int.Parse(giveawayProperties.SelectToken("raffle_filter_amount").ToString()); raffleSteamID = int.Parse(giveawayProperties.SelectToken("raffle_steam_id").ToString()); raffleSoundbyteCount = int.Parse(giveawayProperties.SelectToken("raffle_soundbyte_count").ToString()); raffleDonator = giveawayProperties.SelectToken("raffle_donator").ToString(); raffleAuthor = giveawayProperties.SelectToken("raffle_author").ToString(); raffleName = giveawayProperties.SelectToken("raffle_name").ToString(); raffleLinker = giveawayProperties.SelectToken("raffle_linker").ToString(); if (giveawayProperties.SelectToken("raffle_sub_only").ToString() == "true") { subOnly = true; } if (giveawayProperties.SelectToken("raffle_follower_only").ToString() == "true") { followerOnly = true; } previousWinners = WebCalls.downloadPreviousWinners().Result; blockedViewers = downloadBlockedViewers(raffleDonator).Result; if (giveawayProperties.SelectToken("kappa_entry") != null) { if (giveawayProperties.SelectToken("kappa_entry").ToString() == "true") { kappaEntry = true; } } switch (giveawayProperties.SelectToken("raffle_type").ToString()) { case "exgames": raffleType = Common.GiveawayTypes.EXGAMES; exGamesCount = WebCalls.downloadExGamesCount().Result; break; case "steam_trade": raffleType = Common.GiveawayTypes.STEAMTRADE; break; case "steam_gift": raffleType = Common.GiveawayTypes.STEAMGIFT; break; case "steam_code": raffleType = Common.GiveawayTypes.STEAMCODE; break; case "origin_code": raffleType = Common.GiveawayTypes.ORIGINCODE; break; case "humblebundle": raffleType = Common.GiveawayTypes.HUMBLEBUNDLE; break; case "code": raffleType = Common.GiveawayTypes.SERIALCODE; break; case "logitech": raffleType = Common.GiveawayTypes.LOGITECH; break; case "soundbyte": raffleType = Common.GiveawayTypes.SOUND_BYTES; break; case "other": raffleType = Common.GiveawayTypes.OTHER; raffleTypeOther = giveawayProperties.SelectToken("raffle_type_other").ToString(); break; default: Common.ChatClient.SendMessage(string.Format("ERROR: Raffle type '' is not valid and KrakenBot2 cannot proceed [Fatal] [Restarting]", giveawayProperties.SelectToken("raffle_type").ToString())); System.Diagnostics.Process.Start(Environment.CurrentDirectory + "\\KrakenBot2.exe"); Environment.Exit(0); break; } switch (giveawayProperties.SelectToken("raffle_filter").ToString()) { case "doubloons": raffleFilter = Filters.DOUBLOONS; break; case "minutes": raffleFilter = Filters.MINUTES; break; case "none": raffleFilter = Filters.NONE; break; } }
// RaffleProperties constructor accepts JSON data from API public RaffleProperties(JToken giveawayProperties) { raffleLength = int.Parse(giveawayProperties.SelectToken("raffle_length").ToString()); if (raffleLength < 3) raffleLength = 3; raffleClaimLength = int.Parse(giveawayProperties.SelectToken("raffle_claim_length").ToString()); if (raffleClaimLength < 1) raffleClaimLength = 1; raffleMinimumEntries = int.Parse(giveawayProperties.SelectToken("raffle_min_entries").ToString()); raffleFilterAmount = int.Parse(giveawayProperties.SelectToken("raffle_filter_amount").ToString()); raffleSteamID = int.Parse(giveawayProperties.SelectToken("raffle_steam_id").ToString()); raffleSoundbyteCount = int.Parse(giveawayProperties.SelectToken("raffle_soundbyte_count").ToString()); raffleDonator = giveawayProperties.SelectToken("raffle_donator").ToString(); raffleAuthor = giveawayProperties.SelectToken("raffle_author").ToString(); raffleName = giveawayProperties.SelectToken("raffle_name").ToString(); raffleLinker = giveawayProperties.SelectToken("raffle_linker").ToString(); if (giveawayProperties.SelectToken("raffle_sub_only").ToString() == "true") subOnly = true; if (giveawayProperties.SelectToken("raffle_follower_only").ToString() == "true") followerOnly = true; previousWinners = WebCalls.downloadPreviousWinners().Result; blockedViewers = downloadBlockedViewers(raffleDonator).Result; if (giveawayProperties.SelectToken("kappa_entry") != null) if (giveawayProperties.SelectToken("kappa_entry").ToString() == "true") kappaEntry = true; switch (giveawayProperties.SelectToken("raffle_type").ToString()) { case "exgames": raffleType = Common.GiveawayTypes.EXGAMES; exGamesCount = WebCalls.downloadExGamesCount().Result; break; case "steam_trade": raffleType = Common.GiveawayTypes.STEAMTRADE; break; case "steam_gift": raffleType = Common.GiveawayTypes.STEAMGIFT; break; case "steam_code": raffleType = Common.GiveawayTypes.STEAMCODE; break; case "origin_code": raffleType = Common.GiveawayTypes.ORIGINCODE; break; case "humblebundle": raffleType = Common.GiveawayTypes.HUMBLEBUNDLE; break; case "code": raffleType = Common.GiveawayTypes.SERIALCODE; break; case "logitech": raffleType = Common.GiveawayTypes.LOGITECH; break; case "soundbyte": raffleType = Common.GiveawayTypes.SOUND_BYTES; break; case "other": raffleType = Common.GiveawayTypes.OTHER; raffleTypeOther = giveawayProperties.SelectToken("raffle_type_other").ToString(); break; default: Common.ChatClient.SendMessage(string.Format("ERROR: Raffle type '' is not valid and KrakenBot2 cannot proceed [Fatal] [Restarting]", giveawayProperties.SelectToken("raffle_type").ToString())); System.Diagnostics.Process.Start(Environment.CurrentDirectory + "\\KrakenBot2.exe"); Environment.Exit(0); break; } switch(giveawayProperties.SelectToken("raffle_filter").ToString()) { case "doubloons": raffleFilter = Filters.DOUBLOONS; break; case "minutes": raffleFilter = Filters.MINUTES; break; case "none": raffleFilter = Filters.NONE; break; } }