Ejemplo n.º 1
0
 public FileIO(IGraph g)
 {
     try
     {
         graph = g;
         outputnodetype = g.Model.NodeModel.GetType("grIO_OUTPUT");
         if (outputnodetype == null) throw new Exception();
         createOrOverwriteType = g.Model.EdgeModel.GetType("grIO_CreateOrOverwrite");
         if (createOrOverwriteType == null) throw new Exception();
         createOrAppendType = g.Model.EdgeModel.GetType("grIO_CreateOrAppend");
         if (createOrAppendType == null) throw new Exception();
         fileType = g.Model.NodeModel.GetType("grIO_File");
         if (fileType == null) throw new Exception();
         fileNameAttrType = fileType.GetAttributeType("path");
         if (fileNameAttrType == null) throw new Exception();
         lineType = g.Model.NodeModel.GetType("grIO_File_Line");
         if (lineType == null) throw new Exception();
         containsLineType = g.Model.EdgeModel.GetType("grIO_File_ContainsLine");
         if (containsLineType == null) throw new Exception();
         nextLineType = g.Model.EdgeModel.GetType("grIO_File_NextLine");
         if (nextLineType == null) throw new Exception();
         lineContentAttrType = lineType.GetAttributeType("content");
         if (lineContentAttrType == null) throw new Exception();
     }
     catch (Exception)
     {
         throw new Exception("Could not find the required node/edge types. Did you include the GrIO-model?");
     }
 }
Ejemplo n.º 2
0
        public void should_add_and_get_unamed_node_on_an_array_and_variable(NodeType type)
        {
            var metadata = new Metadata(new object());
            var node = new Node { NodeType = type };

            node.ShouldExecuteCallback<INode>(
                (x, c) => node.Add(NodeType.Value, metadata, c), x =>
                {
                    x.IsNamed.ShouldBeFalse();
                    x.NodeType.ShouldEqual(NodeType.Value);
                    x.Metadata.ShouldNotBeSameAs(metadata);
                    x.Metadata.Get<object>().ShouldBeSameAs(metadata.Get<object>());
                    node.ShouldContainInstance(x);
                });

            node.ShouldExecuteCallback<INode>(
                (x, c) => node.Add(NodeType.Object, metadata, c), x =>
                {
                    x.IsNamed.ShouldBeFalse();
                    x.NodeType.ShouldEqual(NodeType.Object);
                    x.Metadata.ShouldNotBeSameAs(metadata);
                    x.Metadata.Get<object>().ShouldBeSameAs(metadata.Get<object>());
                    node.ShouldContainInstance(x);
                });

            node.ShouldExecuteCallback<INode>(
                (x, c) => node.Add(NodeType.Array, metadata, c), x =>
                {
                    x.IsNamed.ShouldBeFalse();
                    x.NodeType.ShouldEqual(NodeType.Array);
                    x.Metadata.ShouldNotBeSameAs(metadata);
                    x.Metadata.Get<object>().ShouldBeSameAs(metadata.Get<object>());
                    node.ShouldContainInstance(x);
                });
        }
Ejemplo n.º 3
0
        private async Task AcceptLoopAsync(ISocketConfiguration socketConfiguration, CancellationToken cancellationToken, NodeType nodeType)
        {
            _started.Set();

            try
            {
                while (!cancellationToken.IsCancellationRequested)
                {
                    var tcpClient = await _listener.AcceptTcpClientAsync();
                    SetupTcpClientParametersWithoutReceiveTimeout(tcpClient, socketConfiguration);
                    tcpClient.ReceiveTimeout = NodeTypeHasReceiveTimeout.HasReceiveTimeout(nodeType) ? socketConfiguration.ReceiveTimeout.ToMillisOrZero() : 0;

                    var socket = new TcpSocket(_endpoint, tcpClient);
                    socket.Disconnected += () => ClientDisconnected(socket);

                    TryFireClientConnectedEvent(socket, socketConfiguration);
                }
            }
            catch (ThreadAbortException)
            {
            }
            catch (OperationCanceledException)
            {
            }
            catch (ObjectDisposedException)
            {
            }
            finally
            {
                _stopped.Set();
            }
        }
Ejemplo n.º 4
0
        public BaseNode(string Text)
        {
            nodeType = NodeType.Base;
			this.Text = Text;
            this.ImageIndex = DataConvert.GetInt32(IconType.Tasks);
            this.SelectedImageIndex = DataConvert.GetInt32(IconType.Tasks);
		}
Ejemplo n.º 5
0
 /// <summary>
 /// Constructs with the provided node ID, type, activation function ID and auxiliary state data.
 /// </summary>
 public NetworkNode(uint id, NodeType nodeType, int activationFnId, double[] auxState)
 {
     _id = id;
     _nodeType = nodeType;
     _activationFnId = activationFnId;
     _auxState = auxState;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructs with the provided node ID, type and activation function ID.
 /// </summary>
 public NetworkNode(uint id, NodeType nodeType, int activationFnId)
 {
     _id = id;
     _nodeType = nodeType;
     _activationFnId = activationFnId;
     _auxState = null;
 }
Ejemplo n.º 7
0
 protected internal BinaryFormula(NodeType nodeType, IFormula left, IFormula right, ITypeDeclaration type, IMethodDeclaration method, IFormula parent)
     : base(nodeType, type, parent)
 {
     Left = left;
     Method = method;
     Right = right;
 }
Ejemplo n.º 8
0
        public QuadNode(NodeType nodeType, int nodeSize, int nodeDepth, QuadNode parent, QuadTree parentTree, int positionIndex)
        {
            NodeType = nodeType;
            _nodeSize = nodeSize;
            _nodeDepth = nodeDepth;
            _positionIndex = positionIndex;

            _parent = parent;
            _parentTree = parentTree;

            //Add the 9 vertices
            AddVertices();

            Bounds = new BoundingBox(_parentTree.Vertices[VertexTopLeft.Index].Position,
                        _parentTree.Vertices[VertexBottomRight.Index].Position);

            if (nodeSize >= 4)
                AddChildren();

            //Make call to UpdateNeighbors from the parent node.
            //This will update all neighbors recursively for the
            //children as well.  This ensures all nodes are created
            //prior to updating neighbors.
            if (_nodeDepth == 1)
            {
                AddNeighbors();

                VertexTopLeft.Activated = true;
                VertexTopRight.Activated = true;
                VertexCenter.Activated = true;
                VertexBottomLeft.Activated = true;
                VertexBottomRight.Activated = true;

            }
        }
		public override INode Resolve(string uri, NodeType nodeType, AddressScope scope, FileSystemOptions options)
		{
			bool success;
			IFileSystem fileSystem;

			var address = LayeredNodeAddress.Parse(uri);
						
			lock (this.fileSystemCache)
			{
				success = this.fileSystemCache.TryGetValue(address.RootUri, out fileSystem);
			}

			if (!success)
			{
				var networkUri = String.Format("netvfs://{0}[" + uri + "]/", this.ipAddress);

				fileSystem = FileSystemManager.GetManager().ResolveDirectory(networkUri).FileSystem;

				lock (this.fileSystemCache)
				{
					this.fileSystemCache.Add(address.RootUri, fileSystem);
				}
			}

			return fileSystem.Resolve(address.PathAndQuery);
		}
Ejemplo n.º 10
0
	public void Update(NodeType nextType)
	{
		if (nextType == nodeType)
		{
			return;
		}

		switch(nextType)
		{
			case NodeType.Sequence:
				mInternalNode = new BirdNest.Nodes.Sequence();
				break;
			case NodeType.Selector:
				mInternalNode = new BirdNest.Nodes.Selector();
				break;
			case NodeType.Parallel:
				mInternalNode = new BirdNest.Nodes.Parallel();
				break;
			case NodeType.UsePlan:
				mInternalNode = new BirdNest.Nodes.UsePlanNode(this);
				break;
			default:
				mInternalNode = null;
				return;
		}
		nodeType = nextType;
	}
Ejemplo n.º 11
0
 protected internal BinaryFormula(NodeType nodeType, Formula left, IMethodDeclaration method, Formula right)
     : base(nodeType, left.Type)
 {
     Left = left;
     Method = method;
     Right = right;
 }
        public NodeGreetingMessageVerifier(NodeType localNodeType, NodeType expectedRemoteNodeType, params NodeType[] allowOtherRemoteNoteTypes)
        {
            _expectedRemoteNodeTypes = new HashSet<NodeType> { expectedRemoteNodeType };
            if (allowOtherRemoteNoteTypes != null) _expectedRemoteNodeTypes.UnionWith(allowOtherRemoteNoteTypes);

            _greetingMessage = new NodeGreetingMessage(localNodeType);
        }
Ejemplo n.º 13
0
 public Node(string reference, GTASprite sprite, NodeType type)
 {
     Ref = reference;
     Direction = TreeDirection.Auto;
     Type = type;
     Sprite = sprite;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Constructs a new node.
 /// </summary>
 internal Node(String name, NodeType type = NodeType.Element, NodeFlags flags = NodeFlags.None)
 {
     _name = name ?? String.Empty;
     _type = type;
     _children = new NodeList();
     _flags = flags;
 }
		public override IEnumerable<INode> DoGetChildren(NodeType nodeType, Predicate<INode> acceptNode)
		{
			if (this.ChildrenProvider != null)
			{
				foreach (var node in this.ChildrenProvider(nodeType, acceptNode))
				{
					yield return node;
				}

				yield break;
			}

			foreach (var node in GetJumpPoints(nodeType, acceptNode))
			{
				if (nodeType == NodeType.Any || node.NodeType == nodeType)
				{
					yield return node;
				}
			}

			foreach (var node in this.children.Values)
			{
				if (node.NodeType == nodeType)
				{
					yield return node;
				}
			}
		}
Ejemplo n.º 16
0
 IClassInfoGraphNode addClassInfoGraphNode(ObjectSpace objectSpace, IMemberInfo memberInfo, NodeType nodeType) {
     var classInfoGraphNode =(IClassInfoGraphNode)objectSpace.CreateObject(TypesInfo.Instance.ClassInfoGraphNodeType);
     classInfoGraphNode.Name = memberInfo.Name;
     classInfoGraphNode.TypeName = getSerializedType(memberInfo).Name;
     classInfoGraphNode.NodeType=nodeType;            
     return classInfoGraphNode;
 }
Ejemplo n.º 17
0
 public Node(int id, NodeType type)
 {
     this.Id = id;
     this.type = type;
     this.packetSeq = 0;
     this.global = Global.getInstance();
 }
Ejemplo n.º 18
0
 public Node(
     NodeType nodeType, 
     ObjectNodeBase parent = null) :
     base(null, null, null, parent, ObjectNodeBaseTests.Context)
 {
     _nodeType = nodeType;
 }
Ejemplo n.º 19
0
 public Node(NodeType nt,int sym,int freq,int order)
 {
     this.nt = nt;
     this.sym = sym;
     this.freq = freq;
     this.order = order;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Bezparametrowy konstruktor na potrzeby serializacji Xml
 /// </summary>
 public Register()
     : base()
 {
     type = 0;
     parallelThreads = 0;
     solvableProblems = new List<string>();
 }
		public override IEnumerable<INode> DoGetChildren(NodeType nodeType, Predicate<INode> acceptNode)
		{
			foreach (string key in Environment.GetEnvironmentVariables().Keys)
			{
				yield return GetImaginaryChild(key, NodeType.File);
			}
		}
Ejemplo n.º 22
0
 public Node GetChildByType(NodeType type)
 {
     if (Children != null)
         return Children.FirstOrDefault(c => c.Type == type);
     else
         return null;
 }
Ejemplo n.º 23
0
 public XmlNodeInformation(string contentValue, int depth, CommonNamespaces commonNamespaces)
 {
     m_contentValue = contentValue;
     iDepth = depth;
     nodeType = NodeType.content;
     m_commonNamespaces = commonNamespaces;
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Gets the type of the name to value collection from element for.
        /// </summary>
        /// <param name="mainDocumentPart">The main document part.</param>
        /// <param name="elementName">Name of the element.</param>
        /// <param name="forNodeType">Type of for node.</param>
        /// <returns></returns>
        public Dictionary<string, string> GetNameToValueCollectionFromElementForType(MainDocumentPart mainDocumentPart, string elementName, NodeType forNodeType)
        {
            Dictionary<string, string> nameToValueCollection = new Dictionary<string, string>();
            CustomXmlPart customXmlPart = this.customXmlPartCore.GetCustomXmlPart(mainDocumentPart);

            if (customXmlPart != null)
            {
                XElement element = this.customXmlPartCore.GetFirstElementFromCustomXmlPart(customXmlPart, elementName);

                if (element != null)
                {
                    if (forNodeType == NodeType.Element)
                    {
                        foreach (XElement elem in element.Elements())
                        {
                            nameToValueCollection.Add(elem.Name.LocalName, elem.Nodes().Where(node => node.NodeType == XmlNodeType.Element).FirstOrDefault().ToString());
                        }
                    }
                    else if (forNodeType == NodeType.Attribute)
                    {
                        foreach (XAttribute attr in element.Attributes())
                        {
                            nameToValueCollection.Add(attr.Name.LocalName, attr.Value);
                        }
                    }
                }
            }

            return nameToValueCollection;
        }
Ejemplo n.º 25
0
 public void should_get_node(NodeType type)
 {
     var parent = new Node { NodeType = type };
     var child = new Node("hai");
     parent.Add(child, x => { });
     parent.GetNode("hai").ShouldEqual(child);
 }
Ejemplo n.º 26
0
 public void AddGeoTreeNode(NodeType mapNodeType, List<GeoNodePara> clutterNodeParas)
 {
     if (clutterNodeParas.Count != 0)
     {
         List<GeoTreeNode> treeNode = new List<GeoTreeNode>();
         foreach (GeoNodePara para in clutterNodeParas)
         {
             GeoTreeNode item = this.GetGeoFolderNodeByName(this.m_DynamicNodeCollection, mapNodeType, para.FolderName);
             if (item == null)
             {
                 item = new GeoTreeNode(para.FolderName, LayerIDCreator.GetExclusiveID(), mapNodeType, CheckedState.Checked);
                 this.m_DynamicNodeCollection.Add(item);
                 treeNode.Add(item);
             }
             GeoTreeNode node2 = new GeoTreeNode(para.LayerName, para.LayerId, mapNodeType, CheckedState.Checked);
             foreach (KeyValuePair<int, string> pair in para.ClutterIdNameDict)
             {
                 int tag = (para.LayerId << 0x10) + ((short) pair.Key);
                 GeoTreeNode node3 = new GeoTreeNode(pair.Value, tag, mapNodeType, CheckedState.Checked);
                 node2.ChildrenNodes.Add(node3);
             }
             item.ChildrenNodes.Add(node2);
         }
         if (this.OnAddModelNodeEvent != null)
         {
             this.OnAddModelNodeEvent(treeNode);
         }
     }
 }
		protected override INode CreateNode(INodeAddress address, NodeType nodeType)
		{
			if (!address.IsRoot)
			{
				var parent = (IDirectory)this.Resolve(address.Parent, NodeType.Directory);

				if (parent is ImaginaryDirectory)
				{
					var retval = ((ImaginaryDirectory)parent).GetImaginaryChild(address.Name, nodeType);

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

			if (nodeType == NodeType.Directory)
			{								
				return new ImaginaryDirectory(this, address);
			}
			else if (nodeType == NodeType.File)
			{
				return new ImaginaryFile(this, address);
			}

			throw new NotSupportedException(String.Format("{0}:{1}", address, nodeType));
		}
Ejemplo n.º 28
0
        public BaseNode(string nodename)
        {
            NodeType = NodeType.Base;
            this.Text = nodename;
            this.ImageIndex = DataConvert.GetInt32(IconType.VsTemplates);
            this.SelectedImageIndex = DataConvert.GetInt32(IconType.VsTemplates);
		}
Ejemplo n.º 29
0
 //Constructor
 public NodeValue(string name, Object value, NodeType type)
     : base(name, Node.EmptyNodes)
 {
     _type = type;
     _value = value;
     _desc = "Value";
 }
		public override INode Find(INodeResolver resolver, string uri, NodeType nodeType, FileSystemOptions options)
		{
			var address = LayeredNodeAddress.Parse(uri);

			if (address.Port >= 0 || address.UserName != "" || address.Password != "" || address.ServerName != "")
			{
				throw new MalformedUriException(uri, "Network & Authentication information not permitted");
			}

			if (nodeType.Is(typeof(IFile)))
			{
				var uri2 = address.InnerUri;

				if (StringUriUtils.ContainsQuery(uri2))
				{
					uri2 += "&shadow=true";
				}
				else
				{
					uri2 += "?shadow=true";
				}

				return resolver.Resolve(uri2, nodeType);
			}

			return resolver.Resolve(address.InnerUri);
		}
Ejemplo n.º 31
0
 protected VirtualFilesystemNode(NodeType type, string name)
 {
     Type = type;
     Name = name;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ManagePermissionSPObject" /> class.
 /// </summary>
 /// <param name="parentUrl">parentUrl.</param>
 /// <param name="parentNodeType">parentNodeType.</param>
 /// <param name="siteUrl">siteUrl.</param>
 /// <param name="webUrl">webUrl.</param>
 /// <param name="primaryAdministrator">primaryAdministrator.</param>
 /// <param name="primaryContact">primaryContact.</param>
 /// <param name="secondaryContact">secondaryContact.</param>
 /// <param name="temporaryGroupTitle">temporaryGroupTitle.</param>
 /// <param name="webId">webId.</param>
 /// <param name="siteId">siteId.</param>
 /// <param name="webServerRelativeUrl">webServerRelativeUrl.</param>
 /// <param name="listTitle">listTitle.</param>
 /// <param name="topInheritUrl">topInheritUrl.</param>
 /// <param name="inheritNodeType">inheritNodeType.</param>
 /// <param name="isInheritedPermission">isInheritedPermission.</param>
 /// <param name="id">id.</param>
 /// <param name="title">title.</param>
 /// <param name="fullUrl">fullUrl.</param>
 /// <param name="type">type.</param>
 public ManagePermissionSPObject(string parentUrl = default(string), NodeType parentNodeType = default(NodeType), string siteUrl = default(string), string webUrl = default(string), ApiUser primaryAdministrator = default(ApiUser), ApiUser primaryContact = default(ApiUser), ApiUser secondaryContact = default(ApiUser), string temporaryGroupTitle = default(string), Guid webId = default(Guid), Guid siteId = default(Guid), string webServerRelativeUrl = default(string), string listTitle = default(string), string topInheritUrl = default(string), NodeType inheritNodeType = default(NodeType), bool isInheritedPermission = default(bool), Guid id = default(Guid), string title = default(string), string fullUrl = default(string), NodeType type = default(NodeType))
 {
     this.ParentUrl            = parentUrl;
     this.SiteUrl              = siteUrl;
     this.WebUrl               = webUrl;
     this.PrimaryAdministrator = primaryAdministrator;
     this.PrimaryContact       = primaryContact;
     this.SecondaryContact     = secondaryContact;
     this.TemporaryGroupTitle  = temporaryGroupTitle;
     this.WebServerRelativeUrl = webServerRelativeUrl;
     this.ListTitle            = listTitle;
     this.TopInheritUrl        = topInheritUrl;
     this.Title                 = title;
     this.FullUrl               = fullUrl;
     this.ParentUrl             = parentUrl;
     this.ParentNodeType        = parentNodeType;
     this.SiteUrl               = siteUrl;
     this.WebUrl                = webUrl;
     this.PrimaryAdministrator  = primaryAdministrator;
     this.PrimaryContact        = primaryContact;
     this.SecondaryContact      = secondaryContact;
     this.TemporaryGroupTitle   = temporaryGroupTitle;
     this.WebId                 = webId;
     this.SiteId                = siteId;
     this.WebServerRelativeUrl  = webServerRelativeUrl;
     this.ListTitle             = listTitle;
     this.TopInheritUrl         = topInheritUrl;
     this.InheritNodeType       = inheritNodeType;
     this.IsInheritedPermission = isInheritedPermission;
     this.Id      = id;
     this.Title   = title;
     this.FullUrl = fullUrl;
     this.Type    = type;
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Advances the reader to the given node type, ignoring depth/scope.
 /// </summary>
 /// <param name="view">The view at the returned node type.</param>
 /// <param name="node">The node type to stop at.</param>
 /// <returns>The node type the parser stopped at.</returns>
 public NodeType Step(out SerializedValueView view, NodeType node = NodeType.Any)
 {
     view = ReadInternal(node, NodeParser.k_IgnoreParent);
     return(m_Parser.NodeType);
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Advances the reader to the given node type, ignoring depth/scope.
 /// </summary>
 /// <param name="node">The node type to stop at.</param>
 /// <returns>The node type the parser stopped at.</returns>
 public NodeType Step(NodeType node = NodeType.Any)
 {
     ReadInternal(node, NodeParser.k_IgnoreParent);
     return(m_Parser.NodeType);
 }
 public void AddNode(double x, double y, Guid id, NodeType nodeType)
 {
 }
        private void VisitNode(MemoryNode currentNode)
        {
            MemoryNode oldMemNode = currentNode;

            // Get the generation for the current node.
            int generation = _HeapInfo.GenerationFor(oldMemNode.Address);

            // Create a MemoryNodeBuilder for the new graph that represents the current node
            // unless the current node is the root, as we've already created one.
            MemoryNodeBuilder newMemNodeBuilder = null;

            if (currentNode.Index == _OriginalMemoryGraph.RootIndex)
            {
                newMemNodeBuilder = _RootNode;
            }
            else
            {
                // Get the parent node.
                MemoryNodeBuilder parentMemNodeBuilder = null;
                if ((oldMemNode.Address != 0) && (generation > _GenerationToCondemn))
                {
                    if (generation == 1)
                    {
                        parentMemNodeBuilder = _Gen1RootNode;
                    }
                    else
                    {
                        parentMemNodeBuilder = _Gen2RootNode;
                    }
                }
                else
                {
                    parentMemNodeBuilder = _OldNodeToNewParentMap[(int)currentNode.Index];
                }

                if (parentMemNodeBuilder == null)
                {
                    parentMemNodeBuilder = _UnknownRootNode;
                }

                // Get the current node's type and object address.
                NodeType nodeType = _OriginalMemoryGraph.GetType(oldMemNode.TypeIndex, _OldNodeTypeStorage);

                // Create the new generation aware type name.
                string typeName = null;
                if (oldMemNode.Address != 0 && generation >= 0)
                {
                    if (generation == 3)
                    {
                        typeName = string.Format("LOH: {0}", nodeType.Name);
                    }
                    else
                    {
                        typeName = string.Format("Gen{0}: {1}", generation, nodeType.Name);
                    }
                }
                else
                {
                    if (oldMemNode.Address != 0)
                    {
                        _Log.WriteLine(string.Format("Generation: {0}; Address: {1}; Type: {2}", generation, oldMemNode.Address, nodeType.Name));
                    }
                    typeName = nodeType.Name;
                }

                // Create the new node.
                if (ShouldAddToGraph(oldMemNode, nodeType))
                {
                    if (oldMemNode.Address == 0)
                    {
                        newMemNodeBuilder = parentMemNodeBuilder.FindOrCreateChild(typeName);
                    }
                    else
                    {
                        NodeIndex newNodeIndex = _NewMemoryGraph.GetNodeIndex(oldMemNode.Address);
                        newMemNodeBuilder = new MemoryNodeBuilder(_NewMemoryGraph, typeName, null, newNodeIndex);

                        parentMemNodeBuilder.AddChild(newMemNodeBuilder);

                        // Set the object size.
                        if (generation <= _GenerationToCondemn)
                        {
                            newMemNodeBuilder.Size = oldMemNode.Size;
                        }
                        else
                        {
                            _Log.WriteLine("Ignoring Object Size: " + typeName);
                        }
                    }
                }
            }

            // Associate all children of the current node with this object's new MemoryNodeBuilder.
            for (NodeIndex childIndex = oldMemNode.GetFirstChildIndex(); childIndex != NodeIndex.Invalid; childIndex = oldMemNode.GetNextChildIndex())
            {
                _OldNodeToNewParentMap[(int)childIndex] = newMemNodeBuilder;
            }
        }
Ejemplo n.º 37
0
 internal IndexQueryTreeNode(NodeType type)
 {
     this.type = type;
 }
 public AbstractExpressionNode(NodeType type) : base(type)
 {
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Serializes a NodeType object to Json string.
 /// </summary>
 /// <param name="value">The target object to be serialized.</param>
 /// <returns>The serialized Json string.</returns>
 public static string ToString(NodeType value)
 {
     s_ensure_string_builder();
     ToString_impl(value, s_stringBuilder, in_json: false);
     return(s_stringBuilder.ToString());
 }
Ejemplo n.º 40
0
 public static bool HasBomb(this NodeType type)
 {
     return(type == NodeType.BombCyan || type == NodeType.BombMagenta);
 }
 public abstract INode Find(INodeResolver resolver, string uri, NodeType nodeType, FileSystemOptions options);
Ejemplo n.º 42
0
        void Process()
        {
            bool matrixOnly = true;
            bool hasMatrix  = false;
            bool hasVector  = false;
            bool hasSingle  = false;

            foreach (NodeInput inp in Inputs)
            {
                if (inp != executeInput)
                {
                    if (inp.HasInput)
                    {
                        if (inp.Input.Data is MVector)
                        {
                            matrixOnly = false;
                            hasVector  = true;
                        }
                        else if (Utils.IsNumber(inp.Input.Data))
                        {
                            hasSingle  = true;
                            matrixOnly = false;
                        }
                        else if (inp.Input.Data is Matrix4)
                        {
                            hasMatrix = true;
                        }
                    }
                }
            }

            if (hasVector && hasMatrix)
            {
                object   i1 = Inputs[1].Input.Data;
                object   i2 = Inputs[2].Input.Data;
                NodeType t1 = Inputs[1].Input.Type;
                NodeType t2 = Inputs[2].Input.Type;

                if (i1 is MVector && i2 is Matrix4)
                {
                    MVector v = (MVector)i1;

                    if (t1 == NodeType.Float2 || t1 == NodeType.Float3)
                    {
                        v.W = 1;
                    }

                    Vector4 v2 = new Vector4(v.X, v.Y, v.Z, v.W);
                    Matrix4 m2 = (Matrix4)i2;

                    v2 = v2 * m2;

                    output.Data = new MVector(v2.X, v2.Y, v2.Z, v2.W);
                }
                else if (i1 is Matrix4 && i2 is MVector)
                {
                    MVector v = (MVector)i2;

                    if (t2 == NodeType.Float2 || t2 == NodeType.Float3)
                    {
                        v.W = 1;
                    }

                    Vector4 v2 = new Vector4(v.X, v.Y, v.Z, v.W);
                    Matrix4 m2 = (Matrix4)i1;

                    v2 = m2 * v2;

                    output.Data = new MVector(v2.X, v2.Y, v2.Z, v2.W);
                }
                else
                {
                    output.Data = i1;
                }
            }
            else if (hasMatrix && matrixOnly)
            {
                object i1 = Inputs[1].Input.Data;
                object i2 = Inputs[2].Input.Data;

                if (i1 is Matrix4 && i1 is Matrix4)
                {
                    Matrix4 m1 = (Matrix4)i1;
                    Matrix4 m2 = (Matrix4)i2;

                    output.Data = m1 * m2;
                }
                else
                {
                    output.Data = i1;
                }
            }
            else if (hasMatrix && hasSingle)
            {
                object i1 = Inputs[1].Input.Data;
                object i2 = Inputs[2].Input.Data;

                if (Utils.IsNumber(i1) && i2 is Matrix4)
                {
                    float   f  = Convert.ToSingle(i1);
                    Matrix4 m2 = (Matrix4)i2;

                    output.Data = f * m2;
                }
                else if (i1 is Matrix4 && Utils.IsNumber(i2))
                {
                    float   f  = Convert.ToSingle(i2);
                    Matrix4 m2 = (Matrix4)i1;

                    output.Data = m2 * f;
                }
                else
                {
                    output.Data = i1;
                }
            }
            else if (hasVector)
            {
                MVector v = new MVector();

                int i = 0;
                foreach (NodeInput inp in Inputs)
                {
                    if (inp != executeInput)
                    {
                        if (inp.HasInput)
                        {
                            object o = inp.Input.Data;
                            if (o == null)
                            {
                                continue;
                            }

                            if (Utils.IsNumber(o))
                            {
                                if (i == 0)
                                {
                                    float f = Convert.ToSingle(o);
                                    v.X = v.Y = v.Z = v.W = f;
                                }
                                else
                                {
                                    float f = Convert.ToSingle(o);
                                    v.X *= f;
                                    v.Y *= f;
                                    v.Z *= f;
                                    v.W *= f;
                                }
                            }
                            else if (o is MVector)
                            {
                                if (i == 0)
                                {
                                    var d = (MVector)o;
                                    v.X = d.X;
                                    v.Y = d.Y;
                                    v.Z = d.Z;
                                    v.W = d.W;
                                }
                                else
                                {
                                    MVector f = (MVector)o;
                                    v.X *= f.X;
                                    v.Y *= f.Y;
                                    v.Z *= f.Z;
                                    v.W *= f.W;
                                }
                            }

                            i++;
                        }
                    }
                }

                output.Data = v;
            }
            else
            {
                float v = 0;
                int   i = 0;
                foreach (NodeInput inp in Inputs)
                {
                    if (inp != executeInput)
                    {
                        if (inp.HasInput)
                        {
                            object o = inp.Input.Data;
                            if (o == null)
                            {
                                continue;
                            }

                            if (Utils.IsNumber(o))
                            {
                                if (i == 0)
                                {
                                    v = Convert.ToSingle(o);
                                }
                                else
                                {
                                    float f = Convert.ToSingle(o);
                                    v *= f;
                                }
                            }

                            i++;
                        }
                    }
                }

                output.Data = v;
            }

            if (output.Data != null)
            {
                result = output.Data.ToString();
            }

            if (ParentGraph != null)
            {
                FunctionGraph g = (FunctionGraph)ParentGraph;

                if (g != null && g.OutputNode == this)
                {
                    g.Result = output.Data;
                }
            }
        }
Ejemplo n.º 43
0
        private void ChunkIt(Node p_node)
        {
            NodeType this_type = p_node.Type;

            switch (this_type)
            {
            case NodeType.PROGRAM:
                ChunkProgram(p_node as ProgramNode);
                break;

            case NodeType.BINARY:
                ChunkBinary(p_node as BinaryNode);
                break;

            case NodeType.UNARY:
                ChunkUnary(p_node as UnaryNode);
                break;

            case NodeType.LITERAL:
                ChunkLiteral(p_node as LiteralNode);
                break;

            case NodeType.GROUPING:
                ChunkGrouping(p_node as GroupingNode);
                break;

            case NodeType.STMT_EXPR:
                ChunkStmtExpr(p_node as StmtExprNode);
                break;

            case NodeType.IF:
                ChunkIf(p_node as IfNode);
                break;

            case NodeType.WHILE:
                ChunkWhile(p_node as WhileNode);
                break;

            case NodeType.VARIABLE:
                ChunkVariable(p_node as VariableNode);
                break;

            case NodeType.VAR_DECLARATION:
                ChunkVarDeclaration(p_node as VarDeclarationNode);
                break;

            case NodeType.ASSIGMENT_OP:
                ChunkAssignmentOp(p_node as AssignmentNode);
                break;

            case NodeType.LOGICAL:
                ChunkLogical(p_node as LogicalNode);
                break;

            case NodeType.BLOCK:
                ChunkBlock(p_node as BlockNode);
                break;

            case NodeType.FUNCTION_CALL:
                ChunkFunctionCall(p_node as FunctionCallNode);
                break;

            case NodeType.RETURN:
                ChunkReturn(p_node as ReturnNode);
                break;

            case NodeType.FUNCTION_DECLARATION:
                ChunkFunctionDeclaration(p_node as FunctionDeclarationNode);
                break;

            case NodeType.MEMBER_FUNCTION_DECLARATION:
                ChunkMemberFunctionDeclaration(p_node as MemberFunctionDeclarationNode);
                break;

            case NodeType.FUNCTION_EXPRESSION:
                ChunkFunctionExpression(p_node as FunctionExpressionNode);
                break;

            case NodeType.FOR:
                ChunkFor(p_node as ForNode);
                break;

            case NodeType.TABLE:
                ChunkTable(p_node as TableNode);
                break;

            case NodeType.LIST:
                ChunkList(p_node as ListNode);
                break;

            default:
                Error("Received unkown node." + this_type.ToString(), p_node.PositionData);
                break;
            }
        }
 public override INode Resolve(string name, NodeType nodeType, AddressScope scope)
 {
     return(this.viewFileSystem.Resolve(this.parentAddress.ResolveAddress(name).AbsolutePath, nodeType, scope));
 }
Ejemplo n.º 45
0
 public FileUploadData(string name, NodeType type = NodeType.FILE)
 {
     Name = name;
     Kind = type;
 }
Ejemplo n.º 46
0
 public Node(int xIndex, int yIndex, NodeType nodeType)
 {
     this.xIndex   = xIndex;
     this.yIndex   = yIndex;
     this.nodeType = nodeType;
 }
        private static Node ConstuctNode(BinaryReader br, UInt32 id, NodeType nodeType, CommandType commandType)
        {
            //Console.WriteLine(nodeType);
            switch (nodeType)
            {
            case NodeType.Script:
            {
                var scriptNode = new ScriptNode();
                scriptNode.Id = id;
                scriptNode.readData(br);
                return(scriptNode);
            }

            case NodeType.Page:
            {
                var pageNode = new PageNode();
                pageNode.Id = id;
                pageNode.readData(br);
                return(pageNode);
            }

            case NodeType.OnceOnly:
            {
                var onceOnly = new OnceOnlyNode();
                onceOnly.Id = id;
                onceOnly.readData(br);
                return(onceOnly);
            }

            case NodeType.ConditionalTrue:
            {
                var node = new ConditionalTrueNode();
                node.Id = id;
                node.readData(br);
                return(node);
            }

            case NodeType.ConditionalFalse:
            {
                var node = new ConditionalFalseNode();
                node.Id = id;
                node.readData(br);
                return(node);
            }

            case NodeType.OptionsChoice:
            {
                var node = new ShowOptionsNode();
                node.Id = id;
                node.readData(br);
                return(node);
            }

            case NodeType.Option:
            {
                var node = new OptionNode();
                node.Id = id;
                node.readData(br);
                return(node);
            }

            case NodeType.ParallelNode:
            {
                var node = new ParallelNode();
                node.Id = id;
                node.readData(br);
                return(node);
            }

            case NodeType.BlockNode:
            {
                var node = new BlockNode();
                node.Id = id;
                node.readData(br);
                return(node);
            }

            case NodeType.Command:
            {
                switch (commandType)
                {
                case CommandType.Say:
                {
                    var command = new SayNode();
                    command.Id = id;
                    command.readData(br);
                    return(command);
                }

                case CommandType.CallPage:
                {
                    var command = new CallPageNode();
                    command.Id = id;
                    command.readData(br);
                    return(command);
                }

                case CommandType.Return:
                {
                    var command = new ReturnNode();
                    command.Id = id;
                    command.readData(br);
                    return(command);
                }

                case CommandType.Wait:
                {
                    var command = new WaitNode();
                    command.Id = id;
                    command.readData(br);
                    return(command);
                }

                case CommandType.Print:
                {
                    var command = new PrintNode();
                    command.Id = id;
                    command.readData(br);
                    return(command);
                }

                default:
                    throw new Exception("Unhandled Node Type:" + nodeType + ":" + commandType);
                }
            }

            // case NodeType.Say
            default:
                throw new Exception("Unhandled Node Type:" + nodeType);
            }
            return(null);
        }
Ejemplo n.º 48
0
        private void _InsertProfiles(NodeType nodeType, string Ident_DomainRD, string UID_ApplicationServer)
        {
            ISqlFormatter isql     = clsMain.Instance.CurrentConnection.Connection.SqlFormatter;
            SqlExecutor   cSQL     = clsMain.Instance.CurrentConnection.Connection.CreateSqlExecutor(clsMain.Instance.CurrentConnection.PublicKey);
            string        strSQL   = "";
            string        strSQLEO = "";

            TreeListNode tlnProfile;

            try
            {
                // SQL depents on ProfileType
                switch (nodeType)
                {
                case NodeType.AppProfile:
                    strSQL   = clsMain.Instance.CurrentConnection.Connection.SqlStrings["ServerAppProfile"];
                    strSQLEO = clsMain.Instance.CurrentConnection.Connection.SqlStrings["ServerAppProfileErrorsOnly"];
                    break;

                case NodeType.DrvProfile:
                    strSQL   = clsMain.Instance.CurrentConnection.Connection.SqlStrings["ServerDrvProfile"];
                    strSQLEO = clsMain.Instance.CurrentConnection.Connection.SqlStrings["ServerDrvProfileErrorsOnly"];
                    break;

                case NodeType.MacType:
                    strSQL   = clsMain.Instance.CurrentConnection.Connection.SqlStrings["ServerMacType"];
                    strSQLEO = clsMain.Instance.CurrentConnection.Connection.SqlStrings["ServerMacTypeErrorsOnly"];
                    break;
                }


                // replace the Variables
                if (clsMain.Instance.ErrorOnly)
                {
                    strSQL = strSQL.Replace("@ErrorsOnly", strSQLEO);                        // insert the ErrorOnly part
                }
                else
                {
                    strSQL = strSQL.Replace("@ErrorsOnly", "");                                  // remove the ErrorOnly part
                }
                strSQL = strSQL.Replace("@Ident_DomainRD", isql.FormatValue(Ident_DomainRD, ValType.String));
                strSQL = strSQL.Replace("@UID_ApplicationServer", isql.FormatValue(UID_ApplicationServer, ValType.String));

                using (IDataReader rData = new CachedDataReader(cSQL.SqlExecute(strSQL)))
                {
                    while (rData.Read())
                    {
                        // create a new Node
                        tlnProfile     = tlcProfile.Nodes.Add(rData.GetString(1), 0);
                        tlnProfile.Tag = new NodeData(nodeType, rData.GetString(0), "");

                        tlnProfile.SubItems.Add(rData.GetInt32(2).ToString());                                  // Nr Ist
                        tlnProfile.SubItems.Add(rData.GetInt32(3).ToString());                                  // Nr Soll
                        tlnProfile.SubItems.Add(rData.GetString(4).ToString());                                 // State P
                        tlnProfile.SubItems.Add(rData.GetString(5).ToString());                                 // State S
                        tlnProfile.SubItems.Add(rData.GetDateTime(6).ToString());                               // XDateUpdated
                        tlnProfile.SubItems.Add("");
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionDialog.Show(this.ParentForm, ex);
            }
        }
        private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;

            //			if(node.Parent != null)
            //			{
            panelIO1.Clear();
            NodeType ioType = (NodeType)node.Tag;
            string   label;

            switch (ioType)
            {
            case NodeType.DigitalInput:
                foreach (IDigitalInput ioPoint in ioManifest.digitalInputMap.Values)
                {
                    label = ioPoint.Name;
                    panelIO1.AddIO(ioPoint, label);
                }
                break;

            case NodeType.DigitalOutput:
                foreach (IDigitalOutput ioPoint in ioManifest.digitalOutputMap.Values)
                {
                    label = ioPoint.Name;
                    panelIO1.AddIO(ioPoint, label);
                }
                break;

            case NodeType.AnalogInput:
                foreach (IAnalogInput ioPoint in ioManifest.analogInputMap.Values)
                {
                    label = ioPoint.Name;
                    panelIO1.AddIO(ioPoint, label);
                }
                break;

            case NodeType.AnalogOutput:
                foreach (IAnalogOutput ioPoint in ioManifest.analogOutputMap.Values)
                {
                    label = ioPoint.Name;
                    panelIO1.AddIO(ioPoint, label);
                }
                break;
            }

            if (ioType == NodeType.Axis)
            {
                panelIO1.Visible = false;
                panelIO1.Dock    = DockStyle.None;

                panelAxis1.Enabled = true;
                panelAxis1.Visible = true;
                panelAxis1.Dock    = DockStyle.Fill;

                // assign the one and only axis for this node
                panelAxis1.AssignAxisMap(ioManifest.axisMap);
            }
            else
            {
                panelIO1.Visible = true;
                panelIO1.Dock    = DockStyle.Fill;
                panelIO1.UpdateLayout();

                panelAxis1.Enabled = false;
                panelAxis1.Visible = false;
                panelAxis1.Dock    = DockStyle.Fill;
                panelAxis1.AssignAxis(null);
            }
            //			}
        }
Ejemplo n.º 50
0
        public void SkuIsGeneratedCorrectly(int cores, int memory, NodeType target, string expectedResult)
        {
            var SKU = new SKU(cores, memory, target);

            Assert.IsTrue(SKU.ToString() == expectedResult);
        }
Ejemplo n.º 51
0
 public JSONNode(double value)
 {
     this._type   = NodeType.Number;
     _numberValue = value;
 }
Ejemplo n.º 52
0
 public JSONNode(Dictionary <string, JSONNode> value)
 {
     this._type   = NodeType.Object;
     _objectValue = value;
 }
Ejemplo n.º 53
0
 public JSONNode(bool value)
 {
     this._type = NodeType.Bool;
     _boolValue = value;
 }
Ejemplo n.º 54
0
 public JSONNode(string value)
 {
     this._type   = NodeType.String;
     _stringValue = value;
 }
Ejemplo n.º 55
0
 /// <summary>
 /// Reads the next node in the stream, respecting depth/scope.
 /// </summary>
 /// <param name="node">The node type to stop at.</param>
 /// <returns>The node type the parser stopped at.</returns>
 public NodeType Read(NodeType node = NodeType.Any)
 {
     ReadInternal(node, m_Parser.TokenParentIndex);
     return(m_Parser.NodeType);
 }
Ejemplo n.º 56
0
 public JSONNode(List <JSONNode> value)
 {
     this._type  = NodeType.Array;
     _arrayValue = value;
 }
Ejemplo n.º 57
0
        private GraphItemConfiguration CreateSectionConfiguration(PropertyInfo property, Section section)
        {
            var sectionConfig = new NodeConfigSectionBase
            {
                Name           = section.Name,
                IsProxy        = section is ProxySection,
                Visibility     = section.Visibility,
                SourceType     = property.PropertyType.GetGenericParameter(),
                AddCommandType = section.AddCommandType
            };

            var referenceSection = section as ReferenceSection;

            if (referenceSection != null)
            {
                sectionConfig.AllowDuplicates = referenceSection.AllowDuplicates;
                sectionConfig.AllowAdding     = !referenceSection.Automatic;
                sectionConfig.ReferenceType   = referenceSection.ReferenceType ??
                                                sectionConfig.SourceType.GetGenericParameter() ?? property.PropertyType.GetGenericParameter();
                sectionConfig.IsEditable           = referenceSection.Editable;
                sectionConfig.HasPredefinedOptions = referenceSection.HasPredefinedOptions;

                if (sectionConfig.ReferenceType == null)
                {
                    throw new Exception(string.Format("Reference Section on property {0} doesn't have a valid ReferenceType.", property.Name));
                }

                //sectionConfig.GenericSelector = (node) =>
                //{

                //};
            }
            if (sectionConfig.IsProxy || referenceSection == null)
            {
                var property1 = property;

                if (sectionConfig.IsProxy)
                {
                    sectionConfig.AllowAdding = false;
                }

                sectionConfig.GenericSelector = (node) =>
                {
                    var enumerator = property1.GetValue(node, null) as IEnumerable;
                    if (enumerator == null)
                    {
                        return(null);
                    }
                    return(enumerator.Cast <IGraphItem>());
                };
            }
            else if (referenceSection != null)
            {
                var possibleSelectorProperty = NodeType.GetProperty("Possible" + property.Name);
                if (possibleSelectorProperty != null)
                {
                    sectionConfig.GenericSelector = (node) =>
                    {
                        var propertyN  = NodeType.GetProperty("Possible" + property.Name);
                        var enumerator = propertyN.GetValue(node, null) as IEnumerable;

                        if (enumerator == null)
                        {
                            return(null);
                        }
                        return(enumerator.OfType <IGraphItem>());
                    };
                }
                else
                {
                    sectionConfig.GenericSelector = (node) =>
                    {
                        return(node.Repository.AllOf <IGraphItem>().Where(p => referenceSection.ReferenceType.IsAssignableFrom(p.GetType())));
                    };
                }
            }
            return(sectionConfig);
        }
Ejemplo n.º 58
0
        public Node(int x, int y, NodeType type, char symbol)
        {
            Position = new Coordinate(x, y);
            Type     = type;
            Symbol   = symbol;
            List <Coordinate> sides = GetSides(x, y);

            if (type == NodeType.PATH)
            {
                Field.Add(Position, this);

                foreach (var side in sides)
                {
                    if (Field.ContainsKey(side))
                    {
                        AddEdge(Field[side]);
                    }
                }
            }
            else
            {
                Teleports.Add(Position, this);

                foreach (var side in sides)
                {
                    if (Teleports.ContainsKey(side))
                    {
                        Node teleport = Teleports[side];
                        if (symbol == 'A' && teleport.Symbol == 'A')
                        {
                            Type              = NodeType.START;
                            teleport.Type     = NodeType.START;
                            Soulmate          = teleport;
                            teleport.Soulmate = this;
                        }
                        else if (symbol == 'Z' && teleport.Symbol == 'Z')
                        {
                            Type              = NodeType.END;
                            teleport.Type     = NodeType.END;
                            Soulmate          = teleport;
                            teleport.Soulmate = this;
                        }
                        else
                        {
                            string telId = string.Concat(new[] { symbol, teleport.Symbol });

                            var pair = new List <Node> {
                                this, teleport
                            };
                            if (TeleportIDs.ContainsKey(telId))
                            {
                                TeleportIDs[telId].AddRange(pair);
                            }
                            else
                            {
                                TeleportIDs.Add(telId, pair);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 59
0
 /// <summary>
 /// Reads the next node in the stream, respecting depth/scope.
 /// </summary>
 /// <param name="view">The view at the returned node type.</param>
 /// <param name="node">The node type to stop at.</param>
 /// <returns>The node type the parser stopped at.</returns>
 public NodeType Read(out SerializedValueView view, NodeType node = NodeType.Any)
 {
     view = ReadInternal(node, m_Parser.TokenParentIndex);
     return(m_Parser.NodeType);
 }
Ejemplo n.º 60
0
        /// <summary>
        /// 将语法解析为节点树
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="ParentNode"></param>
        /// <param name="output"></param>
        private void CreateNodeContextRange(StreamReader reader, NodeBlockContext ParentNode, OutPutProvide output)
        {
            while (true)
            {
                string line = reader.ReadLine();
                if (line == null)
                {
                    return;
                }
                _lineNumber++;
                NodeType    type = GetNodeType(line);
                NodeContext last = ParentNode.Nodes.LastOrDefault();
                if (last?.NdType == NodeType.IF || last?.NdType == NodeType.ELSEIF)
                {
                    if (type != NodeType.ELSEIF && type != NodeType.ELSE)
                    {
                        for (int i = ParentNode.Nodes.Count - 1; i >= 0; i--)
                        {
                            NodeContext item = ParentNode.Nodes[i];
                            if (item.NdType != NodeType.ELSEIF && item.NdType != NodeType.IF)
                            {
                                break;
                            }
                            item.ConvertToExpression();
                        }
                    }
                }
                switch (type)
                {
                case NodeType.IF:
                    NodeBlockContext block = new IFNodeContext(line, ParentNode, output);
                    CreateNodeContextRange(reader, block, output);
                    ParentNode.Nodes.Add(block);
                    break;

                case NodeType.ELSEIF:
                    block = new ELSEIFNodeContext(line, ParentNode, output);
                    CreateNodeContextRange(reader, block, output);
                    if (last is IFNodeContext ifnd1)
                    {
                        ifnd1.ELSENode = block;
                    }
                    else if (last is ELSEIFNodeContext elnd1)
                    {
                        elnd1.ELSENode = block;
                    }
                    else
                    {
                        throw new Exception($"第{_lineNumber}行语法错误,elseif必须在 if 或 elseif 之后");
                    }
                    ParentNode.Nodes.Add(block);
                    break;

                case NodeType.ELSE:
                    block = new ELSENodeContext(line, ParentNode, output);
                    CreateNodeContextRange(reader, block, output);
                    block.ConvertToExpression();
                    if (last is IFNodeContext ifnd)
                    {
                        ifnd.ELSENode = block;
                    }
                    else if (last is ELSEIFNodeContext elnd)
                    {
                        elnd.ELSENode = block;
                    }
                    else
                    {
                        throw new Exception($"第{_lineNumber}行语法错误,else 必须在 if 或 elseif之后");
                    }
                    for (int i = ParentNode.Nodes.Count - 1; i >= 0; i--)
                    {
                        NodeContext item = ParentNode.Nodes[i];
                        if (item.NdType != NodeType.ELSEIF && item.NdType != NodeType.IF)
                        {
                            break;
                        }
                        item.ConvertToExpression();
                    }
                    ParentNode.Nodes.Add(block);
                    break;

                case NodeType.EACH:
                    block = new EACHNodeContext(line, ParentNode, output);
                    CreateNodeContextRange(reader, block, output);
                    block.ConvertToExpression();
                    ParentNode.Nodes.Add(block);
                    break;

                case NodeType.PRINT:
                    NodeContext node = new PRINTNodeContext(line, ParentNode, output);
                    node.ConvertToExpression();
                    ParentNode.Nodes.Add(node);
                    break;

                case NodeType.STRING:
                    node = new STRINGNodeContext(line, ParentNode, output);
                    node.ConvertToExpression();
                    ParentNode.Nodes.Add(node);
                    break;

                case NodeType.SET:
                    node = new SETNodeContext(line, ParentNode, output);
                    node.ConvertToExpression();
                    ParentNode.Nodes.Add(node);
                    break;

                case NodeType.OPER:
                    node = new OperNodeContext(line, ParentNode, output);
                    node.ConvertToExpression();
                    ParentNode.Nodes.Add(node);
                    break;

                case NodeType.ENDIF:
                case NodeType.ENDELSEIF:
                case NodeType.ENDELSE:
                case NodeType.ENDEACH:
                    return;

                default:
                    throw new Exception($"{type}是不受支持的节点类型");
                }
            }
        }