Exemple #1
0
        private static void GenerateMethods(IEnumerable <MethodDom> methods, OfflineDynamicPage parentNode, string typeUrl)
        {
            var groups = methods.GroupBy(_ => _.SimpleName).OrderBy(_ => _.Key);

            foreach (var member in groups)
            {
                string url = typeUrl + "/" + member.Key;

                string html = member.Count() == 1
                                        ? GenerateHtml.Generate(member.Single())
                                        : GenerateHtml.Generate(member);

                var memberItem = new OfflineDynamicPage
                {
                    Parent         = parentNode,
                    UrlPart        = url,
                    RussianTitle   = member.Key,
                    RussianContent = html,
                };

                if (1 < member.Count())
                {
                    GenerateOverloadMethods(member, memberItem, url);
                }

                parentNode.Childs.Add(memberItem);
            }
        }
Exemple #2
0
		private static void AddAssembly(OfflineDynamicPage rootItems, AssemblyDom asmDom)
		{
			var asmItem = new OfflineDynamicPage
			{
				Parent = rootItems,
				UrlPart = asmDom.Name,
				RussianTitle = asmDom.Name,
				RussianContent = GenerateHtml.Generate(asmDom),
			};
			rootItems.Childs.Add(asmItem);
			AddNamespaces(asmItem, asmDom.Namespaces);
		}
Exemple #3
0
        private static void AddAssembly(OfflineDynamicPage rootItems, AssemblyDom asmDom)
        {
            var asmItem = new OfflineDynamicPage
            {
                Parent         = rootItems,
                UrlPart        = asmDom.Name,
                RussianTitle   = asmDom.Name,
                RussianContent = GenerateHtml.Generate(asmDom),
            };

            rootItems.Childs.Add(asmItem);
            AddNamespaces(asmItem, asmDom.Namespaces);
        }
Exemple #4
0
 private static void GenerateOverloadMethods(IEnumerable <MethodDom> methods, OfflineDynamicPage parentNode, string baseUrl)
 {
     foreach (var m in methods.OrderBy(_ => _.ShortSignature))
     {
         var item = new OfflineDynamicPage
         {
             Parent         = parentNode,
             UrlPart        = baseUrl + "/" + m.OverloadIndex.ToString(),
             RussianTitle   = m.ShortSignature,
             RussianContent = GenerateHtml.Generate(m),
         };
         parentNode.Childs.Add(item);
     }
 }
Exemple #5
0
		private static void BuildTree(OfflineDynamicPage rootDp, ItemCollection rootItems)
		{
			var tvItem = new TreeViewItem
			{
				Header = rootDp.RussianTitle,
				Tag = rootDp,
			};

			rootItems.Add(tvItem);

			foreach (var item in rootDp.Childs)
			{
				BuildTree(item, tvItem.Items);
			}
		}
Exemple #6
0
        private static void BuildTree(OfflineDynamicPage rootDp, ItemCollection rootItems)
        {
            var tvItem = new TreeViewItem
            {
                Header = rootDp.RussianTitle,
                Tag    = rootDp,
            };

            rootItems.Add(tvItem);

            foreach (var item in rootDp.Childs)
            {
                BuildTree(item, tvItem.Items);
            }
        }
Exemple #7
0
		private static void AddNamespaces(OfflineDynamicPage parentNode, IEnumerable<NamespaceDom> namespaces)
		{
			foreach (var namesp in namespaces)
			{
				var namespaceItem = new OfflineDynamicPage
				{
					Parent = parentNode,
					UrlPart = GenerateHtml.Navigation.UrlPrefix + namesp.Name.Replace('.', '/'),
					RussianTitle = namesp.Name,
					RussianContent = GenerateHtml.Generate(namesp)
				};
				AddTypes(namespaceItem, namesp.Types);
				parentNode.Childs.Add(namespaceItem);
			}
		}
Exemple #8
0
 private static void AddNamespaces(OfflineDynamicPage parentNode, IEnumerable <NamespaceDom> namespaces)
 {
     foreach (var namesp in namespaces)
     {
         var namespaceItem = new OfflineDynamicPage
         {
             Parent         = parentNode,
             UrlPart        = GenerateHtml.Navigation.UrlPrefix + namesp.Name.Replace('.', '/'),
             RussianTitle   = namesp.Name,
             RussianContent = GenerateHtml.Generate(namesp)
         };
         AddTypes(namespaceItem, namesp.Types);
         parentNode.Childs.Add(namespaceItem);
     }
 }
Exemple #9
0
		public static OfflineDynamicPage BuildSolution(SolutionDom solutionDom, bool onlyNamespaces = true)
		{
			var ret = new OfflineDynamicPage
			{
				RussianTitle = solutionDom.Name,
				RussianContent = GenerateHtml.Generate(solutionDom),
			};

			if (onlyNamespaces)
				AddNamespaces(ret, solutionDom.Namespaces);
			else
				foreach (var asm in solutionDom.Assemblies)
					AddAssembly(ret, asm);

			return ret;
		}
Exemple #10
0
        private static void AddTypes(OfflineDynamicPage parentNode, IEnumerable <TypeDom> types)
        {
            if (types == null || !types.Any())
            {
                return;
            }

            foreach (var type in types)
            {
                var typeItem = new OfflineDynamicPage
                {
                    Parent         = parentNode,
                    UrlPart        = GenerateHtml.Navigation.UrlPrefix + type.Namespace.Replace('.', '/') + "/" + type.SimpleName,
                    RussianTitle   = type.GetDisplayName(false),
                    RussianContent = GenerateHtml.Generate(type),
                };

                if (type.NestedTypes != null && type.NestedTypes.Length > 0)
                {
                    var nestedTypeItem = new OfflineDynamicPage
                    {
                        Parent         = typeItem,
                        UrlPart        = typeItem.UrlPart + "/NestedTypes",
                        RussianTitle   = GenerateHtml.NestedTypesName,
                        RussianContent = GenerateHtml.Generate(
                            new TypePartialData {
                            SectionType = MemberTypeSection.NestedTypes, Type = type
                        }
                            ),
                    };
                    AddTypes(nestedTypeItem, type.NestedTypes);
                    typeItem.Childs.Add(nestedTypeItem);
                }

                AddMembers(typeItem, type, type.Constructors, MemberTypeSection.Constructors);
                AddMembers(typeItem, type, type.Properties, MemberTypeSection.Properties);
                AddMembers(typeItem, type, type.Methods, MemberTypeSection.Methods);
                AddMembers(typeItem, type, type.ExtentionMethods, MemberTypeSection.ExtentionMethods);
                AddMembers(typeItem, type, type.Operators, MemberTypeSection.Operators);
                AddMembers(typeItem, type, type.Fields, MemberTypeSection.Fields);
                AddMembers(typeItem, type, type.Events, MemberTypeSection.Events);
                parentNode.Childs.Add(typeItem);
            }
        }
Exemple #11
0
        private void Browse_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new VistaOpenFileDialog
            {
                Filter      = "Assembly Files (*.dll)|*.dll",
                Multiselect = true,
            };

            if (dlg.ShowDialog(this) != true)
            {
                return;
            }

            Toc.Items.Clear();

            var navigation = new Navigation
            {
                UrlPrefix  = "http://stocksharp.com/doc/ref/",
                EmptyImage = "http://stocksharp.com/images/blank.gif"
            };

            GenerateHtml.CssUrl      = @"file:///C:/VisualStudio/Web/trunk/Site/css/style.css";
            GenerateHtml.Navigation  = navigation;            //ToDo: переделать
            GenerateHtml.IsHtmlAsDiv = false;
            GenerateHtml.IsRussian   = true;

            var asmFiles = dlg.FileNames;
            var docFiles = asmFiles
                           .Select(f => Path.Combine(Path.GetDirectoryName(f), Path.GetFileNameWithoutExtension(f) + ".xml"))
                           .Where(File.Exists)
                           .ToArray();

            var slnDom = SolutionDom.Build("StockSharp. Описание типов", asmFiles, docFiles, Path.GetFullPath(@"..\..\..\..\..\StockSharp\trunk\Documentation\DocSandCastle\Comments\project.xml"), null, new FindOptions
            {
                InternalClasses     = false,
                UndocumentedClasses = true,
                PrivateMembers      = false,
                UndocumentedMembers = true
            });

            _root = BuildPages.BuildSolution(slnDom);
            BuildTree(_root, Toc.Items);
        }
Exemple #12
0
		private void Browse_Click(object sender, RoutedEventArgs e)
		{
			var dlg = new VistaOpenFileDialog
			{
				Filter = "Assembly Files (*.dll)|*.dll",
				Multiselect = true,
			};

			if (dlg.ShowDialog(this) != true)
				return;

			Toc.Items.Clear();

			var navigation = new Navigation
			{
				UrlPrefix = "http://stocksharp.com/doc/ref/",
				EmptyImage = "http://stocksharp.com/images/blank.gif"
			};
			GenerateHtml.CssUrl = @"file:///C:/VisualStudio/Web/trunk/Site/css/style.css";
			GenerateHtml.Navigation = navigation; //ToDo: переделать
			GenerateHtml.IsHtmlAsDiv = false;
			GenerateHtml.IsRussian = true;

			var asmFiles = dlg.FileNames;
			var docFiles = asmFiles
				.Select(f => Path.Combine(Path.GetDirectoryName(f), Path.GetFileNameWithoutExtension(f) + ".xml"))
				.Where(File.Exists)
				.ToArray();

			var slnDom = SolutionDom.Build("StockSharp. Описание типов", asmFiles, docFiles, Path.GetFullPath(@"..\..\..\..\..\StockSharp\trunk\Documentation\DocSandCastle\Comments\project.xml"), null, new FindOptions
			{
				InternalClasses = false,
				UndocumentedClasses = true,
				PrivateMembers = false,
				UndocumentedMembers = true
			});

			_root = BuildPages.BuildSolution(slnDom);
			BuildTree(_root, Toc.Items);
		}
Exemple #13
0
		private static void AddTypes(OfflineDynamicPage parentNode, IEnumerable<TypeDom> types)
		{
			if (types == null || !types.Any())
				return;

			foreach (var type in types)
			{
				var typeItem = new OfflineDynamicPage
				{
					Parent = parentNode,
					UrlPart = GenerateHtml.Navigation.UrlPrefix + type.Namespace.Replace('.', '/') + "/" + type.SimpleName,
					RussianTitle = type.GetDisplayName(false),
					RussianContent = GenerateHtml.Generate(type),
				};

				if (type.NestedTypes != null && type.NestedTypes.Length > 0)
				{
					var nestedTypeItem = new OfflineDynamicPage
					{
						Parent = typeItem,
						UrlPart = typeItem.UrlPart + "/NestedTypes",
						RussianTitle = GenerateHtml.NestedTypesName,
						RussianContent = GenerateHtml.Generate(
							new TypePartialData { SectionType = MemberTypeSection.NestedTypes, Type = type }
							),
					};
					AddTypes(nestedTypeItem, type.NestedTypes);
					typeItem.Childs.Add(nestedTypeItem);
				}

				AddMembers(typeItem, type, type.Constructors, MemberTypeSection.Constructors);
				AddMembers(typeItem, type, type.Properties, MemberTypeSection.Properties);
				AddMembers(typeItem, type, type.Methods, MemberTypeSection.Methods);
				AddMembers(typeItem, type, type.ExtentionMethods, MemberTypeSection.ExtentionMethods);
				AddMembers(typeItem, type, type.Operators, MemberTypeSection.Operators);
				AddMembers(typeItem, type, type.Fields, MemberTypeSection.Fields);
				AddMembers(typeItem, type, type.Events, MemberTypeSection.Events);
				parentNode.Childs.Add(typeItem);
			}
		}
Exemple #14
0
        public static OfflineDynamicPage BuildSolution(SolutionDom solutionDom, bool onlyNamespaces = true)
        {
            var ret = new OfflineDynamicPage
            {
                RussianTitle   = solutionDom.Name,
                RussianContent = GenerateHtml.Generate(solutionDom),
            };

            if (onlyNamespaces)
            {
                AddNamespaces(ret, solutionDom.Namespaces);
            }
            else
            {
                foreach (var asm in solutionDom.Assemblies)
                {
                    AddAssembly(ret, asm);
                }
            }

            return(ret);
        }
Exemple #15
0
        private static void AddMembers(OfflineDynamicPage parentNode, TypeDom type, MemberDom[] members, MemberTypeSection section)
        {
            if (members == null || members.Length == 0)
            {
                return;
            }

            var sectionItem = new OfflineDynamicPage
            {
                Parent         = parentNode,
                UrlPart        = parentNode.UrlPart + "/" + section.ToString(),
                RussianTitle   = GenerateHtml.GetSectionName(section),
                RussianContent = GenerateHtml.Generate(new TypePartialData {
                    SectionType = section, Type = type
                }),
            };

            if (section == MemberTypeSection.Methods || section == MemberTypeSection.ExtentionMethods)
            {
                GenerateMethods((MethodDom[])members, sectionItem, parentNode.UrlPart);
            }
            else
            {
                foreach (var member in members)
                {
                    //ToDo: Группировка переопределенных методов.
                    var memberItem = new OfflineDynamicPage
                    {
                        Parent         = sectionItem,
                        UrlPart        = parentNode.UrlPart + "/" + member.SimpleName,
                        RussianTitle   = member.ShortSignature,
                        RussianContent = GenerateHtml.Generate(member),
                    };
                    sectionItem.Childs.Add(memberItem);
                }
            }

            parentNode.Childs.Add(sectionItem);
        }
Exemple #16
0
		private static void AddMembers(OfflineDynamicPage parentNode, TypeDom type, MemberDom[] members, MemberTypeSection section)
		{
			if (members == null || members.Length == 0)
				return;

			var sectionItem = new OfflineDynamicPage
			{
				Parent = parentNode,
				UrlPart = parentNode.UrlPart + "/" + section.ToString(),
				RussianTitle = GenerateHtml.GetSectionName(section),
				RussianContent = GenerateHtml.Generate(new TypePartialData { SectionType = section, Type = type }),
			};

			if (section == MemberTypeSection.Methods || section == MemberTypeSection.ExtentionMethods)
				GenerateMethods((MethodDom[])members, sectionItem, parentNode.UrlPart);
			else
			{
				foreach (var member in members)
				{
					//ToDo: Группировка переопределенных методов.
					var memberItem = new OfflineDynamicPage
					{
						Parent = sectionItem,
						UrlPart = parentNode.UrlPart + "/" + member.SimpleName,
						RussianTitle = member.ShortSignature,
						RussianContent = GenerateHtml.Generate(member),
					};
					sectionItem.Childs.Add(memberItem);
				}
			}

			parentNode.Childs.Add(sectionItem);
		}
Exemple #17
0
		static string FindPage(OfflineDynamicPage p, string url)
		{
			return p.UrlPart == url
				? p.RussianContent
				: p.Childs.Select(ch => FindPage(ch, url)).FirstOrDefault(res => res != null);
		}
Exemple #18
0
		private static void GenerateOverloadMethods(IEnumerable<MethodDom> methods, OfflineDynamicPage parentNode, string baseUrl)
		{
			foreach (var m in methods.OrderBy(_ => _.ShortSignature))
			{
				var item = new OfflineDynamicPage
				{
					Parent = parentNode,
					UrlPart = baseUrl + "/" + m.OverloadIndex.ToString(),
					RussianTitle = m.ShortSignature,
					RussianContent = GenerateHtml.Generate(m),
				};
				parentNode.Childs.Add(item);
			}
		}
Exemple #19
0
		private static void GenerateMethods(IEnumerable<MethodDom> methods, OfflineDynamicPage parentNode, string typeUrl)
		{
			var groups = methods.GroupBy(_ => _.SimpleName).OrderBy(_ => _.Key);

			foreach (var member in groups)
			{
				string url = typeUrl + "/" + member.Key;

				string html = member.Count() == 1
					? GenerateHtml.Generate(member.Single())
					: GenerateHtml.Generate(member);

				var memberItem = new OfflineDynamicPage
				{
					Parent = parentNode,
					UrlPart = url,
					RussianTitle = member.Key,
					RussianContent = html,
				};

				if (1 < member.Count())
					GenerateOverloadMethods(member, memberItem, url);

				parentNode.Childs.Add(memberItem);
			}
		}
Exemple #20
0
 static string FindPage(OfflineDynamicPage p, string url)
 {
     return(p.UrlPart == url
                         ? p.RussianContent
                         : p.Childs.Select(ch => FindPage(ch, url)).FirstOrDefault(res => res != null));
 }