static UPnPError OnSearch(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context) { // In parameters var containerId = (string)inParams[0]; var searchCriteria = inParams[1].ToString(); var filter = inParams[2].ToString(); var startingIndex = Convert.ToInt32(inParams[3]); var requestedCount = Convert.ToInt32(inParams[4]); var sortCriteria = (string)inParams[5]; // Out parameters int numberReturned = 0; int totalMatches = 0; int containterUpdateId = 0; UPnPContentDirectorySearch query = new UPnPContentDirectorySearch(); StringWriter sw = new StringWriter(); query.Construct(searchCriteria, sw); query.searchCrit(); PegNode pn = query.GetRoot(); string xml = ParserHelper.PegNodeToXml(pn, searchCriteria); Logger.Debug("MediaServer - Parsed: \"{0}\" to make \"{1}\"", searchCriteria, xml); var parentDirectoryId = containerId == "0" ? Guid.Empty : MarshallingHelper.DeserializeGuid(containerId); var necessaryMIATypes = new List <Guid> { DirectoryAspect.ASPECT_ID }; var searchQuery = new MediaItemQuery(necessaryMIATypes, null); //searchQuery.Filter var searchItems = ServiceRegistration.Get <IMediaLibrary>().Search(searchQuery, true); /* * foreach (var item in browseItems) * { * * } */ outParams = new List <object>(3) { numberReturned, totalMatches, containterUpdateId }; return(null); }
static UPnPError OnSearch(DvAction action, IList<object> inParams, out IList<object> outParams, CallContext context) { // In parameters var containerId = (string)inParams[0]; var searchCriteria = inParams[1].ToString(); var filter = inParams[2].ToString(); var startingIndex = Convert.ToInt32(inParams[3]); var requestedCount = Convert.ToInt32(inParams[4]); var sortCriteria = (string)inParams[5]; // Out parameters int numberReturned = 0; int totalMatches = 0; int containterUpdateId = 0; UPnPContentDirectorySearch query = new UPnPContentDirectorySearch(); StringWriter sw = new StringWriter(); query.Construct(searchCriteria, sw); query.searchCrit(); PegNode pn = query.GetRoot(); string xml = ParserHelper.PegNodeToXml(pn, searchCriteria); Logger.Debug("MediaServer - Parsed: \"{0}\" to make \"{1}\"", searchCriteria, xml); var parentDirectoryId = containerId == "0" ? Guid.Empty : MarshallingHelper.DeserializeGuid(containerId); var necessaryMIATypes = new List<Guid> {DirectoryAspect.ASPECT_ID}; var searchQuery = new MediaItemQuery(necessaryMIATypes, null); //searchQuery.Filter var searchItems = ServiceRegistration.Get<IMediaLibrary>().Search(searchQuery, true); /* foreach (var item in browseItems) { } */ outParams = new List<object>(3) { numberReturned, totalMatches, containterUpdateId }; return null; }