示例#1
0
        public Movie(JToken JSONMovie)
        {
            ID       = Int32.Parse(JSONMovie.Value <string>("film_id"));
            Title    = StringTools.Sanitize(JSONMovie.Value <string>("nom"));
            Synopsis = StringTools.Sanitize(JSONMovie.Value <string>("synopsis"));
            Director = JSONMovie.Value <string>("realisateur");
            Stars    = JSONMovie.Value <string>("acteurs");
            Kinds    = JSONMovie.Value <string>("type");

            // deal with french decimal separator
            if (App.DecimalSep.Equals(","))
            {
                Rating = Decimal.Parse(JSONMovie.Value <string>("note").Replace('.', ','));
            }
            else
            {
                Rating = Decimal.Parse(JSONMovie.Value <string>("note"));
            }
            Duration     = JSONMovie.Value <string>("duree");
            ReleaseDate  = DateTools.FormatReleaseDate(JSONMovie.Value <string>("date"));
            VFSessions   = DateTools.FormatSessions(JSONMovie.Value <JToken>("seances_vf"));
            VOSessions   = DateTools.FormatSessions(JSONMovie.Value <JToken>("seances_vo"));
            Thumbnail    = JSONMovie.Value <string>("image");
            ImagePreview = JSONMovie.Value <string>("imagelarge");

            // 'Add' doesn't call the 'set' method on Logos
            List <string> logoList = new List <string>();

            foreach (JToken token in JSONMovie.Value <JArray>("logos"))
            {
                logoList.Add(token.ToString());
            }
            Logos = logoList;

            List <string> photosList = new List <string>();

            foreach (JToken token in JSONMovie.Value <JArray>("photos"))
            {
                photosList.Add(token.ToString());
            }
            Photos = photosList;
        }