Esempio n. 1
0
		public int Push(ScriptNode[] _nodes)
		{
			int count = 0;
			while (count++ < _nodes.Length)
				nodes.Push(_nodes[count]);

			return nodes.Count - _nodes.Length;
		}
Esempio n. 2
0
		public static ScriptNode[] FromBlock(TagInterface.IBlock block)
		{
			TagInterface.IElementArray ea = block.GetElements();
			ScriptNode[] value = new ScriptNode[ea.Count];
			for (int x = 0; x < value.Length; x++)
			{
				var hs = (hs_syntax_datum_block)ea.GetElement(x);
				var v = value[x] = new ScriptNode();
				v.nodeIndex = x;
				v.index = (short)hs.DatumHeader.Value;
				v.opcode = (short)hs.TypeUnion.Value;
				v.type = (short)hs.Type.Value;
				v.pointerType = (short)hs.Flags.Value;
				v.nextExpression = hs.NextNodeIndex.Value;
				v.pointer = hs.Pointer.Value;
				int temp = hs.Data.Value;
				v.data[0] = (byte)(temp & 0x000000FF);
				v.data[1] = (byte)(temp & 0x0000FF00);
				v.data[2] = (byte)(temp & 0x00FF0000);
				v.data[3] = (byte)(temp & 0xFF000000);
			}

			return value;
		}
Esempio n. 3
0
		public int Push(ScriptNode node)
		{
			nodes.Push(node);
			return nodes.Count - 1;
		}
Esempio n. 4
0
		public static ScriptNode[] FromData(TagInterface.Data data)
		{
			int position = 56;
			int node_count = BitConverter.ToInt16(data.Value, 46);

			ScriptNode[] value = new ScriptNode[node_count]; // element count
			System.Diagnostics.Debug.WriteLine("node count: " + node_count);
			for (int x = 0; x < node_count; x++, position += 0x14)
			{
				var v = value[x] = new ScriptNode();
				v.nodeIndex = x;
				v.index = BitConverter.ToInt16(data.Value, position + OffsetIndex); //position += 2;
				v.opcode = BitConverter.ToInt16(data.Value, position + OffsetOpcode); //position += 2;
				v.type = BitConverter.ToInt16(data.Value, position + OffsetType); //position += 2;
				v.pointerType = BitConverter.ToInt16(data.Value, position + OffsetPointerType); //position += 2;
				// TODO: change this to ToInt32 to make it big endian compatible
				v.nextExpression.Index = BitConverter.ToUInt16(data.Value, position + OffsetNextExp); //position += 2;
				v.nextExpression.Salt = BitConverter.ToInt16(data.Value, position + OffsetNextExp + 2); //position += 2;
				v.pointer = BitConverter.ToInt32(data.Value, position + OffsetPointer); //position += 4;
				v.data[0] = data.Value[position + OffsetData]; //position += 1;
				v.data[1] = data.Value[position + OffsetData + 1]; //position += 1;
				v.data[2] = data.Value[position + OffsetData + 2]; //position += 1;
				v.data[3] = data.Value[position + OffsetData + 3]; //position += 1;
			}

			return value;
		}