Example #1
0
        /// <summary>
        /// Gets the output directory for a type dependency
        /// </summary>
        /// <param name="typeDependencyInfo"></param>
        /// <param name="exportedTypeOutputDir"></param>
        /// <returns></returns>
        private string GetTypeDependencyOutputDir(TypeDependencyInfo typeDependencyInfo, string exportedTypeOutputDir)
        {
            var classAttribute     = typeDependencyInfo.Type.GetTypeInfo().GetCustomAttribute <ExportTsClassAttribute>();
            var interfaceAttribute = typeDependencyInfo.Type.GetTypeInfo().GetCustomAttribute <ExportTsInterfaceAttribute>();
            var enumAttribute      = typeDependencyInfo.Type.GetTypeInfo().GetCustomAttribute <ExportTsEnumAttribute>();

            if (classAttribute == null && enumAttribute == null && interfaceAttribute == null)
            {
                TsDefaultTypeOutputAttribute defaultTypeOutputAttribute = typeDependencyInfo.MemberAttributes
                                                                          ?.SingleOrDefault(a => a.GetType() == typeof(TsDefaultTypeOutputAttribute))
                                                                          as TsDefaultTypeOutputAttribute;

                return(defaultTypeOutputAttribute?.OutputDir ?? exportedTypeOutputDir);
            }

            return(classAttribute?.OutputDir
                   ?? interfaceAttribute?.OutputDir
                   ?? enumAttribute?.OutputDir);
        }
Example #2
0
        /// <summary>
        /// Gets the output directory for a type dependency
        /// </summary>
        /// <param name="typeDependencyInfo"></param>
        /// <param name="parentTypeOutputDir"></param>
        /// <returns></returns>
        private string GetTypeDependencyOutputDir(TypeDependencyInfo typeDependencyInfo, string parentTypeOutputDir)
        {
            var classAttribute     = _metadataReaderFactory.GetInstance().GetAttribute <ExportTsClassAttribute>(typeDependencyInfo.Type);
            var interfaceAttribute = _metadataReaderFactory.GetInstance().GetAttribute <ExportTsInterfaceAttribute>(typeDependencyInfo.Type);
            var enumAttribute      = _metadataReaderFactory.GetInstance().GetAttribute <ExportTsEnumAttribute>(typeDependencyInfo.Type);

            if (classAttribute == null && enumAttribute == null && interfaceAttribute == null)
            {
                TsDefaultTypeOutputAttribute defaultTypeOutputAttribute = typeDependencyInfo.MemberAttributes
                                                                          ?.SingleOrDefault(a => a.GetType() == typeof(TsDefaultTypeOutputAttribute))
                                                                          as TsDefaultTypeOutputAttribute;

                return(defaultTypeOutputAttribute?.OutputDir ?? parentTypeOutputDir);
            }

            return(classAttribute?.OutputDir
                   ?? interfaceAttribute?.OutputDir
                   ?? enumAttribute?.OutputDir);
        }