Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

#9 kind of resolves issue 9. Room for improvement #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ bin
obj
_ReSharper*
artifacts
TestResult.xml
TestResult.xml
src/.vs/
14 changes: 13 additions & 1 deletion src/Docu.Console/Documentation/Generators/BaseGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,19 @@ protected void ParseReturns(IDocumentationMember member, Method doc)
protected Namespace FindNamespace(IDocumentationMember association, List<Namespace> namespaces)
{
var identifier = Identifier.FromNamespace(association.TargetType.Namespace);
return namespaces.Find(x => x.IsIdentifiedBy(identifier));
Namespace ns= namespaces.Find(x => x.IsIdentifiedBy(identifier));
if (ns == null)
{
for (int i = 0; i < namespaces.Count; i++)
{
if (namespaces[i].Name == "NoNamespace")
{
ns = namespaces[i];
break;
}
}
}
return ns;
}

protected DeclaredType FindType(Namespace ns, IDocumentationMember association)
Expand Down
15 changes: 11 additions & 4 deletions src/Docu.Console/Documentation/Generators/NamespaceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ public NamespaceGenerator(IDictionary<Identifier, IReferencable> matchedAssociat

public void Add(List<Namespace> namespaces, IDocumentationMember association)
{
string namespace2 = "NoNamespace";
if (association.TargetType.Namespace == null)
throw new NullReferenceException(
string.Format("There was no namespace found for {0}",
association.TargetType.AssemblyQualifiedName));
{
//TODO this may be better as a build warning
System.Console.WriteLine(string.Format("There was no namespace found for {0}",
association.TargetType.AssemblyQualifiedName));
}
else
{
namespace2 = association.TargetType.Namespace;
}

var ns = Identifier.FromNamespace(association.TargetType.Namespace);
var ns = Identifier.FromNamespace(namespace2);

if (!namespaces.Exists(x => x.IsIdentifiedBy(ns)))
{
Expand Down