示例#1
0
        internal UserStation(RequiredInformation requiredInfo, JToken stationData)
        {
            RequiredInfo = requiredInfo;

            AllowAddMusic        = stationData.Value <bool?>("allowAddMusic") ?? false;
            AllowDelete          = stationData.Value <bool?>("allowDelete") ?? false;
            AllowEditDescription = stationData.Value <bool?>("allowEditDescription") ?? false;
            AllowRename          = stationData.Value <bool?>("allowRename") ?? false;
            ArtUrl            = stationData.Value <string>("artUrl") ?? string.Empty;
            IsGenreStation    = stationData.Value <bool?>("isGenreStation") ?? false;
            IsQuickMix        = stationData.Value <bool?>("isQuickMix") ?? false;
            IsShared          = stationData.Value <bool?>("isShared") ?? false;
            RequiresCleanAds  = stationData.Value <bool?>("requiresCleanAds") ?? false;
            StationDetailUrl  = stationData.Value <string>("stationDetailUrl") ?? string.Empty;
            StationId         = stationData.Value <string>("stationId") ?? string.Empty;
            StationName       = stationData.Value <string>("stationName") ?? string.Empty;
            StationSharingUrl = stationData.Value <string>("stationSharingUrl") ?? string.Empty;
            StationToken      = stationData.Value <string>("stationToken") ?? string.Empty;
            SuppressVideoAds  = stationData.Value <bool?>("suppressVideoAds") ?? false;

            var dateCreated = stationData["dateCreated"];

            if (dateCreated != null)
            {
                DateCreated = Time.FromJavaTimeStamp(dateCreated.Value <double?>("time") ?? 0);
            }

            var feedbackData = stationData["feedback"];

            if (feedbackData != null)
            {
                Feedback = StationFactory.GetStationFeedback(RequiredInfo, feedbackData);
            }

            var genreData = stationData["genre"];

            if (genreData != null)
            {
                Genre = from genre in genreData select genre.ToString();
            }

            var musicData = stationData["music"];

            if (musicData != null)
            {
                Music = StationFactory.GetStationMusicInfo(musicData);
            }
        }