public static XRS4_OutBlock FromQuery(XRS4_ query) { XRS4_OutBlock block = new XRS4_OutBlock(); block.IsValidData = true; block.InvalidReason = ""; try { block.sign = query.GetFieldData(block.GetBlockName(), "sign").FirstOrDefault(); // char 1 block.change = query.GetFieldData(block.GetBlockName(), "change").ParseLong("change"); // long 8 block.drate = query.GetFieldData(block.GetBlockName(), "drate").ParseFloat("drate"); // float 6.2 block.price = query.GetFieldData(block.GetBlockName(), "price").ParseLong("price"); // long 8 block.opentime = query.GetFieldData(block.GetBlockName(), "opentime").TrimEnd('?'); // char 6 block.open = query.GetFieldData(block.GetBlockName(), "open").ParseLong("open"); // long 8 block.hightime = query.GetFieldData(block.GetBlockName(), "hightime").TrimEnd('?'); // char 6 block.high = query.GetFieldData(block.GetBlockName(), "high").ParseLong("high"); // long 8 block.lowtime = query.GetFieldData(block.GetBlockName(), "lowtime").TrimEnd('?'); // char 6 block.low = query.GetFieldData(block.GetBlockName(), "low").ParseLong("low"); // long 8 block.shcode = query.GetFieldData(block.GetBlockName(), "shcode").TrimEnd('?'); // char 6 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public XRS4_OutBlock GetBlock() { XRS4_OutBlock instance = XRS4_OutBlock.FromQuery(this); return(instance); }