示例#1
0
 public static Guid GetMediaGuidForLibraryId(int id, MediaType type)
 {
     if (type == MediaType.PodcastEpisode)
     {
         id = PlaylistManager.GetFieldValue(id, PlaylistManager.MediaTypeToListType(type), 311, 0);
     }
     return(PlaylistManager.GetFieldValue(id, PlaylistManager.MediaTypeToListType(type), 451, Guid.Empty));
 }
        public override HRESULT GetURI(out string uri)
        {
            string  uriOut  = null;
            HRESULT hresult = HRESULT._S_OK;

            Microsoft.Zune.Service.EContentType eContentType;
            if (PlaylistManager.GetFieldValue(this._mediaId, this._listType, 177, -1) == 43)
            {
                eContentType = Microsoft.Zune.Service.EContentType.Video;
            }
            else
            {
                eContentType = Microsoft.Zune.Service.EContentType.MusicTrack;
                uriOut       = PlaylistManager.GetFieldValue(this._mediaId, this._listType, 317, (string)null);
                if (!string.IsNullOrEmpty(uriOut))
                {
                    try
                    {
                        if (new Uri(uriOut).Scheme == Uri.UriSchemeFile)
                        {
                            if (!ZuneLibrary.DoesFileExist(uriOut))
                            {
                                uriOut = null;
                            }
                        }
                    }
                    catch (UriFormatException ex)
                    {
                    }
                }
            }
            if (string.IsNullOrEmpty(uriOut) && this.ZuneMediaId != Guid.Empty)
            {
                hresult = ZuneApplication.Service.GetContentUri(this.ZuneMediaId, eContentType, Microsoft.Zune.Service.EContentUriFlags.None, out uriOut, out this._zuneMediaInstanceId);
            }
            uri = uriOut;
            return(hresult);
        }
示例#3
0
 public static Guid GetZuneMediaId(MediaType type, int libraryId) => PlaylistManager.GetFieldValue(libraryId, PlaylistManager.MediaTypeToListType(type), 233, Guid.Empty);
示例#4
0
 public void AddToCollection(IList items)
 {
     ZuneApplication.Service.Download(items, EDownloadFlags.Subscription, null, this.ClientContextEvent, this.ClientContextEventValue, new DownloadEventHandler(this.OnDownloadEvent), new DownloadEventProgressHandler(this.OnDownloadProgressEvent), new EventHandler(this.OnAllPending));
     foreach (object obj in items)
     {
         if (obj is DataProviderObject)
         {
             DataProviderObject dataProviderObject = (DataProviderObject)obj;
             if (dataProviderObject.TypeName == "PlaylistContentItem")
             {
                 PlaylistManager.GetPlaylistId((int)dataProviderObject.GetProperty("LibraryId"));
                 UsageDataService.ReportTrackAddToCollection((Guid)dataProviderObject.GetProperty("ZuneMediaId"), PlaylistManager.GetFieldValue((int)dataProviderObject.GetProperty("MediaId"), EListType.eTrackList, 358, 0).ToString());
             }
             else if (dataProviderObject is Track)
             {
                 Track track = (Track)dataProviderObject;
                 UsageDataService.ReportTrackAddToCollection(track.Id, track.ReferrerContext);
             }
         }
     }
 }
示例#5
0
 public static Guid GetServiceId(int mediaId) => PlaylistManager.GetFieldValue(mediaId, EListType.eTrackList, 451, Guid.Empty);
示例#6
0
 public static string GetGenreHelper(DataProviderObject item) => PlaylistManager.GetFieldValue((int)item.GetProperty("LibraryId"), EListType.eTrackList, 398, "");
示例#7
0
 public static string GetEpisodeUrlForLibraryId(int id) => PlaylistManager.GetFieldValue(id, PlaylistManager.MediaTypeToListType(MediaType.PodcastEpisode), 317, string.Empty);