Example #1
0
        public IList <TopLevelType> Parse()
        {
            var types = _assemblyReader.GetExportedTypes();

            var codeMembers = types
                              .Select(type =>
            {
                TopLevelTypeEnum elementTypeEnum = MapTypeToTopLevelType(type);

                TopLevelType element = elementTypeEnum switch
                {
                    TopLevelTypeEnum.Class => ParseClass(type),
                    TopLevelTypeEnum.Interface => ParseInterface(type),
                    TopLevelTypeEnum.Enum => ParseEnum(type),
                    TopLevelTypeEnum.Structure => ParseStructure(type),
                    TopLevelTypeEnum.Event => throw new NotImplementedException(),
                    TopLevelTypeEnum.Delegate => throw new NotImplementedException(),
                    _ => throw new ArgumentOutOfRangeException(
                        $"Got code type element that cannot be exported on assembly level, '{elementTypeEnum}'")
                };

                return(element);
            })
                              .ToList();

            return(codeMembers);
        }
Example #2
0
        public bool Matches(MediaType t)
        {
            if (t == null)
            {
                return(false);
            }

            return((IsTopLevelWildcard || t.IsTopLevelWildcard || TopLevelType.Equals(t.TopLevelType, StringComparison.OrdinalIgnoreCase)) &&
                   (IsSubTypeWildcard || t.IsSubTypeWildcard || SubType.Equals(t.SubType, StringComparison.OrdinalIgnoreCase)));
        }