コード例 #1
0
        public static CancelOrderResponse ReadFromBuffer(MessageHeader frame, ByteBuffer buf, int offset = 0)
        {
            if (buf.length - offset < StructSize)
            {
                return(null);
            }

            var resp = new CancelOrderResponse();

            resp.OriginRequest = CancelOrderRequest.ReadFromBuffer(buf, offset);
            if (resp.OriginRequest == null)
            {
                return(null);
            }
            offset += CancelOrderRequest.StructSize;

            resp.InputTime = BitConverter.ToUInt64(buf.data, offset);
            offset        += PropInfo.GetSize(resp, o => o.InputTime);

            resp.OutputTime = BitConverter.ToUInt64(buf.data, offset);
            offset         += PropInfo.GetSize(resp, o => o.OutputTime);

            resp.SystemTime = BitConverter.ToUInt64(buf.data, offset);
            offset         += PropInfo.GetSize(resp, o => o.SystemTime);

            resp.AmountCancelled = BitConverter.ToInt32(buf.data, offset);
            offset += PropInfo.GetSize(resp, o => o.AmountCancelled);

            resp.AmountRest = BitConverter.ToInt32(buf.data, offset);
            offset         += PropInfo.GetSize(resp, o => o.AmountRest);

            resp.CancelReason = (CancelReason)buf.data[offset++];
            return(resp);
        }
コード例 #2
0
        static CancelOrderResponse()
        {
            CancelOrderResponse r = null;

            StructSize = CancelOrderRequest.StructSize +
                         PropInfo.GetSize(r, o => o.InputTime) +
                         PropInfo.GetSize(r, o => o.OutputTime) +
                         PropInfo.GetSize(r, o => o.SystemTime) +
                         PropInfo.GetSize(r, o => o.AmountCancelled) +
                         PropInfo.GetSize(r, o => o.AmountRest) +
                         1; // CancelReason
        }