public static XQt1486OutBlock1[] ListFromQuery(XQt1486 query) { int count = query.GetBlockCount(XQt1486OutBlock1.BlockName); List <XQt1486OutBlock1> list = new List <XQt1486OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1486OutBlock1 block = new XQt1486OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.chetime = query.GetFieldData(block.GetBlockName(), "chetime", i).TrimEnd('?'); // char 8 block.price = query.GetFieldData(block.GetBlockName(), "price", i).ParseLong("price"); // long 8 block.sign = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault(); // char 1 block.change = query.GetFieldData(block.GetBlockName(), "change", i).ParseLong("change"); // long 8 block.diff = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff"); // float 6.2 block.cvolume = query.GetFieldData(block.GetBlockName(), "cvolume", i).ParseLong("cvolume"); // long 12 block.offerho1 = query.GetFieldData(block.GetBlockName(), "offerho1", i).ParseLong("offerho1"); // long 8 block.bidho1 = query.GetFieldData(block.GetBlockName(), "bidho1", i).ParseLong("bidho1"); // long 8 block.offerrem1 = query.GetFieldData(block.GetBlockName(), "offerrem1", i).ParseLong("offerrem1"); // long 12 block.bidrem1 = query.GetFieldData(block.GetBlockName(), "bidrem1", i).ParseLong("bidrem1"); // long 12 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public XQt1486OutBlock1[] GetBlock1s() { XQt1486OutBlock1[] instance = XQt1486OutBlock1.ListFromQuery(this); return(instance); }