public static XRYJ_OutBlock FromQuery(XRYJ_ query) { XRYJ_OutBlock block = new XRYJ_OutBlock(); block.IsValidData = true; block.InvalidReason = ""; try { block.time = query.GetFieldData(block.GetBlockName(), "time").TrimEnd('?'); // char 6 block.jisu = query.GetFieldData(block.GetBlockName(), "jisu").ParseFloat("jisu"); // float 8.2 block.sign = query.GetFieldData(block.GetBlockName(), "sign").FirstOrDefault(); // char 1 block.change = query.GetFieldData(block.GetBlockName(), "change").ParseFloat("change"); // float 8.2 block.drate = query.GetFieldData(block.GetBlockName(), "drate").ParseFloat("drate"); // float 6.2 block.cvolume = query.GetFieldData(block.GetBlockName(), "cvolume").ParseLong("cvolume"); // long 8 block.volume = query.GetFieldData(block.GetBlockName(), "volume").ParseLong("volume"); // long 8 block.value = query.GetFieldData(block.GetBlockName(), "value").ParseLong("value"); // long 8 block.upcode = query.GetFieldData(block.GetBlockName(), "upcode").TrimEnd('?'); // char 3 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public XRYJ_OutBlock GetBlock() { XRYJ_OutBlock instance = XRYJ_OutBlock.FromQuery(this); return(instance); }