Ejemplo n.º 1
0
 private static bool NameSpaceExists(INameSpaceDeclarations nameSpaces, string nameSpace, ref INameSpaceDeclaration foundSpace)
 {
     foreach (INameSpaceDeclaration insd in nameSpaces.Values)
     {
         bool childrenContain = false;
         if (insd.FullName == nameSpace)
         {
             foundSpace = insd;
             return(true);
         }
         childrenContain = NameSpaceExists(insd.ChildSpaces, nameSpace, ref foundSpace);
         if (childrenContain)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
        public CodeNamespace[] GenerateGroupCodeDom(ICodeDOMTranslationOptions options)
        {
            List <CodeNamespace> result        = new List <CodeNamespace>();
            CodeNamespace        cnsThisResult = this.GenerateCodeDom(options);

            if (cnsThisResult != null)
            {
                result.Add(cnsThisResult);
            }
            foreach (INameSpaceDeclaration ind in this.ChildSpaces.Values)
            {
                CodeNamespace[] childSpaces;
                if (!options.AllowPartials)
                {
                    //Auto-flattens hierarchhy.
                    childSpaces = ind.GenerateGroupCodeDom(options);
                }
                else
                {
                    //There's extra work to do.
                    List <CodeNamespace> childSpacesList = new List <CodeNamespace>();
                    if (ind.ParentTarget == this)
                    {
                        childSpacesList.AddRange(ind.GenerateGroupCodeDom(options));
                    }
                    foreach (INameSpaceDeclaration indPartial in ind.Partials)
                    {
                        if (indPartial.ParentTarget == this)
                        {
                            childSpacesList.AddRange(indPartial.GenerateGroupCodeDom(options));
                        }
                    }
                    childSpaces = childSpacesList.ToArray();
                }
                for (int i = 0; i < childSpaces.Length; i++)
                {
                    if (childSpaces[i] != null)
                    {
                        result.Add(childSpaces[i]);
                    }
                }
            }
            return(result.ToArray());
        }
Ejemplo n.º 3
0
 public override void TranslateNameSpaces(INameSpaceParent parent, INameSpaceDeclarations nameSpaces)
 {
     foreach (INameSpaceDeclaration insd in nameSpaces.Values)
     {
         if (insd.ParentTarget == parent || ((!(options.AllowPartials)) && (insd.ParentTarget.GetRootDeclaration() == parent.GetRootDeclaration())))
         {
             TranslateNameSpace(insd);
         }
         if (options.AllowPartials)
         {
             foreach (INameSpaceDeclaration insdChild in insd.Partials)
             {
                 if (insdChild.ParentTarget == parent)
                 {
                     TranslateNameSpace(insdChild);
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
 public abstract void TranslateNameSpaces(INameSpaceParent parent, INameSpaceDeclarations nameSpaces);
Ejemplo n.º 5
0
 private void GatherTypes(List <IDeclaredType> target, List <IIntermediateProject> projectPartials, INameSpaceDeclarations nameSpaces)
 {
     foreach (INameSpaceDeclaration insd in nameSpaces.Values)
     {
         GatherTypes(target, projectPartials, (ITypeParent)insd);
         GatherTypes(target, projectPartials, insd.ChildSpaces);
     }
 }