public byte[] Pack() { stream = new MemoryStream(); if (transport == null) { transport = new TStreamTransport(null, stream); } else { transport.OutputStream = stream; } if (protocol == null) { protocol = new TCompactProtocol(transport); } else { protocol.reset(); protocol.Transport = transport; } protocol.WriteStructBegin(struc); fieldWriter.Name = "context"; fieldWriter.Type = TType.Map; fieldWriter.ID = 1; protocol.WriteFieldBegin(fieldWriter); { protocol.WriteMapBegin(new TMap(TType.String, TType.Struct, context.Count)); foreach (string _iter44 in context.Keys) { protocol.WriteString(_iter44); context[_iter44].Write(fieldWriter, protocol); } protocol.WriteMapEnd(); } protocol.WriteFieldEnd(); fieldWriter.Name = "events"; fieldWriter.Type = TType.Map; fieldWriter.ID = 2; protocol.WriteFieldBegin(fieldWriter); { protocol.WriteMapBegin(new TMap(TType.String, TType.Struct, events.Count)); foreach (string _iter44 in events.Keys) { protocol.WriteString(_iter44); events[_iter44].Write(fieldWriter, protocol); } protocol.WriteMapEnd(); } protocol.WriteFieldEnd(); protocol.WriteFieldStop(); protocol.WriteStructEnd(); return(stream.ToArray()); }
public void Write(TField writer, TCompactProtocol protocol) { protocol.WriteStructBegin(new TStruct(GetType().ToString())); writer.Name = "type"; writer.Type = TType.String; writer.ID = 1; protocol.WriteFieldBegin(writer); protocol.WriteString(type); protocol.WriteFieldEnd(); WriteFields(writer, protocol); protocol.WriteFieldStop(); protocol.WriteStructEnd(); }
public void Write(TField writer, TCompactProtocol protocol) { protocol.WriteStructBegin(struc); writer.Name = "properties"; writer.Type = TType.Map; writer.ID = 1; protocol.WriteFieldBegin(writer); { protocol.WriteMapBegin(new TMap(TType.String, TType.Struct, properties.Count)); foreach (string _iter44 in properties.Keys) { protocol.WriteString(_iter44); properties[_iter44].Write(writer, protocol); } protocol.WriteMapEnd(); } protocol.WriteFieldEnd(); protocol.WriteFieldStop(); protocol.WriteStructEnd(); }