Ejemplo n.º 1
0
        public string GenerateDocumentation()
        {
            var assembly = Assembly.GetAssembly(typeof(DocumentationGenerator));
            var prefix   = assembly.GetName().Name.EndsWith("Documentation") ? "templates" : "Documentation.templates";
            var locator  = new AssemblyLocatorFactory(assembly, prefix).CloneForTagLib(_lib);
            var bundle   = new ResourceBundle("Documentation", null, locator.GetNewLocator());
            var template = locator.Handle(_fragment?"fragment.html":"index.htm", true);

            return(template.Evaluate(new TagModel(new DocumentModel(_subject, _all, bundle, _specials))));
        }
Ejemplo n.º 2
0
        public DocumentModel BuildModel()
        {
            var assembly = Assembly.GetAssembly(typeof(DocumentationGenerator));
            var prefix   = assembly.GetName().Name.EndsWith("Documentation") ? "templates" : "Documentation.templates";
            var locator  = new AssemblyLocatorFactory(assembly, prefix).CloneForTagLib(_lib);
            var bundle   = new ResourceBundle("Documentation", null, locator.GetNewLocator());

            return(new DocumentModel(_subject, _all, bundle, _specials));

//            var json = JsonConvert.SerializeObject(dm, new TypeJsonConverter(), new StringEnumConverter());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates an instance of an IDependencyScanner
        /// </summary>

        /// <param name="assemblyLocator">The assembly locator.  This parameter is optional.  </param>
        /// <param name="assemblyTypeService">The assembly type service.  This parameter is optional</param>
        /// <returns></returns>
        public static IDependencyScanner Create(
            Func <IAssemblyLocator> assemblyLocator         = null,
            Func <IAssemblyTypeService> assemblyTypeService = null)
        {
            assemblyLocator     = assemblyLocator ?? (() => AssemblyLocatorFactory.Resolve());
            assemblyTypeService = assemblyTypeService ?? (() => AssemblyTypeFactory.Resolve());

            var defaultScanner = new DependencyScanner(assemblyLocator(),
                                                       assemblyTypeService());

            return(defaultScanner);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Registers defaults implementations of all required services.
        /// </summary>
        /// <param name="services">The services.</param>
        private static IServiceCollection RegisterDefaults(IServiceCollection services)
        {
            var buildProvider = services.BuildServiceProvider();

            if (buildProvider.GetService <IDependencyScanner>() == null)
            {
                services.AddSingleton((t) => DependencyScannerFactory.Create());
            }
            if (buildProvider.GetService <IAssemblyLocator>() == null)
            {
                services.AddSingleton((t) => AssemblyLocatorFactory.Resolve());
            }
            if (buildProvider.GetService <IAssemblyTypeService>() == null)
            {
                services.AddSingleton((t) => AssemblyTypeFactory.Resolve());
            }

            return(services);
        }