예제 #1
0
파일: NWS.cs 프로젝트: iPeterPan/XingAPI
        public static XRNWSOutBlock FromQuery(XRNWS query)
        {
            XRNWSOutBlock block = new XRNWSOutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            try
            {
                block.date     = query.GetFieldData(block.GetBlockName(), "date").TrimEnd('?');              // char 8
                block.time     = query.GetFieldData(block.GetBlockName(), "time").TrimEnd('?');              // char 6
                block.id       = query.GetFieldData(block.GetBlockName(), "id").TrimEnd('?');                // char 2
                block.realkey  = query.GetFieldData(block.GetBlockName(), "realkey").TrimEnd('?');           // char 24
                block.title    = query.GetFieldData(block.GetBlockName(), "title").TrimEnd('?');             // char 300
                block.code     = query.GetFieldData(block.GetBlockName(), "code").TrimEnd('?');              // char 240
                block.bodysize = query.GetFieldData(block.GetBlockName(), "bodysize").ParseLong("bodysize"); // long 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
예제 #2
0
파일: NWS.cs 프로젝트: iPeterPan/XingAPI
        public XRNWSOutBlock GetBlock()
        {
            XRNWSOutBlock instance = XRNWSOutBlock.FromQuery(this);

            return(instance);
        }