Exemple #1
0
        public static SmashggImage[] ParseImages(JToken v)
        {
            int count = v.Children().Count();

            SmashggImage[] images = new SmashggImage[count];
            for (int i = 0; i < count; i++)
            {
                images[i] = new SmashggImage(v[i]);
            }

            return(images);
        }
Exemple #2
0
        public Event(JToken v)
        {
            //Ints
            this.id              = SmashggConversion.ToInt((string)v["id"]);
            this.checkInBuffer   = SmashggConversion.ToInt((string)v["checkInBuffer"]);
            this.checkInDuration = SmashggConversion.ToInt((string)v["checkInDuration"]);
            this.entrantSizeMax  = SmashggConversion.ToInt((string)v["entrantSizeMax"]);
            this.entrantSizeMin  = SmashggConversion.ToInt((string)v["entrantSizeMin"]);
            this.numEntrants     = SmashggConversion.ToInt((string)v["numEntrants"]);
            this.rulesetId       = SmashggConversion.ToInt((string)v["rulesetId"]);



            //Bools
            this.checkInEnabled = bool.Parse((string)v["checkInEnabled"]);
            this.hasDecks       = bool.Parse((string)v["hasDecks"]);
            this.hasTasks       = bool.Parse((string)v["hasTasks"]);
            this.isOnline       = bool.Parse((string)v["isOnline"]);
            this.useEventSeeds  = (string)v["useEventSeeds"] == null ? false : bool.Parse((string)v["useEventSeeds"]);

            //Strings
            this.name = (string)v["name"];
            this.matchRulesMarkdown = (string)v["matchRulesMarkdown"];
            this.rulesMarkdown      = (string)v["rulesMarkdown"];
            this.slug = (string)v["slug"];



            //DateTime
            this.createdAt = SmashggConversion.UnixTimeStampToDateTime((string)v["createdAt"]);
            this.deckSubmissionDeadline = SmashggConversion.UnixTimeStampToDateTime((string)v["deckSubmissionDeadline"]);
            this.startAt = SmashggConversion.UnixTimeStampToDateTime((string)v["startAt"]);
            this.teamManagementDeadline = SmashggConversion.UnixTimeStampToDateTime((string)v["teamManagementDeadline"]);

            //JOSN
            this.prizingInfo = v["prizingInfo"];
            this.publishing  = v["publishing"];

            //Objects
            this.images = SmashggImage.ParseImages(v["images"]);
        }
Exemple #3
0
        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();
        }