Ejemplo n.º 1
0
        /// <summary>
        /// Find in ClientNamespace if ns is not defined, or in ClassNamespaces and ClientNamespace.
        /// </summary>
        /// <param name="typeNameNoNs"></param>
        /// <param name="ns"></param>
        /// <returns></returns>
        public CodeTypeDeclaration FindTypeDeclarationInNamespaces(string typeNameNoNs, string ns)
        {
            if (String.IsNullOrEmpty(ns))
            {
                var cd = ClientNamespace.FindTypeDeclaration(typeNameNoNs);
                if (cd != null)
                {
                    return(cd);
                }

                return(null);
            }

            foreach (var cs in ClassNamespaces)
            {
                if (cs.Name == ns)
                {
                    var ctd = cs.FindTypeDeclaration(typeNameNoNs);
                    if (ctd != null)
                    {
                        return(ctd);
                    }
                }
            }

            var cg = ClientNamespace.FindTypeDeclaration(typeNameNoNs);

            if (cg != null)
            {
                return(cg);
            }

            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Find existing CodeTypeDeclaration in clientNamespace and classNamespaces.
        /// </summary>
        /// <param name="enumMemberNames"></param>
        /// <returns></returns>
        protected CodeTypeDeclaration FindEnumDeclaration(string[] enumMemberNames)
        {
            var t = ClientNamespace.FindEnumDeclaration(enumMemberNames);

            if (t != null)
            {
                return(t);
            }

            foreach (var cs in ClassNamespaces)
            {
                var cd = cs.FindEnumDeclaration(enumMemberNames);
                if (cd != null)
                {
                    return(cd);
                }
            }

            return(null);
        }