public static int SetJson(this DealHeader thdr, Stream tostream) { BinaryWriter binwriter = new BinaryWriter(tostream); binwriter.Write(thdr.SetJsonString()); return((int)tostream.Length); }
public static int SetJson(this DealHeader thdr, IFigurePacket buffor, int offset = 0) { if (offset > 0) { byte[] jsonBytes = Encoding.UTF8.GetBytes(thdr.SetJsonString()); byte[] serialBytes = new byte[jsonBytes.Length + offset]; jsonBytes.CopyTo(serialBytes, offset); buffor.SerialPacket = serialBytes; jsonBytes = null; } else { buffor.SerialPacket = Encoding.UTF8.GetBytes(thdr.SetJsonString()); } return(buffor.SerialPacket.Length); }
public static int SetJson(this DealHeader thdr, StringBuilder stringbuilder) { stringbuilder.AppendLine(thdr.SetJsonString()); return(stringbuilder.Length); }