示例#1
0
 private void AddNodesFromTypes(XmlSchemaTypeGenerator generator, TreeNode node, string itemPath)
 {
     foreach (System.CodeDom.CodeNamespace ns in generator.GenerateCodeCompileUnit(itemPath).Namespaces)
     {
         foreach (System.CodeDom.CodeTypeDeclaration codeType in ns.Types)
         {
             if ((codeType.IsClass || codeType.IsEnum || codeType.IsStruct) &&
                 !node.Nodes.ContainsKey(codeType.Name))
             {
                 XsdElementNode elementNode = new XsdElementNode(codeType.Name, codeType);
                 node.Nodes.Add(elementNode);
             }
         }
     }
     // add empty node if no elem added
     if (node.Nodes.Count == 0)
     {
         node.Nodes.Add(new XsdEmptyNode());
     }
 }
		private void AddNodesFromTypes(XmlSchemaTypeGenerator generator, TreeNode node, string itemPath)
		{
			foreach (System.CodeDom.CodeNamespace ns in generator.GenerateCodeCompileUnit(itemPath).Namespaces)
			{
				foreach (System.CodeDom.CodeTypeDeclaration codeType in ns.Types)
				{
					if ((codeType.IsClass || codeType.IsEnum || codeType.IsStruct) &&
						!node.Nodes.ContainsKey(codeType.Name))
					{
						XsdElementNode elementNode = new XsdElementNode(codeType.Name, codeType);
						node.Nodes.Add(elementNode);
					}
				}
			}
			// add empty node if no elem added
			if (node.Nodes.Count == 0)
			{
				node.Nodes.Add(new XsdEmptyNode());
			}
		}