public List <Vector2Int> GetStubData(StubType type) { if (_stubData.ContainsKey(type)) { return(_stubData[type]); } return(null); }
public Stub(Attribute attrib, StubType stubtype, LinkLocation linkLoc, Color col) : this() { StubLen = 5f; StubColor = col; StubType = stubtype; Attribute = attrib; LinkLoc = linkLoc; }
public void InitStubData(StubType type) { List <Vector2Int> RoleStubData = Role.Instance.GetStubData(type); StubData.Clear(); for (int idx = 0; idx < RoleStubData.Count; ++idx) { StubData.Add(RoleStubData[idx].x, RoleStubData[idx].y); } }
public override uint GetStubCodeOffset(StubType stubType) { switch (stubType) { case StubType.Export: case StubType.EntryPoint: return(0); default: throw new ArgumentOutOfRangeException(); } }
public override uint GetStubSize(StubType stubType) { switch (stubType) { case StubType.Export: case StubType.EntryPoint: return(2 /*padding*/ + 12); default: throw new ArgumentOutOfRangeException(); } }
public override void WriteStubRelocs(StubType stubType, RelocDirectory relocDirectory, IChunk chunk, uint stubOffset) { switch (stubType) { case StubType.Export: case StubType.EntryPoint: relocDirectory.Add(chunk, stubOffset + 4); break; default: throw new ArgumentOutOfRangeException(); } }
public override void WriteStub(StubType stubType, DataWriter writer, ulong imageBase, uint stubRva, uint managedFuncRva) { switch (stubType) { case StubType.Export: case StubType.EntryPoint: writer.WriteUInt32(0xF000F8DF); writer.WriteUInt32((uint)imageBase + managedFuncRva); break; default: throw new ArgumentOutOfRangeException(); } }
public override void WriteStub(StubType stubType, BinaryWriter writer, ulong imageBase, uint stubRva, uint managedFuncRva) { switch (stubType) { case StubType.Export: case StubType.EntryPoint: writer.Write((ushort)0); // padding writer.Write((ushort)0x25FF); writer.Write((uint)imageBase + managedFuncRva); break; default: throw new ArgumentOutOfRangeException(); } }
public override void WriteStub(StubType stubType, DataWriter writer, ulong imageBase, uint stubRva, uint managedFuncRva) { switch (stubType) { case StubType.Export: case StubType.EntryPoint: writer.WriteUInt16(0); // padding writer.WriteUInt16(0xA148); writer.WriteUInt64(imageBase + managedFuncRva); writer.WriteUInt16(0xE0FF); break; default: throw new ArgumentOutOfRangeException(); } }
public XmlElement GetItemElement(DlnaOptions options, XmlDocument doc, BaseItem item, BaseItem context, StubType? contextStubType, string deviceId, Filter filter, StreamInfo streamInfo = null) { var clientId = GetClientId(item, null); var element = doc.CreateElement(string.Empty, "item", NS_DIDL); element.SetAttribute("restricted", "1"); element.SetAttribute("id", clientId); if (context != null) { element.SetAttribute("parentID", GetClientId(context, contextStubType)); } else { var parent = item.DisplayParentId; if (parent.HasValue) { element.SetAttribute("parentID", GetClientId(parent.Value, null)); } } //AddBookmarkInfo(item, user, element); AddGeneralProperties(item, null, context, element, filter); // refID? // storeAttribute(itemNode, object, ClassProperties.REF_ID, false); var hasMediaSources = item as IHasMediaSources; if (hasMediaSources != null) { if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase)) { AddAudioResource(options, element, hasMediaSources, deviceId, filter, streamInfo); } else if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)) { AddVideoResource(options, element, hasMediaSources, deviceId, filter, streamInfo); } } AddCover(item, context, null, element); return element; }
public override void WriteStub(StubType stubType, DataWriter writer, ulong imageBase, uint stubRva, uint managedFuncRva) { switch (stubType) { case StubType.Export: case StubType.EntryPoint: writer.WriteUInt64(0x40A010180200480BUL); writer.WriteUInt64(0x0004000000283024UL); writer.WriteUInt64(0x5060101812000810UL); writer.WriteUInt64(0x0080006000038004UL); writer.WriteUInt64(imageBase + stubRva); writer.WriteUInt64(imageBase + managedFuncRva); break; default: throw new ArgumentOutOfRangeException(); } }
private StubType _stubType = StubType.PVE; //打开何种类型布阵 public override void SetParameters(object[] arg) { base.SetParameters(arg); if (arg.Length > 0) { _openType = (int)arg[0]; } else { _openType = 0; } if (arg.Length > 1) { _stubType = (StubType)arg[1]; } else { _stubType = StubType.PVE; } }
/// <summary> /// Lookup an export inside the module. /// </summary> /// <param name="type">The type of the export to find.</param> /// <param name="nid">The NID of the export to look up.</param> /// <returns>The <see cref="StubExport"/> or <c>null</c> if it was not found.</returns> public StubExport LookupExport(StubType type, uint nid) { StubExport value; switch (type) { case StubType.Function: if (_exportFunctionLookup.TryGetValue(nid, out value) == true) { return(value); } break; case StubType.Variable: if (_exportVariableLookup.TryGetValue(nid, out value) == true) { return(value); } break; } return(null); }
/// <summary> /// Gets the offset of the code (entry point) relative to the start of the stub /// </summary> /// <param name="stubType">Stub type</param> /// <returns></returns> public abstract uint GetStubCodeOffset(StubType stubType);
/// <summary> /// Lookup an export inside the module. /// </summary> /// <param name="type">The type of the export to find.</param> /// <param name="nid">The NID of the export to look up.</param> /// <returns>The <see cref="StubExport"/> or <c>null</c> if it was not found.</returns> public StubExport LookupExport( StubType type, uint nid ) { StubExport value; switch( type ) { case StubType.Function: if( _exportFunctionLookup.TryGetValue( nid, out value ) == true ) return value; break; case StubType.Variable: if( _exportVariableLookup.TryGetValue( nid, out value ) == true ) return value; break; } return null; }
private void AddGeneralProperties(BaseItem item, StubType? itemStubType, BaseItem context, XmlElement element, Filter filter) { AddCommonFields(item, itemStubType, context, element, filter); var audio = item as Audio; if (audio != null) { foreach (var artist in audio.Artists) { AddValue(element, "upnp", "artist", artist, NS_UPNP); } if (!string.IsNullOrEmpty(audio.Album)) { AddValue(element, "upnp", "album", audio.Album, NS_UPNP); } foreach (var artist in audio.AlbumArtists) { AddAlbumArtist(element, artist); } } var album = item as MusicAlbum; if (album != null) { foreach (var artist in album.AlbumArtists) { AddAlbumArtist(element, artist); AddValue(element, "upnp", "artist", artist, NS_UPNP); } foreach (var artist in album.Artists) { AddValue(element, "upnp", "artist", artist, NS_UPNP); } } var musicVideo = item as MusicVideo; if (musicVideo != null) { foreach (var artist in musicVideo.Artists) { AddValue(element, "upnp", "artist", artist, NS_UPNP); AddAlbumArtist(element, artist); } if (!string.IsNullOrEmpty(musicVideo.Album)) { AddValue(element, "upnp", "album", musicVideo.Album, NS_UPNP); } } if (item.IndexNumber.HasValue) { AddValue(element, "upnp", "originalTrackNumber", item.IndexNumber.Value.ToString(_usCulture), NS_UPNP); if (item is Episode) { AddValue(element, "upnp", "episodeNumber", item.IndexNumber.Value.ToString(_usCulture), NS_UPNP); } } }
void PrepairSelectedType() { int index = cbStubTypes.SelectedIndex; if(index == -1 || index > LoadedTypes.Length-1) { this.Height = 80; SelectedType = null; FormBorderStyle = FormBorderStyle.FixedToolWindow; return; } if (this.Height == 80) { FormBorderStyle = FormBorderStyle.SizableToolWindow; this.Height = 280; } SelectedType = LoadedTypes[index]; lbDataInfo.Text = SelectedType.Infomation.ReturnDescription; pData.Controls.Clear(); ReturnTypeUserControl c = GetUserControl(SelectedType.Infomation.ReturnType); c.Dock = DockStyle.Fill; pData.Controls.Add(c); }
private string GetDisplayName(BaseItem item, StubType? itemStubType, BaseItem context) { if (itemStubType.HasValue && itemStubType.Value == StubType.People) { if (item is Video) { return _localization.GetLocalizedString("HeaderCastCrew"); } return _localization.GetLocalizedString("HeaderPeople"); } var episode = item as Episode; var season = context as Season; if (episode != null && season != null) { // This is a special embedded within a season if (item.ParentIndexNumber.HasValue && item.ParentIndexNumber.Value == 0) { if (season.IndexNumber.HasValue && season.IndexNumber.Value != 0) { return string.Format(_localization.GetLocalizedString("ValueSpecialEpisodeName"), item.Name); } } if (item.IndexNumber.HasValue) { var number = item.IndexNumber.Value.ToString("00").ToString(CultureInfo.InvariantCulture); if (episode.IndexNumberEnd.HasValue) { number += "-" + episode.IndexNumberEnd.Value.ToString("00").ToString(CultureInfo.InvariantCulture); } return number + " - " + item.Name; } } return item.Name; }
//private void AddBookmarkInfo(BaseItem item, User user, XmlElement element) //{ // var userdata = _userDataManager.GetUserData(user.Id, item.GetUserDataKey()); // if (userdata.PlaybackPositionTicks > 0) // { // var dcmInfo = element.OwnerDocument.CreateElement("sec", "dcmInfo", NS_SEC); // dcmInfo.InnerText = string.Format("BM={0}", Convert.ToInt32(TimeSpan.FromTicks(userdata.PlaybackPositionTicks).TotalSeconds).ToString(_usCulture)); // element.AppendChild(dcmInfo); // } //} /// <summary> /// Adds fields used by both items and folders /// </summary> /// <param name="item">The item.</param> /// <param name="itemStubType">Type of the item stub.</param> /// <param name="context">The context.</param> /// <param name="element">The element.</param> /// <param name="filter">The filter.</param> private void AddCommonFields(BaseItem item, StubType? itemStubType, BaseItem context, XmlElement element, Filter filter) { // Don't filter on dc:title because not all devices will include it in the filter // MediaMonkey for example won't display content without a title //if (filter.Contains("dc:title")) { AddValue(element, "dc", "title", GetDisplayName(item, itemStubType, context), NS_DC); } element.AppendChild(CreateObjectClass(element.OwnerDocument, item, itemStubType)); if (filter.Contains("dc:date")) { if (item.PremiereDate.HasValue) { AddValue(element, "dc", "date", item.PremiereDate.Value.ToString("o"), NS_DC); } } if (filter.Contains("upnp:genre")) { foreach (var genre in item.Genres) { AddValue(element, "upnp", "genre", genre, NS_UPNP); } } foreach (var studio in item.Studios) { AddValue(element, "upnp", "publisher", studio, NS_UPNP); } if (filter.Contains("dc:description")) { var desc = item.Overview; var hasShortOverview = item as IHasShortOverview; if (hasShortOverview != null && !string.IsNullOrEmpty(hasShortOverview.ShortOverview)) { desc = hasShortOverview.ShortOverview; } if (!string.IsNullOrWhiteSpace(desc)) { AddValue(element, "dc", "description", desc, NS_DC); } } if (filter.Contains("upnp:longDescription")) { if (!string.IsNullOrWhiteSpace(item.Overview)) { AddValue(element, "upnp", "longDescription", item.Overview, NS_UPNP); } } if (!string.IsNullOrEmpty(item.OfficialRating)) { if (filter.Contains("dc:rating")) { AddValue(element, "dc", "rating", item.OfficialRating, NS_DC); } if (filter.Contains("upnp:rating")) { AddValue(element, "upnp", "rating", item.OfficialRating, NS_UPNP); } } AddPeople(item, element); }
/// <summary> /// Writes the stub that jumps to the managed function /// </summary> /// <param name="stubType">Stub type</param> /// <param name="writer">Writer</param> /// <param name="imageBase">Image base</param> /// <param name="stubRva">RVA of this stub</param> /// <param name="managedFuncRva">RVA of a pointer-sized field that contains the absolute address of the managed function</param> public abstract void WriteStub(StubType stubType, DataWriter writer, ulong imageBase, uint stubRva, uint managedFuncRva);
public static string GetClientId(BaseItem item, StubType? stubType) { return GetClientId(item.Id, stubType); }
/// <summary> /// Writes stub relocs, if needed /// </summary> /// <param name="stubType">Stub type</param> /// <param name="relocDirectory">Reloc directory</param> /// <param name="chunk">The chunk where this stub will be written to</param> /// <param name="stubOffset">Offset of this stub in <paramref name="chunk"/></param> public abstract void WriteStubRelocs(StubType stubType, RelocDirectory relocDirectory, IChunk chunk, uint stubOffset);
public string StubMethodWithParameters(string param1, int param2, StubType param3) { return(string.Empty); }
public static string GetClientId(BaseItem item, StubType? stubType) { var id = item.Id.ToString("N"); if (stubType.HasValue) { id = stubType.Value.ToString().ToLower() + "_" + id; } return id; }
/// <summary> /// Initializes a new instance of the <see cref="ServerItem"/> class. /// </summary> /// <param name="item">The <see cref="BaseItem"/>.</param> /// <param name="stubType">The <see cref="StubType"/>.</param> public ServerItem(BaseItem item, StubType stubType) { Item = item; StubType = stubType; }
private async Task<QueryResult<ServerItem>> GetUserItems(BaseItem item, StubType? stubType, User user, SortCriteria sort, int? startIndex, int? limit) { if (stubType.HasValue) { if (stubType.Value == StubType.People) { var items = _libraryManager.GetPeopleItems(new InternalPeopleQuery { ItemId = item.Id }).ToArray(); var result = new QueryResult<ServerItem> { Items = items.Select(i => new ServerItem { Item = i, StubType = StubType.Folder }).ToArray(), TotalRecordCount = items.Length }; return ApplyPaging(result, startIndex, limit); } if (stubType.Value == StubType.Folder) { var movie = item as Movie; if (movie != null) { return ApplyPaging(await GetMovieItems(movie).ConfigureAwait(false), startIndex, limit); } } var person = item as Person; if (person != null) { return GetItemsFromPerson(person, user, startIndex, limit); } return ApplyPaging(new QueryResult<ServerItem>(), startIndex, limit); } var folder = (Folder)item; var sortOrders = new List<string>(); if (!folder.IsPreSorted) { sortOrders.Add(ItemSortBy.SortName); } var queryResult = await folder.GetItems(new InternalItemsQuery { Limit = limit, StartIndex = startIndex, SortBy = sortOrders.ToArray(), SortOrder = sort.SortOrder, User = user, IsMissing = false, PresetViews = new[] { CollectionType.Movies, CollectionType.TvShows, CollectionType.Music }, ExcludeItemTypes = new[] { typeof(Game).Name, typeof(Book).Name }, IsPlaceHolder = false }).ConfigureAwait(false); var options = _config.GetDlnaConfiguration(); var serverItems = queryResult .Items .Select(i => new ServerItem { Item = i, StubType = GetDisplayStubType(i, item, options) }) .ToArray(); return new QueryResult<ServerItem> { TotalRecordCount = queryResult.TotalRecordCount, Items = serverItems }; }
public static string GetClientId(Guid idValue, StubType? stubType) { var id = idValue.ToString("N"); if (stubType.HasValue) { id = stubType.Value.ToString().ToLower() + "_" + id; } return id; }
public void Setup() { this.TestStub = new StubType(); }
public XmlElement GetFolderElement(XmlDocument doc, BaseItem folder, StubType? stubType, BaseItem context, int childCount, Filter filter, string requestedId = null) { var container = doc.CreateElement(string.Empty, "container", NS_DIDL); container.SetAttribute("restricted", "0"); container.SetAttribute("searchable", "1"); container.SetAttribute("childCount", childCount.ToString(_usCulture)); var clientId = GetClientId(folder, stubType); if (string.Equals(requestedId, "0")) { container.SetAttribute("id", "0"); container.SetAttribute("parentID", "-1"); } else { container.SetAttribute("id", clientId); if (context != null) { container.SetAttribute("parentID", GetClientId(context, null)); } else { var parent = folder.DisplayParentId; if (!parent.HasValue) { container.SetAttribute("parentID", "0"); } else { container.SetAttribute("parentID", GetClientId(parent.Value, null)); } } } AddCommonFields(folder, stubType, null, container, filter); AddCover(folder, context, stubType, container); return container; }
/// <summary> /// Gets the required alignment for the stubs, must be a power of 2 /// </summary> /// <param name="stubType">Stub type</param> /// <returns></returns> public abstract uint GetStubAlignment(StubType stubType);
private XmlElement CreateObjectClass(XmlDocument result, BaseItem item, StubType? stubType) { // More types here // http://oss.linn.co.uk/repos/Public/LibUpnpCil/DidlLite/UpnpAv/Test/TestDidlLite.cs var objectClass = result.CreateElement("upnp", "class", NS_UPNP); if (item.IsFolder || stubType.HasValue) { string classType = null; if (!_profile.RequiresPlainFolders) { if (item is MusicAlbum) { classType = "object.container.album.musicAlbum"; } else if (item is MusicArtist) { classType = "object.container.person.musicArtist"; } else if (item is Series || item is Season || item is BoxSet || item is Video) { classType = "object.container.album.videoAlbum"; } else if (item is Playlist) { classType = "object.container.playlistContainer"; } else if (item is PhotoAlbum) { classType = "object.container.album.photoAlbum"; } } objectClass.InnerText = classType ?? "object.container.storageFolder"; } else if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase)) { objectClass.InnerText = "object.item.audioItem.musicTrack"; } else if (string.Equals(item.MediaType, MediaType.Photo, StringComparison.OrdinalIgnoreCase)) { objectClass.InnerText = "object.item.imageItem.photo"; } else if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)) { if (!_profile.RequiresPlainVideoItems && item is Movie) { objectClass.InnerText = "object.item.videoItem.movie"; } else if (!_profile.RequiresPlainVideoItems && item is MusicVideo) { objectClass.InnerText = "object.item.videoItem.musicVideoClip"; } else { objectClass.InnerText = "object.item.videoItem"; } } else if (item is MusicGenre) { objectClass.InnerText = _profile.RequiresPlainFolders ? "object.container.storageFolder" : "object.container.genre.musicGenre"; } else if (item is Genre || item is GameGenre) { objectClass.InnerText = _profile.RequiresPlainFolders ? "object.container.storageFolder" : "object.container.genre"; } else { objectClass.InnerText = "object.item"; } return objectClass; }
/// <summary> /// Gets the size of a stub, it doesn't have to be a multiple of <see cref="GetStubAlignment(StubType)"/> /// </summary> /// <param name="stubType">Stub type</param> /// <returns></returns> public abstract uint GetStubSize(StubType stubType);
private void AddCover(BaseItem item, BaseItem context, StubType? stubType, XmlElement element) { if (stubType.HasValue && stubType.Value == StubType.People) { AddEmbeddedImageAsCover("people", element); return; } ImageDownloadInfo imageInfo = null; if (context is UserView) { var episode = item as Episode; if (episode != null) { var parent = (BaseItem)episode.Series ?? episode.Season; if (parent != null) { imageInfo = GetImageInfo(parent); } } } // Finally, just use the image from the item if (imageInfo == null) { imageInfo = GetImageInfo(item); } if (imageInfo == null) { return; } var result = element.OwnerDocument; var playbackPercentage = 0; var unplayedCount = 0; if (item is Video) { var userData = _userDataManager.GetUserDataDto(item, _user); playbackPercentage = Convert.ToInt32(userData.PlayedPercentage ?? 0); if (playbackPercentage >= 100 || userData.Played) { playbackPercentage = 100; } } else if (item is Series || item is Season || item is BoxSet) { var userData = _userDataManager.GetUserDataDto(item, _user); if (userData.Played) { playbackPercentage = 100; } else { unplayedCount = userData.UnplayedItemCount ?? 0; } } var albumartUrlInfo = GetImageUrl(imageInfo, _profile.MaxAlbumArtWidth, _profile.MaxAlbumArtHeight, playbackPercentage, unplayedCount, "jpg"); var icon = result.CreateElement("upnp", "albumArtURI", NS_UPNP); var profile = result.CreateAttribute("dlna", "profileID", NS_DLNA); profile.InnerText = _profile.AlbumArtPn; icon.SetAttributeNode(profile); icon.InnerText = albumartUrlInfo.Url; element.AppendChild(icon); // TOOD: Remove these default values var iconUrlInfo = GetImageUrl(imageInfo, _profile.MaxIconWidth ?? 48, _profile.MaxIconHeight ?? 48, playbackPercentage, unplayedCount, "jpg"); icon = result.CreateElement("upnp", "icon", NS_UPNP); icon.InnerText = iconUrlInfo.Url; element.AppendChild(icon); if (!_profile.EnableAlbumArtInDidl) { if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) || string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)) { if (!stubType.HasValue) { return; } } } AddImageResElement(item, element, 160, 160, playbackPercentage, unplayedCount, "jpg", "JPEG_TN"); if (!_profile.EnableSingleAlbumArtLimit) { AddImageResElement(item, element, 4096, 4096, playbackPercentage, unplayedCount, "jpg", "JPEG_LRG"); AddImageResElement(item, element, 1024, 768, playbackPercentage, unplayedCount, "jpg", "JPEG_MED"); AddImageResElement(item, element, 640, 480, playbackPercentage, unplayedCount, "jpg", "JPEG_SM"); AddImageResElement(item, element, 4096, 4096, playbackPercentage, unplayedCount, "png", "PNG_LRG"); AddImageResElement(item, element, 160, 160, playbackPercentage, unplayedCount, "png", "PNG_TN"); } }
public string StubMethodWithParameters(string param1, int param2, StubType param3) { return string.Empty; }
private async Task<QueryResult<ServerItem>> GetUserItems(BaseItem item, StubType? stubType, User user, SortCriteria sort, int? startIndex, int? limit) { if (stubType.HasValue) { if (stubType.Value == StubType.People) { var items = item.People.Select(i => { try { return _libraryManager.GetPerson(i.Name); } catch { return null; } }).Where(i => i != null).ToArray(); var result = new QueryResult<ServerItem> { Items = items.Select(i => new ServerItem { Item = i, StubType = StubType.Folder }).ToArray(), TotalRecordCount = items.Length }; return ApplyPaging(result, startIndex, limit); } if (stubType.Value == StubType.Folder) { var movie = item as Movie; if (movie != null) { return ApplyPaging(await GetMovieItems(movie).ConfigureAwait(false), startIndex, limit); } } var person = item as Person; if (person != null) { return await GetItemsFromPerson(person, user, startIndex, limit).ConfigureAwait(false); } return ApplyPaging(new QueryResult<ServerItem>(), startIndex, limit); } var folder = (Folder)item; var sortOrders = new List<string>(); if (!folder.IsPreSorted) { sortOrders.Add(ItemSortBy.SortName); } var queryResult = await folder.GetItems(new InternalItemsQuery { Limit = limit, StartIndex = startIndex, SortBy = sortOrders.ToArray(), SortOrder = sort.SortOrder, User = user, Filter = FilterUnsupportedContent }).ConfigureAwait(false); var options = _config.GetDlnaConfiguration(); var serverItems = queryResult .Items .Select(i => new ServerItem { Item = i, StubType = GetDisplayStubType(i, item, options) }) .ToArray(); return new QueryResult<ServerItem> { TotalRecordCount = queryResult.TotalRecordCount, Items = serverItems }; }
private async Task<QueryResult<ServerItem>> GetUserItems(BaseItem item, StubType? stubType, User user, SortCriteria sort, int? startIndex, int? limit) { if (stubType.HasValue) { if (stubType.Value == StubType.People) { var items = _libraryManager.GetPeopleItems(new InternalPeopleQuery { ItemId = item.Id }).ToArray(); var result = new QueryResult<ServerItem> { Items = items.Select(i => new ServerItem { Item = i, StubType = StubType.Folder }).ToArray(), TotalRecordCount = items.Length }; return ApplyPaging(result, startIndex, limit); } if (stubType.Value == StubType.Folder) { var movie = item as Movie; if (movie != null) { return ApplyPaging(await GetMovieItems(movie).ConfigureAwait(false), startIndex, limit); } } var person = item as Person; if (person != null) { return GetItemsFromPerson(person, user, startIndex, limit); } return ApplyPaging(new QueryResult<ServerItem>(), startIndex, limit); } var folder = (Folder)item; var sortOrders = new List<string>(); if (!folder.IsPreSorted) { sortOrders.Add(ItemSortBy.SortName); } QueryResult<BaseItem> queryResult; if (folder is UserRootFolder) { var views = await _userViewManager.GetUserViews(new UserViewQuery { UserId = user.Id.ToString("N"), PresetViews = new[] { CollectionType.Movies, CollectionType.TvShows, CollectionType.Music } }, CancellationToken.None) .ConfigureAwait(false); queryResult = new QueryResult<BaseItem> { Items = views.Cast<BaseItem>().ToArray() }; queryResult.TotalRecordCount = queryResult.Items.Length; } else { queryResult = await folder.GetItems(new InternalItemsQuery { Limit = limit, StartIndex = startIndex, SortBy = sortOrders.ToArray(), SortOrder = sort.SortOrder, User = user, Filter = FilterUnsupportedContent }).ConfigureAwait(false); } var options = _config.GetDlnaConfiguration(); var serverItems = queryResult .Items .Select(i => new ServerItem { Item = i, StubType = GetDisplayStubType(i, item, options) }) .ToArray(); return new QueryResult<ServerItem> { TotalRecordCount = queryResult.TotalRecordCount, Items = serverItems }; }