Exemple #1
0
        void FillNamespaces()
        {
            var nsDict = new Dictionary <string, List <TypeDom> >();

            foreach (var type in AllTypes.Where(_ => _.Type.DeclaringType == null))
            {
                List <TypeDom> nsTypes;
                if (nsDict.TryGetValue(type.Namespace, out nsTypes))
                {
                    nsTypes.Add(type);
                }
                else
                {
                    nsTypes = new List <TypeDom> {
                        type
                    };
                    nsDict.Add(type.Namespace, nsTypes);
                }
            }
            Namespaces = nsDict
                         .Select(_ =>
            {
                var ns = new NamespaceDom(_.Key);
                ns.Types.AddMany(_.Value);
                return(ns);
            })
                         .ToArray();
        }
		static string Generate(NamespaceDom ns)
		{
			XElement body;
			var doc = GetDoc(out body);
			body.Add(
				x("h1", ns.Name + Names[Strings.SuffixDelimeter] + Names[Strings.Namespace])
				);
			if (ns.DocInfo != null)
			{
				body.Add(x("p", XMLUtils.GetInnerXml(ns.DocInfo,Navigation)));
			}
			for (var kind = TypeDom.TypeKindEnum.Class; kind <= TypeDom.TypeKindEnum.Enum; kind++)
			{
				body.Add(BuildNsSection(
					kind, 
					ns.Types.Where(_=>_.TypeKind==kind).ToArray()
				));
			}
			return doc.ToString();
		}
Exemple #3
0
		void FillNamespaces()
		{
			var nsDict = new Dictionary<string, List<TypeDom>>();
			foreach (var type in AllTypes.Where(_ => _.Type.DeclaringType == null))
			{
				List<TypeDom> nsTypes;
				if (nsDict.TryGetValue(type.Namespace, out nsTypes))
				{
					nsTypes.Add(type);
				}
				else
				{
					nsTypes = new List<TypeDom>{type};
					nsDict.Add(type.Namespace,nsTypes);
				}
			}
			Namespaces = nsDict
				.Select(_ =>
				{
					var ns = new NamespaceDom(_.Key);
					ns.Types.AddMany(_.Value);
					return ns;
				})
				.ToArray();
		}