public static XRSHDOutBlock FromQuery(XRSHD query) { XRSHDOutBlock block = new XRSHDOutBlock(); block.IsValidData = true; block.InvalidReason = ""; try { block.sijanggubun = query.GetFieldData(block.GetBlockName(), "sijanggubun").FirstOrDefault(); // char 1 block.hname = query.GetFieldData(block.GetBlockName(), "hname").TrimEnd('?'); // char 20 block.price = query.GetFieldData(block.GetBlockName(), "price").ParseLong("price"); // long 8 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.volume = query.GetFieldData(block.GetBlockName(), "volume").ParseLong("volume"); // long 12 block.volincrate = query.GetFieldData(block.GetBlockName(), "volincrate").ParseFloat("volincrate"); // float 12.2 block.updnlmtprice = query.GetFieldData(block.GetBlockName(), "updnlmtprice").ParseLong("updnlmtprice"); // long 8 block.updnlmtdrate = query.GetFieldData(block.GetBlockName(), "updnlmtdrate").ParseFloat("updnlmtdrate"); // float 6.2 block.jnilvolume = query.GetFieldData(block.GetBlockName(), "jnilvolume").ParseLong("jnilvolume"); // long 12 block.shcode = query.GetFieldData(block.GetBlockName(), "shcode").TrimEnd('?'); // char 6 block.gwangubun = query.GetFieldData(block.GetBlockName(), "gwangubun").FirstOrDefault(); // char 1 block.undergubun = query.GetFieldData(block.GetBlockName(), "undergubun").FirstOrDefault(); // char 1 block.tgubun = query.GetFieldData(block.GetBlockName(), "tgubun").FirstOrDefault(); // char 1 block.wgubun = query.GetFieldData(block.GetBlockName(), "wgubun").FirstOrDefault(); // char 1 block.dishonest = query.GetFieldData(block.GetBlockName(), "dishonest").FirstOrDefault(); // char 1 block.jkrate = query.GetFieldData(block.GetBlockName(), "jkrate").FirstOrDefault(); // char 1 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public XRSHDOutBlock GetBlock() { XRSHDOutBlock instance = XRSHDOutBlock.FromQuery(this); return(instance); }