当前位置: 首页>>代码示例>>C#>>正文


C# INode.GetType方法代码示例

本文整理汇总了C#中INode.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# INode.GetType方法的具体用法?C# INode.GetType怎么用?C# INode.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INode的用法示例。


在下文中一共展示了INode.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FetchNode

        private void FetchNode(System.Windows.Forms.TreeNode treeNode, INode gameNode)
        {
            string name = (gameNode.Name == "Undefined") ? "" : " : " + gameNode.Name;

            if ((gameNode is GameEntity))
            {
                name += " " + (gameNode as GameEntity).Position;
            }

            if (gameNode is Sprite)
            {
                name += (gameNode as Sprite).Origin;
            }

            System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode(gameNode.GetType().Name  + name);

            if ((gameNode is Entity && (gameNode as Entity).IsLoaded))
            {

                PropertyInfo[] properties = gameNode.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);

                System.Windows.Forms.TreeNode propertiesNode = new System.Windows.Forms.TreeNode("Properties");

                foreach (PropertyInfo p in properties)
                {
                    object value = null;
                    try
                    {
                        value = p.GetValue(gameNode, null);
                    }
                    catch (Exception e)
                    {
                    }

                    if (value == null) value = "Error";

                    propertiesNode.Nodes.Add(p.Name + ": " + value);
                }

                //node.Nodes.Add(propertiesNode);

            }

            if (gameNode is MilkShakeFramework.Core.TreeNode)
            {
                MilkShakeFramework.Core.TreeNode gameTreeNode = gameNode as MilkShakeFramework.Core.TreeNode;
                foreach (INode childNode in gameTreeNode.Nodes)
                {
                    FetchNode(node, childNode);
                }

            }

            treeNode.Nodes.Add(node);
        }
开发者ID:lucas-jones,项目名称:MilkShake-old,代码行数:55,代码来源:SceneView.cs

示例2: Visit

 public virtual object Visit(INode node, object data)
 {
     Console.WriteLine("Warning, INode visited!");
     Console.WriteLine("Type is " + node.GetType());
     Console.WriteLine("Visitor is " + this.GetType());
     return node.AcceptChildren(this, data);
 }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:7,代码来源:AbstractASTVisitor.cs

示例3: Normalise

	static INode Normalise(INode node)
	{
		Type nodeType = node.GetType();
		if(nodeType.IsAssignableFrom(typeof(Not))) {
			Not notNode = node as Not;
			Type childType = notNode.child.GetType();
			//Double Negation
			if(childType.IsAssignableFrom(typeof(Not))) {
				return Normalise((notNode.child as Not).child);
			//Not and -> or not
			} else if(childType.IsAssignableFrom(typeof(And))) {
				And childAnd = notNode.child as And;
				return Normalise(new Or(new Not(childAnd.lChild), new Not(childAnd.rChild)));
			//Not or -> and not
			} else if(childType.IsAssignableFrom(typeof(Or))) {
				Or childOr = notNode.child as Or;
				return Normalise(new And(new Not(childOr.lChild), new Not(childOr.rChild)));
			//Not atom with property -> atom with not property
			} else {
				Atom childAtom = notNode.child as Atom;
				return childAtom.Negate();
			}
		} else if(nodeType.IsAssignableFrom(typeof(And))) {
			And andNode = node as And;
			return new And(Normalise(andNode.lChild), Normalise(andNode.rChild));
		} else if(nodeType.IsAssignableFrom(typeof(Or))) {
			Or orNode = node as Or;
			return new Or(Normalise(orNode.lChild), Normalise(orNode.rChild));
		} else {
			return node;
		}
	}
开发者ID:EternalGB,项目名称:Enlightenment,代码行数:32,代码来源:Rule.cs

示例4: AddNode

        public override INode AddNode(INode currentParent, IConverter converter)
        {
            //If the current parent is neither the root nor a group
            if(!(currentParent is IMotherNode))
                throw new ArgumentException("Trying to insert an 'AS' node, but the current node's type '" + currentParent.GetType() + "' is illegal. " + CheckString);

            GroupNode group;

            //If the current parent is the root
            if (currentParent is RootNode)
            {
                group = (currentParent as IMotherNode).Children.Last() as GroupNode;
                if (group == null)
                    throw new ArgumentException("Trying to insert an 'AS' node, but no Group found at root nor in its children. " + CheckString);
            }
            // The current parent is the group
            else if (currentParent is GroupNode)
                group = currentParent as GroupNode;
            // The group is the last child of the current parent
            else if ((currentParent as IMotherNode).Children.Last() is GroupNode)
                group = (currentParent as IMotherNode).Children.Last() as GroupNode;
            else
                throw new ArgumentException("Trying to insert an 'AS' node, but the current node is neither a group nor contains a group as children. " + CheckString);

            if (converter != null && converter.Function != null && converter.Function.Arguments != null && converter.Function.Arguments.Any())
                group.Name = converter.Function.Arguments[0].ToString();

            return currentParent;
        }
开发者ID:Timothep,项目名称:SimpleExpressions,代码行数:29,代码来源:AsBuilder.cs

示例5: Format

        public XElement Format(INode contentNode, IEnumerable<INode> features)
        {
            var featureItemNode = contentNode as FeatureNode;
            if (featureItemNode != null)
            {
                var formattedContent = this.htmlFeatureFormatter.Format(featureItemNode.Feature);
                this.htmlImageRelocator.Relocate(contentNode, formattedContent);
                return formattedContent;
            }

            var indexItemNode = contentNode as FolderNode;
            if (indexItemNode != null)
            {
                return this.htmlIndexFormatter.Format(indexItemNode, features);
            }

            var markdownItemNode = contentNode as MarkdownNode;
            if (markdownItemNode != null)
            {
                this.htmlImageRelocator.Relocate(contentNode, markdownItemNode.MarkdownContent);
                return markdownItemNode.MarkdownContent;
            }

            throw new InvalidOperationException("Cannot format a FeatureNode with a Type of " + contentNode.GetType() +
                                                " as content");
        }
开发者ID:eduaquiles,项目名称:pickles,代码行数:26,代码来源:HtmlContentFormatter.cs

示例6: IsEqualTo

 public override bool IsEqualTo(INode obj)
 {
     if (ReferenceEquals(null, obj)) return false;
     if (ReferenceEquals(this, obj)) return true;
     if (obj.GetType() != this.GetType()) return false;
     return Equals((SelectionSet) obj);
 }
开发者ID:graphql-dotnet,项目名称:graphql-dotnet,代码行数:7,代码来源:SelectionSet.cs

示例7: IsEqualTo

 public override bool IsEqualTo(INode node)
 {
     if (ReferenceEquals(null, node)) return false;
     if (ReferenceEquals(this, node)) return true;
     if (node.GetType() != this.GetType()) return false;
     return Equals((Operation) node);
 }
开发者ID:graphql-dotnet,项目名称:graphql-dotnet,代码行数:7,代码来源:Operation.cs

示例8: IsEqualTo

 public override bool IsEqualTo(INode obj)
 {
     if (ReferenceEquals(null, obj)) return false;
     if (ReferenceEquals(this, obj)) return true;
     if (obj.GetType() != this.GetType()) return false;
     return Equals((FragmentDefinition) obj);
 }
开发者ID:graphql-dotnet,项目名称:graphql-dotnet,代码行数:7,代码来源:FragmentDefinition.cs

示例9: IsEqualTo

        public override bool IsEqualTo(INode obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;

            return Equals((DateTimeValue)obj);
        }
开发者ID:graphql-dotnet,项目名称:graphql-dotnet,代码行数:8,代码来源:IntValue.cs

示例10: Accept

		/// <summary> Accept nodes that are a ATag and have a URL
		/// that matches the regex pattern supplied in the constructor.
		/// </summary>
		/// <param name="node">The node to check.
		/// </param>
		/// <returns> <code>true</code> if the node is a link with the pattern.
		/// </returns>
		public virtual bool Accept(INode node)
		{
			bool ret;
			ret = false;
			if (typeof(ATag).IsAssignableFrom(node.GetType()))
			{
				System.String link = ((ATag) node).Link;
				CreateMatcher();
				return m_obRegex.IsMatch(link);
			}
			
			return (ret);
		}
开发者ID:limingyao,项目名称:Crawler,代码行数:20,代码来源:LinkRegexFilter.cs

示例11: Process

        private void Process(TreeNodeCollection treeNodeCollection, INode node)
        {
            string text = node.GetType().Name;
            switch (node.NodeType)
            {
                case NodeType.Text:
                    text = node.NodeType.ToString();
                    break;
                default:
                    break;
            }
            if (typeof(NDjango.ParserNodes.ErrorNode).IsAssignableFrom(node.GetType()))
                text = "ErrorNode";
            text += ": " + templateSource.Text.Substring(node.Position, node.Length);

            TreeNode tnode = new TreeNode(text);
            tnode.Tag = node;
            tnode.NodeFont = new Font(templateTree.Font, FontStyle.Underline);

            if (node.ErrorMessage.Severity > -1)
                tnode.Nodes.Add("(Error)" + node.ErrorMessage.Message);

            string vlist = "";
            var completion_provider = node as ICompletionProvider;
            //if (completion_provider != null)
            //    foreach (string s in completion_provider.Values)
            //        vlist += s + ' ';
            if (!string.IsNullOrEmpty(vlist))
                tnode.Nodes.Add("(Values) = " + vlist);

            foreach (KeyValuePair<string, IEnumerable<INode>> item in node.Nodes)
            {
                TreeNode list = new TreeNode(item.Key);
                tnode.Nodes.Add(list);
                foreach (INode child in item.Value)
                    Process(list.Nodes, child);
            }
            treeNodeCollection.Add(tnode);
        }
开发者ID:IntranetFactory,项目名称:ndjango,代码行数:39,代码来源:Viewer.cs

示例12: Arc

 /// <summary>
 /// Initializes a new instance of the Arc class with the specified source, target and id. 
 /// </summary>
 /// <param name="source">The source node of the new Arc.</param>
 /// <param name="target">The target node of the new Arc.</param>
 /// <param name="id">The id of the new Arc.</param>
 internal Arc(INode source, INode target, String id)
 {
     if (source == null)
         throw new ArgumentNullException("source");
     if (target == null)
         throw new ArgumentNullException("target");
     if (id == null)
         throw new ArgumentNullException("id");
     if (source.GetType() == target.GetType())
         throw new InvalidOperationException("Invalid arc between nodes of same type!");
     _source = source;
     _target = target;
     _id = id;
 }
开发者ID:HSchoenfelder,项目名称:Petedit,代码行数:20,代码来源:Arc.cs

示例13: Serialize

        public void Serialize(string rootPath, INode node, bool recursive = false)
        {
            string nodePath = Path.Combine(rootPath, node.Name.SanitizeUrl());

            if (!_fileSystem.DirectoryExists(nodePath))
                _fileSystem.CreateDirectory(nodePath);

            var metaModel = new MetaModel(node, nodePath);

            using (var fs = _fileSystem.Open(Path.Combine(nodePath, "Properties.txt"), FileMode.Create, FileAccess.Write, FileShare.None))
            using (var writer = new StreamWriter(fs))
            {
                writer.WriteLine("Type: {0}", node.GetType().FullName);
                writer.WriteLine("Urls: {0}", node.Uri);
                writer.WriteLine("Template: {0}", node.Template);
                writer.WriteLine("Publish: {0}", "Never");
                writer.WriteLine("Unpublish: {0}", "Never");
            }

            foreach (var s in metaModel.Properties)
            {
                string path = Path.Combine(nodePath, s.Name.SanitizeUrl() + ".txt");
                using (var fs = _fileSystem.Open(path, FileMode.Create, FileAccess.Write, FileShare.None))
                using (var writer = new StreamWriter(fs))
                {
                    writer.Write(s.Value.ToString());
                }
            }

            foreach (var prop in metaModel.XmlProperties)
            {
                string path = Path.Combine(nodePath, prop.Name.SanitizeUrl() + ".xml");
                using (var fs = _fileSystem.Open(path, FileMode.Create, FileAccess.Write, FileShare.None))
                using (var writer = new StreamWriter(fs))
                {
                    writer.Write(prop.Value.ToString());
                }
            }

            //  TODO
            //foreach (var collection in collections.Where(c => !ExcludedProperties.Contains(c.Name)))
            //{

            //}

            if (recursive)
                foreach (var child in node.Children)
                    Serialize(rootPath: nodePath, node: child, recursive: true);
        }
开发者ID:skovsboll,项目名称:Gandhi,代码行数:49,代码来源:NodeToFolderSerializer.cs

示例14: FlattenNode

        public StringBuilder FlattenNode(StringBuilder builder, INode node, string parentName, IList<string> names)
        {
            if (node == null) return builder;

            var nodeVariable = node.Name.ToLower().Replace(" ", "").Replace("(", "").Replace(")","").Replace(",","");
            if (!names.Contains(nodeVariable))
            {
                builder.AppendFormat("var {0} = graph.newNode({{label: '{1}', nodeType: '{2}'}});", nodeVariable, node.Name, node.GetType().Name);
                names.Add(nodeVariable);

                if (parentName != null)
                    builder.AppendFormat("graph.newEdge({0}, {1}, {{color: '{2}'}});", parentName, nodeVariable, RandomPastelColorGenerator.Instance.GetNextBrush().Color.ToString());
            }

            if (node.NextNodes != null)
                foreach (var subnode in node.NextNodes)
                {
                    FlattenNode(builder, subnode, nodeVariable, names);
                }

            return builder;
        }
开发者ID:pebblecode,项目名称:EducationPathways,代码行数:22,代码来源:HomeController.cs

示例15: Accept

		/// <summary> Accept nodes that are a LinkTag and
		/// have a URL that matches the pattern supplied in the constructor.
		/// </summary>
		/// <param name="node">The node to check.
		/// </param>
		/// <returns> <code>true</code> if the node is a link with the pattern.
		/// </returns>
		public virtual bool Accept(INode node)
		{
			bool ret;
			
			ret = false;
			if (typeof(LinkTag).IsAssignableFrom(node.GetType()))
			{
				System.String link = ((LinkTag) node).Link;
				if (mCaseSensitive)
				{
					if (link.IndexOf(mPattern) > - 1)
						ret = true;
				}
				else
				{
					if (link.ToUpper().IndexOf(mPattern.ToUpper()) > - 1)
						ret = true;
				}
			}
			
			return (ret);
		}
开发者ID:JamalAbuDayyeh,项目名称:slowandsteadyparser,代码行数:29,代码来源:LinkStringFilter.cs


注:本文中的INode.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。