public static FieldNode Read(byte[] bytes) { FieldNode node = new FieldNode(0, null); ByteBuffer bfs = new ByteBuffer(bytes); node.Access = (AccessMode)bfs.ReadByte(); node.Domain = (DomainMode)bfs.ReadByte(); node.OutRect = AccessRect.Read(bfs.ReadBytes()); node.OutRect.Target = node; node.InRect = AccessRect.Read(bfs.ReadBytes()); node.InRect.Target = node; node.Type = bfs.ReadByte(); node.Name = bfs.ReadString(); node.Value = bfs.ReadString(); node.Index = bfs.ReadByte(); node.HashID = bfs.ReadInt32(); if (bfs.ReadBool()) { node.PrevHashID = bfs.ReadInt32(); } if (bfs.ReadBool()) { node.NextHashID = bfs.ReadInt32(); } return(node); }
public static byte[] Write(FieldNode node) { ByteBuffer bfs = new ByteBuffer(); bfs.WriteByte((byte)node.Access); bfs.WriteByte((byte)node.Domain); bfs.WriteBytes(AccessRect.Write(node.OutRect)); bfs.WriteBytes(AccessRect.Write(node.InRect)); bfs.WriteByte((byte)node.Type); bfs.WriteString(node.Name); bfs.WriteString(node.Value); bfs.WriteByte((byte)node.Index); bfs.WriteInt32(node.HashID); if (node.GetPrev() != null) { bfs.WriteBool(true); bfs.WriteInt32(((FieldNode)node.GetPrev()).HashID); } else { bfs.WriteBool(false); } if (node.GetNext() != null) { bfs.WriteBool(true); bfs.WriteInt32(((FieldNode)node.GetNext()).HashID); } else { bfs.WriteBool(false); } return(bfs.Getbuffer()); }
public static byte[] Write(AccessRect access) { ByteBuffer bfs = new ByteBuffer(); bfs.WriteFloat(access.Rect.x); bfs.WriteFloat(access.Rect.y); bfs.WriteFloat(access.Rect.width); bfs.WriteFloat(access.Rect.height); bfs.WriteByte((byte)access.State); bfs.WriteBool(access.Enable); bfs.WriteByte((byte)access.Type); bfs.WriteInt32(access.HashID); return(bfs.Getbuffer()); }
public static AccessRect Read(byte[] bytes) { AccessRect data = new AccessRect(); ByteBuffer bfs = new ByteBuffer(bytes); data.Rect.x = bfs.ReadFloat(); data.Rect.y = bfs.ReadFloat(); data.Rect.width = bfs.ReadFloat(); data.Rect.height = bfs.ReadFloat(); data.State = bfs.ReadByte(); data.Enable = bfs.ReadBool(); data.Type = (RectType)bfs.ReadByte(); data.HashID = bfs.ReadInt32(); return(data); }
public static FlowNode Read(byte[] bytes) { FlowNode node = new FlowNode(null); ByteBuffer bfs = new ByteBuffer(bytes); node.Access = (AccessMode)bfs.ReadByte(); node.Domain = (DomainMode)bfs.ReadByte(); node.OutRect = AccessRect.Read(bfs.ReadBytes()); node.OutRect.Target = node; node.InRect = AccessRect.Read(bfs.ReadBytes()); node.InRect.Target = node; node.HashID = bfs.ReadInt32(); if (bfs.ReadBool()) { node.PrevHashID = bfs.ReadInt32(); } if (bfs.ReadBool()) { node.NextHashID = bfs.ReadInt32(); } return(node); }