Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            MemberRegistry    model = new MemberRegistry();
            ConsoleView       view  = new ConsoleView();
            ConsoleController c     = new ConsoleController(model, view);

            c.start();
        }
Ejemplo n.º 2
0
 public ConsoleController(MemberRegistry memberRegistry, ConsoleView consoleView)
 {
     _memberRegistry = memberRegistry;
     _consoleView    = consoleView;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Loads from an assembly source definition all types to document.
        /// </summary>
        /// <param name="assemblySource">The assembly source definition.</param>
        /// <param name="memberRegistry">The member registry to populate with types.</param>
        /// <returns>
        /// An assembly documentator that contains all documented types, methods.
        /// </returns>
        public void LoadFrom(NAssemblySource assemblySource, MemberRegistry memberRegistry)
        {
            CurrentMergeGroup = assemblySource.MergeGroup;

            _source   = assemblySource;
            _registry = memberRegistry;

            var assemblyDefinition = (AssemblyDefinition)assemblySource.Assembly;

            var assemblyName = assemblyDefinition.Name.Name;
            var assemblyId   = "A:" + assemblyName;

            var assembly = (NAssembly)_registry.FindById(assemblyId);

            // If new assembly
            if (assembly == null)
            {
                assembly = new NAssembly {
                    Name = assemblyName
                };
                assembly.FullName  = assembly.Name;
                assembly.Id        = assemblyId;
                assembly.PageId    = PageIdFunction(assembly);
                assembly.PageTitle = assembly.Name + " " + assembly.Category;
                assembly.Version   = assemblyDefinition.Name.Version.ToString();
                assembly.FileName  = Path.GetFileName(Utility.GetProperFilePathCapitalization(assemblySource.Filename));

                // Apply documentation from AssemblyDoc special class
                assembly.DocNode = _source.Document.FindMemberDoc("T:" + assembly.Name + "." + AssemblyDocClass);

                _registry.Register(assembly);
            }
            assembly.SetApiGroup(CurrentMergeGroup, true);
            CurrentAssembly = assembly;

            Logger.Message("Processing assembly [{0}] [{1}]", assembly.FullName, CurrentMergeGroup);

            // Process namespaces
            // Namespaces are created only if a type is actually public
            foreach (var module in assemblyDefinition.Modules)
            {
                foreach (var type in module.Types)
                {
                    // Todo add configurable filter
                    if (!type.IsPublic)
                    {
                        continue;
                    }

                    // Skip empty namespaces and special <Module>
                    if (string.IsNullOrEmpty(type.Namespace) || type.Namespace.StartsWith("<"))
                    {
                        continue;
                    }

                    // Create naemespace
                    var parentNamespace = AddNamespace(assembly, type.Namespace);
                    parentNamespace.SetApiGroup(CurrentMergeGroup, true);

                    AddType(parentNamespace, type);
                }
            }

            //// Remove empty namespaces
            //foreach (var removeNamespace in namespaces.Values)
            //{
            //    if (removeNamespace.Types.Count == 0)
            //        assembly.Namespaces.Remove(removeNamespace);
            //}

            // Sort namespace in alphabetical order

            //@assembly.Namespaces.Sort((left, right) => left.PageId.CompareTo(right.PageId));

            //foreach (var namespaceName in @assembly.Namespaces)
            //    namespaces[namespaceName].Types.Sort((left, right) => left.PageId.CompareTo(right.PageId));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModelProcessor"/> class.
 /// </summary>
 public ModelProcessor()
 {
     Namespaces = new List <NNamespace>();
     Registry   = new MemberRegistry();
 }
Ejemplo n.º 5
0
 public ConsoleController(MenusView mView, MemberView view)
 {
     this._view     = view;
     this._menuView = mView;
     this._registry = new MemberRegistry();
 }