コード例 #1
0
        static bool IsValidType <T> (IList <ClassReference> classes, bool allowSuperClasses) where T : Object
        {
            if (classes.Count == 0)
            {
                return(true);
            }
            var type = ClassManager.GetClassFromType <T> ();

            foreach (var @class in classes)
            {
                var class_name = @class.Class.FullClassName;
                var compare    = type.CompareTo(class_name);
                if (compare == 0)
                {
                    return(true);
                }
                else if (allowSuperClasses && class_name.StartsWith(type))
                {
                    return(true);
                }
                else if (compare == 1)
                {
                    return(false);
                }
                else if (type.StartsWith(class_name) && @class.IncludeDerived)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #2
0
        public Results <T> SearchForType <T> (ResultsSettings settings) where T : Object
        {
            var class_name = ClassManager.GetClassFromType <T> ();

            return(Search <T> (string.Format(@"upnp:class derivedfrom ""{0}""", class_name), settings));
        }