private bool isStructLeaf(nodeType type) { return(type == nodeType.StructLeafByte || type == nodeType.StructLeafDeg || type == nodeType.StructLeafFloat || type == nodeType.StructLeafBool || type == nodeType.StructLeafInt || type == nodeType.StructLeafName || type == nodeType.StructLeafStr || type == nodeType.StructLeafEnum || type == nodeType.StructLeafArray || type == nodeType.StructLeafStruct || type == nodeType.StructLeafObject); }
protected ASTElement(nodeType type, ASTElement parent) { m_nodeType = type; m_parent = parent; m_serial = ms_serialCounter++; m_nodeName = GenerateNodeNames(); }
public Node(int x, int y, bool ground, bool onGround, bool nearGround, bool platform, Vector2 pos) { gridX = x; gridY = y; type = nodeType.air; if (nearGround) { type = nodeType.nearGround; } if (onGround) { type = nodeType.onGround; } if (ground) { type = nodeType.ground; } if (platform) { type = nodeType.platform; } position = pos; }
protected ASTElement(string text, nodeType type, ASTElement parent) { m_nodeType = type; m_parent = parent; m_serial = ms_serialCounter++; m_text = text; }
public void Enqueue(nodeType node) { if (node == null) { log.Error.Throw(log.exceptionType.Null); } EnqueueNotNull(node); }
/// <summary> /// 节点队列 /// </summary> /// <param name="node">默认节点,不能为null</param> public concurrent(nodeType node) { if (node == null) { log.Error.Throw(log.exceptionType.Null); } head = end = node; }
/// <summary> /// 多线程并发添加节点 /// </summary> /// <param name="node"></param> internal void EnqueueNotNull(nodeType node) { queue.EnqueueNotNull(node); if (Interlocked.CompareExchange(ref isThread, 1, 0) == 0) { fastCSharp.threading.threadPool.TinyPool.FastStart(this, threading.thread.callType.SingleDequeueNode); } }
public AudioNode(nodeType _type, Vector3 _loc, Vector3 _forwards) { type = _type; neighbors = new ArrayList(); location = _loc; forwards = _forwards; strength = 0; dest = false; source = false; visited = false; closed = false; switch (_type) { case nodeType.OneSeg: cost = 1; break; case nodeType.TwoSeg: cost = 2; break; case nodeType.FourSeg: cost = 4; break; case nodeType.EightSeg: cost = 8; break; case nodeType.STurn: cost = 4; break; case nodeType.LTurn: cost = 8; break; case nodeType.Quad: cost = 5; break; case nodeType.Key: cost = 1; break; } }
protected ASTComposite(string text, nodeType type, ASTElement parent, int numContexts) : base(text, type, parent) { m_children = new List <ASTElement> [numContexts]; for (int i = 0; i < numContexts; i++) { m_children[i] = new List <ASTElement>(); } m_nodeName = GenerateNodeName(); }
public nodeType UnsafeDequeue() { nodeType node = head.QueueNextNode; if (node != null) { head = node; } return(node); }
/// <summary> /// 单线程读取队列 /// </summary> /// <param name="node"></param> /// <param name="onNode">数据处理委托</param> /// <param name="onError">异常处理</param> public singleDequeueNode(nodeType node, Action <nodeType> onNode, Action <Exception> onError = null) { if (onNode == null) { log.Error.Throw(log.exceptionType.Null); } this.onError = onError; this.onNode = onNode; queue = new concurrent(node); }
internal void EnqueueNotNull(nodeType node) { while (Interlocked.CompareExchange(ref end.QueueNextNode, node, null) != null) { Thread.Yield(); if (Interlocked.CompareExchange(ref end.QueueNextNode, node, null) == null) { break; } Thread.Sleep(0); } end = node; }
public nodeType Cast <nodeType>() where nodeType : Node { if (typeof(nodeType).Name != RemoteExpressionTypeName) { throw new InvalidCastException(); } nodeType value = AutoCSer.Metadata.DefaultConstructor <nodeType> .Constructor(); value.Parent = this; value.ClientNodeId = 0; return(value); }
public Node(string id, nodeType type, Vector2 position, float width, float height, GUIStyle nodeStyle, GUIStyle selectedStyle, GUIStyle inPointStyle, GUIStyle outPointStyle, Action <ConnectionPoint> OnClickInPoint, Action <ConnectionPoint> OnClickOutPoint, Action <Node> OnClickRemoveNode, Action <Node> OnClickChangeRoot) { this.id = id; this.type = type; rect = new Rect(position.x, position.y, width, height); style = nodeStyle; inPoint = new ConnectionPoint(id, rect, ConnectionPointType.In, inPointStyle, OnClickInPoint); outPoint = new ConnectionPoint(id, rect, ConnectionPointType.Out, outPointStyle, OnClickOutPoint); defaultNodeStyle = nodeStyle; selectedNodeStyle = selectedStyle; OnRemoveNode = OnClickRemoveNode; OnNewRoot = OnClickChangeRoot; isRoot = false; }
/// <summary> /// 清除节点数据 /// </summary> public void Clear() { do { nodeType head = this.head, end = this.end; if (head == end) { return; } if (Interlocked.CompareExchange(ref this.head, end, head) == head) { return; } }while (true); }
//用圆心坐标和半径直接初始化节点 public node(int _x, int _y, int _r, nodeType _type) { // 该调用是 Windows.Forms 窗体设计器所必需的。 InitializeComponent(); //应用双缓冲技术是画面不闪烁 this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true); this.BackColor = Color.DarkGray; list_neighbour = new List<node>(); list_anchor = new List<jumptoanchor>(); timer_changenodeposition = new Timer(); type = _type; buildnode(_x, _y, _r, _type); }
/// <summary> /// 多线程并发弹出节点 /// </summary> /// <returns></returns> public nodeType Dequeue() { nodeType head = this.head, node = head.QueueNextNode; while (node != null) { if (Interlocked.CompareExchange(ref this.head, node, head) == head) { return(node); } Thread.Yield(); if ((node = (head = this.head).QueueNextNode) == null) { return(null); } if (Interlocked.CompareExchange(ref this.head, node, head) == head) { return(node); } Thread.Sleep(0); node = (head = this.head).QueueNextNode; } return(null); }
public CASTMultiplication(nodeType type, ASTElement parent, int numContexts) : base(type, parent, numContexts) { }
public TreeNode GenerateNode(PropHeader p) { string s = p.offset.ToString("X4") + ": "; s += "Name: \"" + pcc.getNameEntry(p.name) + "\" "; s += "Type: \"" + pcc.getNameEntry(p.type) + "\" "; s += "Size: " + p.size.ToString() + " Value: "; nodeType propertyType = getType(pcc.getNameEntry(p.type)); int idx; byte val; switch (propertyType) { case nodeType.IntProperty: idx = BitConverter.ToInt32(memory, p.offset + 24); s += idx.ToString(); break; case nodeType.ObjectProperty: idx = BitConverter.ToInt32(memory, p.offset + 24); s += idx.ToString() + " (" + pcc.getObjectName(idx) + ")"; break; case nodeType.StrProperty: int count = BitConverter.ToInt32(memory, p.offset + 24); s += "\""; for (int i = 0; i < count * -1 - 1; i++) { s += (char)memory[p.offset + 28 + i * 2]; } s += "\""; break; case nodeType.BoolProperty: val = memory[p.offset + 24]; s += (val == 1).ToString(); break; case nodeType.FloatProperty: float f = BitConverter.ToSingle(memory, p.offset + 24); s += f.ToString("0.0######"); break; case nodeType.NameProperty: idx = BitConverter.ToInt32(memory, p.offset + 24); s += "\"" + pcc.getNameEntry(idx) + "\"_" + BitConverter.ToInt32(memory, p.offset + 28); break; case nodeType.StructProperty: idx = BitConverter.ToInt32(memory, p.offset + 24); s += "\"" + pcc.getNameEntry(idx) + "\""; break; case nodeType.ByteProperty: if (p.size == 1) { val = memory[p.offset + 32]; s += val.ToString(); } else { idx = BitConverter.ToInt32(memory, p.offset + 24); int idx2 = BitConverter.ToInt32(memory, p.offset + 32); s += "\"" + pcc.getNameEntry(idx) + "\",\"" + pcc.getNameEntry(idx2) + "\""; } break; case nodeType.ArrayProperty: idx = BitConverter.ToInt32(memory, p.offset + 24); s += idx.ToString() + "(count)"; break; case nodeType.StringRefProperty: idx = BitConverter.ToInt32(memory, p.offset + 24); s += "#" + idx.ToString() + ": "; s += TalkFiles.tlkList.Count == 0 ? "(.tlk not loaded)" : TalkFiles.findDataById(idx); break; } TreeNode ret = new TreeNode(s); ret.Tag = propertyType; ret.Name = p.offset.ToString(); return(ret); }
public void GenerateTree(TreeNode localRoot, List <PropHeader> headersList) { foreach (PropHeader header in headersList) { if (readerpos > memory.Length) { throw new IndexOutOfRangeException(": tried to read past bounds of Export Data"); } nodeType type = getType(pcc.getNameEntry(header.type)); if (type != nodeType.ArrayProperty && type != nodeType.StructProperty) { localRoot.Nodes.Add(GenerateNode(header)); } else { if (type == nodeType.ArrayProperty) { TreeNode t = GenerateNode(header); int arrayLength = BitConverter.ToInt32(memory, header.offset + 24); readerpos = header.offset + 28; int tmp = readerpos; UnrealObjectInfo.ArrayType arrayType; try { arrayType = UnrealObjectInfo.getArrayType(className, pcc.getNameEntry(header.name)); } catch (Exception) { arrayType = UnrealObjectInfo.ArrayType.Int; } if (arrayType == UnrealObjectInfo.ArrayType.Struct) { UnrealObjectInfo.PropertyInfo info = UnrealObjectInfo.getPropertyInfo(className, pcc.getNameEntry(header.name)); t.Text = t.Text.Insert(t.Text.IndexOf("Size: ") - 2, $"({info.reference})"); for (int i = 0; i < arrayLength; i++) { readerpos = tmp; int pos = tmp; List <PropHeader> arrayListPropHeaders = ReadHeadersTillNone(); tmp = readerpos; TreeNode n = new TreeNode(i.ToString()); n.Tag = nodeType.ArrayLeafStruct; n.Name = (-pos).ToString(); t.Nodes.Add(n); n = t.LastNode; if (info != null && (UnrealObjectInfo.isImmutable(info.reference) || arrayListPropHeaders.Count == 0)) { readerpos = pos; GenerateSpecialStruct(n, info.reference, header.size / arrayLength); tmp = readerpos; } else if (arrayListPropHeaders.Count > 0) { GenerateTree(n, arrayListPropHeaders); } else { throw new Exception($"at position {readerpos.ToString("X4")}. Could not read element {i} of ArrayProperty {pcc.getNameEntry(header.name)}"); } t.LastNode.Remove(); t.Nodes.Add(n); } localRoot.Nodes.Add(t); } else { t.Text = t.Text.Insert(t.Text.IndexOf("Size: ") - 2, $"({arrayType.ToString()})"); int count = 0; int pos; for (int i = 0; i < (header.size - 4); count++) { pos = header.offset + 28 + i; if (pos > memory.Length) { throw new Exception(": tried to read past bounds of Export Data"); } int val = BitConverter.ToInt32(memory, pos); string s = pos.ToString("X4") + "|" + count + ": "; TreeNode node = new TreeNode(); node.Name = pos.ToString(); if (arrayType == UnrealObjectInfo.ArrayType.Object) { node.Tag = nodeType.ArrayLeafObject; int value = val; if (value == 0) { //invalid s += "Null [" + value + "] "; } else { bool isImport = value < 0; if (isImport) { value = -value; } value--; //0-indexed if (isImport) { if (pcc.Imports.Count > value) { s += pcc.Imports[value].PackageFullName + "." + pcc.Imports[value].ObjectName + " [IMPORT " + value + "]"; } else { s += "Index not in import list [" + value + "]"; } } else { if (pcc.Exports.Count > value) { s += pcc.Exports[value].PackageFullName + "." + pcc.Exports[value].ObjectName + " [EXPORT " + value + "]"; } else { s += "Index not in export list [" + value + "]"; } } } i += 4; } else if (arrayType == UnrealObjectInfo.ArrayType.Name || arrayType == UnrealObjectInfo.ArrayType.Enum) { node.Tag = arrayType == UnrealObjectInfo.ArrayType.Name ? nodeType.ArrayLeafName : nodeType.ArrayLeafEnum; int value = val; if (value < 0) { s += "Invalid Name Index [" + value + "]"; } else { if (pcc.Names.Count > value) { s += $"\"{pcc.Names[value]}\"_{BitConverter.ToInt32(memory, pos + 4)}[NAMEINDEX {value}]"; } else { s += "Index not in name list [" + value + "]"; } } i += 8; } else if (arrayType == UnrealObjectInfo.ArrayType.Float) { node.Tag = nodeType.ArrayLeafFloat; s += BitConverter.ToSingle(memory, pos).ToString("0.0######"); i += 4; } else if (arrayType == UnrealObjectInfo.ArrayType.Byte) { node.Tag = nodeType.ArrayLeafByte; s += "(byte)" + memory[pos]; i += 1; } else if (arrayType == UnrealObjectInfo.ArrayType.Bool) { node.Tag = nodeType.ArrayLeafBool; s += BitConverter.ToBoolean(memory, pos); i += 1; } else if (arrayType == UnrealObjectInfo.ArrayType.String) { node.Tag = nodeType.ArrayLeafString; int sPos = pos + 4; s += "\""; int len = val > 0 ? val : -val; for (int j = 1; j < len; j++) { s += BitConverter.ToChar(memory, sPos); sPos += 2; } s += "\""; i += (len * 2) + 4; } else { node.Tag = nodeType.ArrayLeafInt; s += val.ToString(); i += 4; } node.Text = s; t.Nodes.Add(node); } localRoot.Nodes.Add(t); } } if (type == nodeType.StructProperty) { TreeNode t = GenerateNode(header); readerpos = header.offset + 32; List <PropHeader> ll = ReadHeadersTillNone(); if (ll.Count != 0) { GenerateTree(t, ll); } else { string structType = pcc.getNameEntry(BitConverter.ToInt32(memory, header.offset + 24)); GenerateSpecialStruct(t, structType, header.size); } localRoot.Nodes.Add(t); } } } }
private bool isArrayLeaf(nodeType type) { return(type == nodeType.ArrayLeafBool || type == nodeType.ArrayLeafEnum || type == nodeType.ArrayLeafFloat || type == nodeType.ArrayLeafInt || type == nodeType.ArrayLeafName || type == nodeType.ArrayLeafObject || type == nodeType.ArrayLeafString || type == nodeType.ArrayLeafStruct || type == nodeType.ArrayLeafByte); }
public CASTIDENTIFIER(string idText, nodeType type, ASTElement parent, int numContexts) : base(idText, type, parent, numContexts) { m_nodeName = GenerateNodeName(); }
public Node(Vector3 mapPos, nodeType thisNodeType) { mapPosition = mapPos; type = thisNodeType; }
protected ASTTerminal(nodeType type, ASTElement parent) : base(type, parent) { }
//构建节点——圆心x坐标,圆心y坐标,圆的半径 public void buildnode(int _x, int _y, int _r, nodeType _type) { this.Size = new Size(nodePictureR * 2 + 1, nodePictureR * 2 + 1); this.ClientSize = new Size(nodePictureR * 2 - 1, nodePictureR * 2 - 1); changelocation(_x, _y); this.r = _r; this.type = _type; }
{ public CASTNUMBER(nodeType type, ASTElement parent, int numContexts) : base(type, parent, numContexts) { }
public CASTIDENTIFIER(nodeType type, ASTElement parent, int numContexts) : base(type, parent, numContexts) { }
//复制一个_tempnode节点的复件 public node(node _tempnode) { list_neighbour = _tempnode.list_neighbour; list_anchor = _tempnode.list_anchor; this.BackColor = _tempnode.BackColor; this.Location = _tempnode.Location; this.Size = _tempnode.Size; this.ClientSize = _tempnode.ClientSize; this.r = _tempnode.r; this.type = _tempnode.type; timer_changenodeposition = new Timer(); }
protected ASTComposite(nodeType type, ASTElement parent, int numContexts) : base(type, parent) { m_children = new List <ASTElement> [numContexts]; }
public CASTDivision(nodeType type, ASTElement parent, int numContexts) : base(type, parent, numContexts) { }
public node(int x, int y, int width, int height, nodeType type) { X = x; Y = y; Width = width; Height = height; Type = type; }
public CASTAssignment(nodeType type, ASTElement parent, int numContexts) : base(type, parent, numContexts) { }
protected ASTTerminal(string text, nodeType type, ASTElement parent) : base(text, type, parent) { }
public CASTCompileUnit(nodeType type, ASTElement parent, int numContexts) : base(type, parent, numContexts) { }
public CASTSubtraction(nodeType type, ASTElement parent, int numContexts) : base(type, parent, numContexts) { }
public node() { this.subscribersField = new ObservableCollection<socket>(); this.publishersField = new ObservableCollection<socket>(); this.parametersField = new ObservableCollection<param_type>(); this.processField = new process(); this.typeField = nodeType.misc; }