예제 #1
0
        public static List <Type> GetAllowedGroupTypes(TrackGroup trackGroup)
        {
            // Get all the allowed Genres for this track group
            TimelineGroupGenre[] genres = new TimelineGroupGenre[0];

            TrackGroupAttribute[] tga = ReflectionHelper.GetCustomAttributes <TrackGroupAttribute>(trackGroup.GetType(), true);
            for (int i = 0; i < tga.Length; i++)
            {
                if (tga[i] != null)
                {
                    genres = tga[i].AllowedGroupGenres;
                    break;
                }
            }

            Type[]      subTypes          = DirectorRuntimeHelper.GetAllSubTypes(typeof(TrackGroup));
            List <Type> allowedTrackTypes = new List <Type>();

            for (int i = 0; i < subTypes.Length; i++)
            {
                allowedTrackTypes.Add(subTypes[i]);
            }

            return(allowedTrackTypes);
        }
예제 #2
0
        /// <summary>
        /// Returns a list of Track types that are associated with the given Track Group.
        /// </summary>
        /// <param name="trackGroup">The track group to be inspected</param>
        /// <returns>A list of track types that meet the genre criteria of the given track group.</returns>
        public static List <Type> GetAllowedTrackTypes(TrackGroup trackGroup)
        {
            // Get all the allowed Genres for this track group
            TimelineTrackGenre[] genres = new TimelineTrackGenre[0];

            TrackGroupAttribute[] tga = ReflectionHelper.GetCustomAttributes <TrackGroupAttribute>(trackGroup.GetType(), true);
            for (int i = 0; i < tga.Length; i++)
            {
                if (tga[i] != null)
                {
                    genres = tga[i].AllowedTrackGenres;
                    break;
                }
            }

            Type[]      subTypes          = DirectorRuntimeHelper.GetAllSubTypes(typeof(TimelineTrack));
            List <Type> allowedTrackTypes = new List <Type>();

            for (int i = 0; i < subTypes.Length; i++)
            {
                TimelineTrackAttribute[] customAttributes = ReflectionHelper.GetCustomAttributes <TimelineTrackAttribute>(subTypes[i], true);
                for (int j = 0; j < customAttributes.Length; j++)
                {
                    if (customAttributes[j] != null)
                    {
                        for (int k = 0; k < customAttributes[j].TrackGenres.Length; k++)
                        {
                            TimelineTrackGenre genre = customAttributes[j].TrackGenres[k];
                            for (int l = 0; l < genres.Length; l++)
                            {
                                if (genre == genres[l])
                                {
                                    allowedTrackTypes.Add(subTypes[i]);
                                    break;
                                }
                            }
                        }
                        break;
                    }
                }
            }

            return(allowedTrackTypes);
        }