private bool GetOrCreateJson() { if (!File.Exists(_jsonString)) { throw new NotImplementedException(); } _artifactRoot = DeserializeJson(); return(true); }
private ArtifactRoot DeserializeJson() { ArtifactRoot set = null; try { set = JsonConvert.DeserializeObject <ArtifactRoot>(File.ReadAllText(_jsonString)); return(set); } catch (Exception e) { Console.WriteLine("JSON ERROR: " + e); return(set); } }
public async Task GetArtifact([Remainder] string card) { //https://steamcdn-a.akamaihd.net/apps/583950/resource\/card_set_1.0E871AFDD63D1CBD0FB52D924DF1923C4A6D443A.json //string address = "https://steamcdn-a.akamaihd.net/apps/583950/resource/card_set_0.BB8732855C64ACE2696DCF5E25DEDD98D134DD2A.json"; _artifactRoot = DeserializeJson(); EmbedBuilder embed = EmbedCards(card); if (embed.Title != null) { await Context.Channel.SendMessageAsync("", false, embed.Build()); } else { await Context.Channel.SendMessageAsync(Context.Message.Author.Mention + " Card doesn't exist"); } }
public async Task GetArtifactList() { if (_artifactRoot == null) { _artifactRoot = DeserializeJson(); } List <object> temp = null; foreach (CardList set in _artifactRoot.card_set) { temp = set.references; if (set.card_type == "Hero") { await Context.Channel.SendMessageAsync(set.card_name.english); } } Console.WriteLine(temp); }