void ProcessMsg1(int eventId, ZMsg msg) { if (eventId == 1) { Msg1 m = msg == null ? new Msg1() : msg as Msg1; print(m.content); } }
public static Flw0 FromPtr(byte *ptr) { Header *header = (Header *)ptr; if (header->tag != 0x30574C46) // FLW0 { throw new FormatException("Data could not be wrapped with Flw0 class."); } Flw0 result = new Flw0(); SectionEntry *sections = (SectionEntry *)(ptr + Header.SIZE); TrackLabel * trackLabels = (TrackLabel *)(ptr + sections[0].offset); TrackLabel * gotoLabels = (TrackLabel *)(ptr + sections[1].offset); int * trackData = (int *)(ptr + sections[2].offset); byte * msg1Data = (ptr + sections[3].offset); byte * padData = (ptr + sections[4].offset); for (int i = 0; i < sections[0].elementCount; i++) { FlowTrack track = new FlowTrack(); track.Name = new string((sbyte *)trackLabels[i].name); int index = trackLabels[i].dataIndex; track.Data.Add(trackData[index]); while (trackData[index] != 0x9 && (index + 1) < sections[2].elementCount) { track.Data.Add(trackData[++index]); } result._Tracks.Add(track); int startIndex = trackLabels[i].dataIndex; int endIndex = trackLabels[i].dataIndex + track.Data.Count; for (int j = 0; j < sections[1].elementCount; j++) { if (gotoLabels[j].dataIndex >= startIndex && gotoLabels[j].dataIndex < endIndex) { string name = new string((sbyte *)gotoLabels[j].name); int trackIndex = gotoLabels[j].dataIndex - startIndex; track.Labels.Add(new KeyValuePair <string, int>(name, trackIndex)); } } } if (sections[3].elementCount > 0) { result._Msg1 = Msg1.FromPtr(msg1Data); } result._PadData = new byte[sections[4].elementCount]; for (int i = 0; i < result._PadData.Length; i++) { result._PadData[i] = padData[i]; } return(result); }
public Msg1Node(Msg1 data) : base("Msg0") { _Data = data; foreach (MessageData message in _Data.Messages.Where(x => x != null)) { Nodes.Add(new MessageNode(message)); } }
public Flw0() { _Tracks = new List <FlowTrack>(); _Msg1 = new Msg1(); _PadData = new byte[0xF0]; }
public void OnMsg1(Msg1 msg) { MessageBox.Show(msg.ID); }