public SmashggImage(JToken v) { this.id = SmashggConversion.ToInt((string)v["id"]); this.height = SmashggConversion.ToFloat((string)v["height"]); this.ratio = SmashggConversion.ToFloat((string)v["ratio"]); this.width = SmashggConversion.ToFloat((string)v["width"]); this.type = (string)v["type"]; this.url = (string)v["url"]; }
public Tournament(string response) { JObject obj = JObject.Parse(response); JObject tournament = JObject.Parse(obj["data"]["tournament"].ToString()); //Ints this.id = SmashggConversion.ToInt((string)tournament["id"]); this.numAttendess = SmashggConversion.ToInt((string)tournament["numAttendess"]); this.tournamentType = SmashggConversion.ToInt((string)tournament["tournamentType"]); this.state = SmashggConversion.ToInt((string)tournament["state"]); //Strings this.name = (string)tournament["name"]; this.addrState = (string)tournament["addrState"]; this.city = (string)tournament["city"]; this.countryCode = (string)tournament["countryCode"]; this.currency = (string)tournament["currency"]; this.hashtag = (string)tournament["hashtag"]; this.mapsPlaceId = (string)tournament["mapsPlaceId"]; this.postalCode = (string)tournament["postalCode"]; this.primaryContact = (string)tournament["primaryContact"]; this.primaryContactType = (string)tournament["primaryContactType"]; this.venueName = (string)tournament["venueName"]; this.venueAddress = (string)tournament["venueAddress"]; this.rules = (string)tournament["rules"]; this.shortSlug = (string)tournament["shortSlug"]; this.slug = (string)tournament["slug"]; this.url = (string)tournament["url"]; //DateTime this.createdAt = SmashggConversion.UnixTimeStampToDateTime((string)tournament["createdAt"]); this.eventRegistrationClosesAt = SmashggConversion.UnixTimeStampToDateTime((string)tournament["eventRegistrationClosesAt"]); this.registrationClosesAt = SmashggConversion.UnixTimeStampToDateTime((string)tournament["registrationClosesAt"]); this.startAt = SmashggConversion.UnixTimeStampToDateTime((string)tournament["startAt"]); this.endDat = SmashggConversion.UnixTimeStampToDateTime((string)tournament["endDat"]); this.updatedAt = SmashggConversion.UnixTimeStampToDateTime((string)tournament["updatedAt"]); this.teamCreationClosesAt = SmashggConversion.UnixTimeStampToDateTime((string)tournament["teamCreationClosesAt"]); //Floats this.lat = SmashggConversion.ToFloat((string)tournament["lat"]); this.lng = SmashggConversion.ToFloat((string)tournament["lng"]); //Bools this.hasOnlineEvents = bool.Parse((string)tournament["hasOnlineEvents"]); this.isOnline = bool.Parse((string)tournament["isOnline"]); //JSON this.publishing = tournament["publishing"]; //Objects this.streams = Streams.ParseStreams(tournament["streams"]); this.events = Event.ParseEvents(tournament["events"]); this.images = SmashggImage.ParseImages(tournament["images"]); this.links = new TournamentLinks(tournament["links"]); Console.Write(""); //this.owner = tournament[""]; //this.participants = tournament[""].ToString(); //this.stations = tournament[""].ToString(); //this.streamQueue = tournament[""].ToString(); //this.timezone = tournament[""].ToString(); //this.url = tournament[""].ToString(); //this.waves = tournament[""].ToString(); }