diff --git a/ZuneImpl/Library/LibraryVirtualList.cs b/ZuneImpl/Library/LibraryVirtualList.cs new file mode 100644 index 0000000..42ac933 --- /dev/null +++ b/ZuneImpl/Library/LibraryVirtualList.cs @@ -0,0 +1,63 @@ +#if OPENZUNE + +using Microsoft.Iris; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Microsoft.Zune.Library +{ + internal class LibraryVirtualList : VirtualList, ISearchableList + { + private StrixLibraryDataProviderQuery m_owner; + private ZuneQueryList m_pQueryList; + private string m_itemTypeName; + private object m_itemTypeCookie; + private bool m_autoRefresh; + private bool m_useSlowDataRequests; + private bool m_antialiasImageEdges; + + public LibraryVirtualList(StrixLibraryDataProviderQuery owner, ZuneQueryList pQueryList, + bool autoRefresh, bool antialiasEdges) + : base(true) + { + try + { + this.m_owner = owner; + base.StoreQueryResults = true; + this.m_pQueryList = pQueryList; + //pQueryList.AddRef(); + //this.m_fBlockChanges = false; + //this.m_fEndBulkArrivedDuringBlock = false; + this.m_antialiasImageEdges = antialiasEdges; + this.m_autoRefresh = autoRefresh; + if (autoRefresh) + { + //this.m_pQueryList.Advise(this); + } + //base.Count = this.m_pQueryList.Count; + + Add("Howdy there!"); + } + catch + { + base.Dispose(ModelItemDisposeMode.KeepOwnerReference); + throw; + } + } + + internal void SetItemTypeCookie(string itemTypeName, object itemTypeCookie) + { + this.m_itemTypeName = itemTypeName; + this.m_itemTypeCookie = itemTypeCookie; + } + + public int SearchForString(string searchString) + { + throw new NotImplementedException(); + } + } +} + +#endif \ No newline at end of file diff --git a/ZuneImpl/Library/StrixLibraryDataProvider.cs b/ZuneImpl/Library/StrixLibraryDataProvider.cs new file mode 100644 index 0000000..56b58da --- /dev/null +++ b/ZuneImpl/Library/StrixLibraryDataProvider.cs @@ -0,0 +1,21 @@ +#if OPENZUNE + +using Microsoft.Iris; + +namespace Microsoft.Zune.Library +{ + public static class StrixLibraryDataProvider + { + public static void Register() + { + Application.RegisterDataProvider("Library", new DataProviderQueryFactory(ConstructQuery)); + } + + private static DataProviderQuery ConstructQuery(object queryTypeCookie) + { + return new StrixLibraryDataProviderQuery(queryTypeCookie); + } + } +} + +#endif diff --git a/ZuneImpl/Library/StrixLibraryDataProviderQuery.cs b/ZuneImpl/Library/StrixLibraryDataProviderQuery.cs new file mode 100644 index 0000000..14fdd96 --- /dev/null +++ b/ZuneImpl/Library/StrixLibraryDataProviderQuery.cs @@ -0,0 +1,535 @@ +#if OPENZUNE + +using Microsoft.Iris; +using Microsoft.Zune.Playlist; +using StrixMusic.Sdk.AppModels; +using System; +using System.Threading; + +namespace Microsoft.Zune.Library +{ + public class StrixLibraryDataProviderQuery : DataProviderQuery + { + private LibraryVirtualList m_virtualListResultSet; + private bool m_disposed = false; + private int m_requestGeneration; + private string m_thumbnailFallbackImageUrl; + + //public static IStrixDataRoot Root {get; set;} + + public StrixLibraryDataProviderQuery(object typeCookie) : base(typeCookie) + { + } + + protected override void BeginExecute() + { + LibraryVirtualList virtualListResultSet = this.m_virtualListResultSet; + if (virtualListResultSet != null) + { + ((IDisposable)virtualListResultSet).Dispose(); + this.m_virtualListResultSet = null; + } + this.m_thumbnailFallbackImageUrl = null; + this.m_requestGeneration++; + this.Status = DataProviderQueryStatus.RequestingData; + BeginExecuteWorker(m_requestGeneration); + } + + private void BeginExecuteWorker(object state) + { + bool[] sortAscendings = null; + string[] sortStrings = null; + string str = null; + int num = (int)state; + if (true)//num == this.m_requestGeneration) + { + //QueryPropertyBag queryPropertyBag = new QueryPropertyBag(); + //IQueryPropertyBag* iqueryPropertyBag = queryPropertyBag.GetIQueryPropertyBag(); + //bool retainedList = false; + //if (this.GetSortAttributes(out sortStrings, out sortAscendings)) + //{ + + //} + object property = this.GetProperty("ArtistIds"); + if (property != null) + { + + } + object property2 = this.GetProperty("GenreIds"); + if (property2 != null) + { + + } + object property3 = this.GetProperty("AlbumIds"); + if (property3 != null) + { + + } + object property4 = this.GetProperty("UserCardIds"); + if (property4 != null) + { + + } + object property5 = this.GetProperty("DeviceId"); + if (property5 != null) + { + + } + else + { + + } + object property6 = this.GetProperty("SyncMappedError"); + if (property6 != null) + { + + } + property6 = this.GetProperty("UserId"); + if (property6 != null) + { + + } + else + { + + } + object property7 = this.GetProperty("InLibrary"); + if (property7 != null) + { + + } + //object obj13 = calli(System.Int32 modopt(System.Runtime.CompilerServices.IsLong) modopt(System.Runtime.CompilerServices.CallConvCdecl)(System.IntPtr, EQueryPropertyBagProp, System.Int32), iqueryPropertyBag, 2, 0, *(*(long*)iqueryPropertyBag + 56L)); + EQueryTypeView equeryTypeView = EQueryTypeView.eQueryTypeLibraryView; + object property8 = this.GetProperty("ShowDeviceContents"); + if (property8 != null) + { + equeryTypeView = (((bool)property8) ? EQueryTypeView.eQueryTypeDeviceView : equeryTypeView); + } + property8 = this.GetProperty("DiscMediaView"); + if (property8 != null) + { + equeryTypeView = (((bool)property8) ? EQueryTypeView.eQueryTypeDiscMediaView : equeryTypeView); + } + property8 = this.GetProperty("Remaining"); + if (property8 != null) + { + equeryTypeView = (((bool)property8) ? EQueryTypeView.eQueryTypeSyncRemaining : equeryTypeView); + } + property8 = this.GetProperty("Complete"); + if (property8 != null) + { + equeryTypeView = (((bool)property8) ? EQueryTypeView.eQueryTypeSyncSucceeded : equeryTypeView); + } + property8 = this.GetProperty("Failed"); + if (property8 != null) + { + equeryTypeView = (((bool)property8) ? EQueryTypeView.eQueryTypeSyncFailed : equeryTypeView); + } + property8 = this.GetProperty("MultiSelect"); + if (property8 != null && (bool)property8) + { + equeryTypeView = ((EQueryTypeView.eQueryTypeDeviceView == equeryTypeView) ? EQueryTypeView.eQueryTypeDeviceMultiSelectView : EQueryTypeView.eQueryTypeLibraryMultiSelectView); + } + object property9 = this.GetProperty("RulesOnly"); + if (property9 != null) + { + equeryTypeView = (((bool)property9) ? EQueryTypeView.eQueryTypeDeviceSyncRuleView : equeryTypeView); + } + //object obj14 = calli(System.Int32 modopt(System.Runtime.CompilerServices.IsLong) modopt(System.Runtime.CompilerServices.CallConvCdecl)(System.IntPtr, EQueryPropertyBagProp, System.Int32), iqueryPropertyBag, 15, equeryTypeView, *(*(long*)iqueryPropertyBag + 56L)); + object keywordsProp = this.GetProperty("Keywords"); + if (keywordsProp != null) + { + + } + object property11 = this.GetProperty("ContributingArtistId"); + if (property11 != null) + { + + } + property11 = this.GetProperty("ArtistId"); + if (property11 != null) + { + + } + property11 = this.GetProperty("GenreId"); + if (property11 != null) + { + + } + property11 = this.GetProperty("AlbumId"); + if (property11 != null) + { + + } + property11 = this.GetProperty("FolderId"); + if (property11 != null) + { + + } + property11 = this.GetProperty("RecurseIntoFolders"); + if (property11 != null && (int)property11 != 0) + { + + } + object property12 = this.GetProperty("FolderMediaType"); + if (property12 != null) + { + //EMediaTypes emediaTypes = LibraryDataProvider.NameToMediaType((string)property12); + + } + object property13 = this.GetProperty("MediaType"); + if (property13 != null) + { + + } + object property14 = this.GetProperty("TOC"); + if (property14 != null) + { + + } + object property15 = this.GetProperty("SeriesId"); + if (property15 != null) + { + + } + property15 = this.GetProperty("WatchType"); + if (property15 != null) + { + + } + if (this.GetProperty("ExpiresOnly") != null) + { + + } + object property16 = this.GetProperty("Operation"); + if (property16 != null) + { + + } + property16 = this.GetProperty("InitTime"); + if (property16 != null) + { + + } + object property17 = this.GetProperty("PlaylistId"); + if (property17 != null) + { + + } + property17 = this.GetProperty("CategoryId"); + if (property17 != null) + { + + } + property17 = this.GetProperty("PlaylistType"); + if (property17 != null && !string.IsNullOrEmpty((string)property17)) + { + PlaylistType playlistType = (PlaylistType)Enum.Parse(typeof(PlaylistType), (string)property17); + //object obj32 = calli(System.Int32 modopt(System.Runtime.CompilerServices.IsLong) modopt(System.Runtime.CompilerServices.CallConvCdecl)(System.IntPtr, EQueryPropertyBagProp, System.Int32), iqueryPropertyBag, 24, playlistType, *(*(long*)iqueryPropertyBag + 56L)); + } + object property18 = this.GetProperty("PlaylistTypeMask"); + if (property18 != null) + { + int num9 = (int)property18; + if (num9 != 0) + { + + } + } + object property19 = this.GetProperty("MaxResultCount"); + if (property19 != null) + { + + } + property19 = this.GetProperty("DrmStateMask"); + if (property19 != null) + { + ulong num10 = (ulong)((long)property19); + if (num10 != 0UL) + { + + } + } + string text = (string)this.GetProperty("QueryType"); + EQueryType equeryType = EQueryType.eQueryTypeInvalid; + if (keywordsProp != null)//queryPropertyBag.IsSet("Keywords")) + { + if (text == "Artist") + { + equeryType = EQueryType.eQueryTypeArtistsWithKeyword; + } + else if (text == "Album") + { + equeryType = EQueryType.eQueryTypeAlbumsWithKeyword; + } + else if (text == "Track") + { + equeryType = EQueryType.eQueryTypeTracksWithKeyword; + } + else if (text == "Playlist") + { + equeryType = EQueryType.eQueryTypePlaylistsWithKeyword; + } + else if (text == "Photo") + { + equeryType = EQueryType.eQueryTypePhotosWithKeyword; + } + else if (text == "PodcastSeries") + { + equeryType = EQueryType.eQueryTypeSubscriptionsSeriesWithKeyword; + } + else if (text == "PodcastEpisode") + { + equeryType = EQueryType.eQueryTypeSubscriptionsEpisodesWithKeyword; + } + else if (text == "Video") + { + equeryType = EQueryType.eQueryTypeVideoWithKeyword; + } + } + else if (text == "Artist") + { + equeryType = EQueryType.eQueryTypeAllAlbumArtists; + } + else if (text == "Genres") + { + object property20 = this.GetProperty("MediaType"); + int num11; + if (property20 != null) + { + num11 = (int)property20; + } + else + { + num11 = 3; + } + + equeryType = EQueryType.eQueryTypeAllGenres; + } + else if (text == "Album") + { + property19 = this.GetProperty("ArtistId"); + //if ((property19 != null && (int)property19 != -1) || queryPropertyBag.IsSet("ArtistIds")) + //{ + // equeryType = EQueryType.eQueryTypeAlbumsForAlbumArtistId; + //} + //else + //{ + // property19 = this.GetProperty("GenreId"); + // if ((property19 != null && (int)property19 != -1) || queryPropertyBag.IsSet("GenreIds")) + // { + // equeryType = EQueryType.eQueryTypeAlbumsByGenreId; + // } + // else + // { + // equeryType = EQueryType.eQueryTypeAllAlbums; + // } + //} + //retainedList = true; + } + else if (text == "Track") + { + object property21 = this.GetProperty("RulesOnly"); + if (property21 != null) + { + bool flag = (bool)property21; + if (flag) + { + equeryType = EQueryType.eQueryTypeAllTracks; + //goto IL_BDF; + } + } + property21 = this.GetProperty("AlbumId"); + //if ((property21 != null && (int)property21 != -1) || queryPropertyBag.IsSet("AlbumIds")) + //{ + // property19 = this.GetProperty("ArtistId"); + // if ((property19 != null && (int)property19 != -1) || queryPropertyBag.IsSet("ArtistIds")) + // { + // equeryType = EQueryType.eQueryTypeTracksForAlbumArtistId; + // } + // else + // { + // equeryType = EQueryType.eQueryTypeTracksForAlbumId; + // } + //} + //else + //{ + // property19 = this.GetProperty("ArtistId"); + // if ((property19 != null && (int)property19 != -1) || queryPropertyBag.IsSet("ArtistIds")) + // { + // equeryType = EQueryType.eQueryTypeTracksForAlbumArtistId; + // } + // else + // { + // property19 = this.GetProperty("GenreId"); + // if ((property19 != null && (int)property19 != -1) || queryPropertyBag.IsSet("GenreIds")) + // { + // equeryType = EQueryType.eQueryTypeTracksByGenreId; + // } + // else + // { + // property19 = this.GetProperty("Detailed"); + // if (property19 != null && (bool)property19) + // { + // equeryType = EQueryType.eQueryTypeAllTracksDetailed; + // } + // else + // { + // property19 = this.GetProperty("TOC"); + // if (property19 != null && !string.IsNullOrEmpty((string)property19)) + // { + // equeryType = EQueryType.eQueryTypeTracksForTOC; + // } + // else + // { + // equeryType = EQueryType.eQueryTypeAllTracks; + // } + // } + // } + // } + //} + } + else if (text == "AlbumByTOC") + { + equeryType = EQueryType.eQueryTypeAlbumsByTOC; + //if (!queryPropertyBag.IsSet("TOC")) + //{ + // equeryType = EQueryType.eQueryTypeInvalid; + //} + } + else if (text == "Photo") + { + equeryType = ((equeryTypeView == EQueryTypeView.eQueryTypeDeviceSyncRuleView) ? EQueryType.eQueryTypeAllPhotos : EQueryType.eQueryTypePhotosByFolderId); + } + else if (text == "MediaFolder") + { + equeryType = EQueryType.eQueryTypeMediaFolders; + } + else if (text == "Video") + { + property19 = this.GetProperty("CategoryId"); + if (property19 != null && (int)property19 != -1) + { + equeryType = EQueryType.eQueryTypeVideosByCategoryId; + } + else + { + equeryType = EQueryType.eQueryTypeAllVideos; + } + } + else if (text == "PodcastSeries") + { + equeryType = EQueryType.eQueryTypeAllPodcastSeries; + } + else if (text == "PodcastEpisode") + { + property19 = this.GetProperty("SeriesId"); + if (property19 != null && (int)property19 != -1) + { + equeryType = EQueryType.eQueryTypeEpisodesForSeriesId; + } + else + { + equeryType = EQueryType.eQueryTypeAllPodcastEpisodes; + } + } + else if (text == "SyncItem") + { + equeryType = EQueryType.eQueryTypeSyncProgress; + } + else if (text == "Playlist") + { + equeryType = EQueryType.eQueryTypeAllPlaylists; + } + else if (text == "PlaylistContent") + { + equeryType = EQueryType.eQueryTypePlaylistContentByPlaylistId; + } + else if (text == "UserCard") + { + equeryType = EQueryType.eQueryTypeUserCards; + } + else if (text == "Person") + { + equeryType = EQueryType.eQueryTypePersonsByTypeId; + EMediaTypes emediaTypes2 = EMediaTypes.eMediaTypePersonArtist; + emediaTypes2 = (((string)this.GetProperty("PersonType") == "Composer") ? EMediaTypes.eMediaTypePersonComposer : emediaTypes2); + + } + else if (text == "ArtistsRanking") + { + equeryType = EQueryType.eQueryTypeArtistsRanking; + } + else if (text == "TVSeries") + { + equeryType = EQueryType.eQueryTypeVideoSeriesTitles; + } + else if (text == "Pin") + { + equeryType = EQueryType.eQueryTypePinsByPinType; + EPinType epinType = EPinType.ePinTypeGeneric; + property19 = this.GetProperty("PinType"); + if (property19 != null) + { + epinType = (EPinType)property19; + } + + } + else + { + equeryType = ((text == "App") ? EQueryType.eQueryTypeAllApps : equeryType); + } + + + ZuneQueryList queryList = new(equeryType); + DeferredSetResult(new DeferredSetResultArgs(num, queryList, false));// retainedList)); + } + } + + private void DeferredSetResult(object state) + { + DeferredSetResultArgs deferredSetResultArgs = (DeferredSetResultArgs)state; + bool isEmpty = true; + if (deferredSetResultArgs.QueryList != null) + { + object property = this.GetProperty("AutoRefresh"); + bool autoRefresh = property == null || (bool)property; + object property2 = this.GetProperty("AntialiasImageEdges"); + bool antialiasEdges = property2 != null && (bool)property2; + this.m_thumbnailFallbackImageUrl = (string)this.GetProperty("ThumbnailFallbackImageUrl"); + LibraryVirtualList virtualListResultSet = this.m_virtualListResultSet; + if (virtualListResultSet != null) + { + ((IDisposable)virtualListResultSet).Dispose(); + } + LibraryVirtualList libraryVirtualList = new(this, deferredSetResultArgs.QueryList, autoRefresh, antialiasEdges); + this.m_virtualListResultSet = libraryVirtualList; + ReleaseBehavior visualReleaseBehavior = deferredSetResultArgs.RetainedList ? ReleaseBehavior.KeepReference : ReleaseBehavior.ReleaseReference; + libraryVirtualList.VisualReleaseBehavior = visualReleaseBehavior; + isEmpty = deferredSetResultArgs.QueryList.IsEmpty; + } + StrixLibraryDataProviderQueryResult libraryDataProviderQueryResult = new(this, this.m_virtualListResultSet, base.ResultTypeCookie); + libraryDataProviderQueryResult.SetIsEmpty(isEmpty); + this.Result = libraryDataProviderQueryResult; + this.Status = DataProviderQueryStatus.Complete; + } + } + + internal class DeferredSetResultArgs + { + public DeferredSetResultArgs(int requestGeneration, ZuneQueryList queryList, bool retainedList) + { + RequestGeneration = requestGeneration; + QueryList = queryList; + RetainedList = retainedList; + } + + public int RequestGeneration { get; } + + public ZuneQueryList QueryList { get; } + + public bool RetainedList { get; } + } +} + +#endif \ No newline at end of file diff --git a/ZuneImpl/Library/StrixLibraryDataProviderQueryResult.cs b/ZuneImpl/Library/StrixLibraryDataProviderQueryResult.cs new file mode 100644 index 0000000..a6ae7ee --- /dev/null +++ b/ZuneImpl/Library/StrixLibraryDataProviderQueryResult.cs @@ -0,0 +1,67 @@ +#if OPENZUNE + +using System; +using System.Runtime.InteropServices; +using Microsoft.Iris; + +namespace Microsoft.Zune.Library +{ + // Token: 0x02000271 RID: 625 + internal class StrixLibraryDataProviderQueryResult : DataProviderObject + { + // Token: 0x06000F6A RID: 3946 RVA: 0x000E90D0 File Offset: 0x000E84D0 + public StrixLibraryDataProviderQueryResult(StrixLibraryDataProviderQuery owner, LibraryVirtualList virtualListResultSet, object resultTypeCookie) : base(owner, resultTypeCookie) + { + this.m_virtualListResultSet = virtualListResultSet; + if (virtualListResultSet != null) + { + foreach (DataProviderMapping dataProviderMapping in base.Mappings.Values) + { + if (dataProviderMapping.UnderlyingCollectionTypeCookie != null) + { + this.m_virtualListResultSet.SetItemTypeCookie(dataProviderMapping.UnderlyingCollectionTypeName, dataProviderMapping.UnderlyingCollectionTypeCookie); + } + } + } + } + + // Token: 0x06000F6B RID: 3947 RVA: 0x000E9160 File Offset: 0x000E8560 + public override object GetProperty(string propertyName) + { + DataProviderMapping dataProviderMapping = null; + if (propertyName == "IsEmpty") + { + return this.m_isEmpty; + } + if (base.Mappings.TryGetValue(propertyName, out dataProviderMapping)) + { + return this.m_virtualListResultSet; + } + return null; + } + + // Token: 0x06000F6C RID: 3948 RVA: 0x00101710 File Offset: 0x00100B10 + public override void SetProperty(string propertyName, object value) + { + throw new NotSupportedException(); + } + + // Token: 0x06000F6D RID: 3949 RVA: 0x000E91A8 File Offset: 0x000E85A8 + public void SetIsEmpty([MarshalAs(UnmanagedType.U1)] bool isEmpty) + { + if (this.m_isEmpty != isEmpty) + { + this.m_isEmpty = isEmpty; + base.FirePropertyChanged("IsEmpty"); + } + } + + // Token: 0x04000B3C RID: 2876 + protected LibraryVirtualList m_virtualListResultSet; + + // Token: 0x04000B3D RID: 2877 + protected bool m_isEmpty; + } +} + +#endif \ No newline at end of file diff --git a/ZuneImpl/Library/ZuneQueryList.cs b/ZuneImpl/Library/ZuneQueryList.cs new file mode 100644 index 0000000..b3b899d --- /dev/null +++ b/ZuneImpl/Library/ZuneQueryList.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Microsoft.Zune.Library +{ + public class ZuneQueryList : IDisposable + { + internal ZuneQueryList(EQueryType queryType) + { + + } + + public bool IsEmpty { get; protected set; } + + public bool IsDisposed { get; protected set; } + + public int Count { get; protected set; } + + public void Dispose() + { + IsDisposed = true; + } + } +} diff --git a/ZuneImpl/ZuneImpl.csproj b/ZuneImpl/ZuneImpl.csproj index d5b186f..0d1e8f8 100644 --- a/ZuneImpl/ZuneImpl.csproj +++ b/ZuneImpl/ZuneImpl.csproj @@ -25,6 +25,8 @@ + + diff --git a/ZuneShell/Microsoft/Zune/Shell/ZuneApplication.cs b/ZuneShell/Microsoft/Zune/Shell/ZuneApplication.cs index e37e619..9bab2ab 100644 --- a/ZuneShell/Microsoft/Zune/Shell/ZuneApplication.cs +++ b/ZuneShell/Microsoft/Zune/Shell/ZuneApplication.cs @@ -451,7 +451,11 @@ namespace Microsoft.Zune.Shell DialogHelper.DialogNo = ZuneUI.Shell.LoadString(StringId.IDS_DIALOG_NO); DialogHelper.DialogOk = ZuneUI.Shell.LoadString(StringId.IDS_DIALOG_OK); XmlDataProviders.Register(); +#if false//OPENZUNE + Library.StrixLibraryDataProvider.Register(); +#else LibraryDataProvider.Register(); +#endif SubscriptionDataProvider.Register(); StaticLibraryDataProvider.Register(); AggregateDataProviderQuery.Register(); diff --git a/libs/MicrosoftIris b/libs/MicrosoftIris index 21fbce6..b476bb2 160000 --- a/libs/MicrosoftIris +++ b/libs/MicrosoftIris @@ -1 +1 @@ -Subproject commit 21fbce65dfadb9fe4592138d8258117dacefd005 +Subproject commit b476bb2677010ab068055c1ab7319674920265f2