Example #1
0
        public void CreateDocumentation(IDocumentationOptions documentationOptions)
        {
            var assembly = Assembly.LoadFile(documentationOptions.AssemblyPath);

            var assemblyDocumentation = XDocument.Load(documentationOptions.AssemblyDocumationPath);

            var typesInAssembly = assembly.GetTypes().ToList();

            m_documentationProcessor.CreateDocumentation(assemblyDocumentation, documentationOptions.OutputDirectory, typesInAssembly);
        }
Example #2
0
        public bool TryCreateDocumentation(IDocumentationOptions documentationOptions)
        {
            try
            {
                var assembly = Assembly.LoadFile(documentationOptions.AssemblyPath);

                var directory = Path.GetDirectoryName(documentationOptions.AssemblyPath);

                ResolveEventHandler resolveEventHandler = (sender, args) =>
                {
                    var assemblyNameParts = args.Name.Split(',');

                    var assemblyName = string.Concat(assemblyNameParts[0], ".dll");

                    var assemblyNameFullpath = Path.Combine(directory, assemblyName);

                    if (File.Exists(assemblyNameFullpath))
                    {
                        return(Assembly.LoadFile(assemblyNameFullpath));
                    }

                    return(null);
                };

                AppDomain.CurrentDomain.AssemblyResolve += resolveEventHandler;

                try
                {
                    XDocument assemblyDocumentation = null;

                    if (File.Exists(documentationOptions.AssemblyDocumationPath))
                    {
                        assemblyDocumentation = XDocument.Load(documentationOptions.AssemblyDocumationPath);
                    }

                    var typesInAssembly = assembly.GetTypes().ToList();

                    m_documentationProcessor.CreateDocumentation(documentationOptions.OutputDirectory,
                                                                 typesInAssembly, assemblyDocumentation);
                }
                finally
                {
                    AppDomain.CurrentDomain.AssemblyResolve -= resolveEventHandler;
                }

                return(true);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());

                return(false);
            }
        }
Example #3
0
        public IDocumentationProcessor Create(IDocumentationOptions documentationOptions)
        {
            var assembly = Assembly.LoadFile(documentationOptions.AssemblyPath);

            var assemblyDocumentation = XDocument.Load(documentationOptions.AssemblyDocumationPath);

            var typesInAssembly = assembly.GetTypes();

            var typesInNamespaces = typesInAssembly
                                    .Where(type => type.GetCustomAttribute <ServiceContractAttribute>() != null)
                                    .ToList();

            return(new ServiceDocumentationProcessor(assemblyDocumentation, typesInNamespaces, documentationOptions.OutputDirectory, new ServiceTypeParser(), new ServiceDocumentationWriter()));
        }