private void OnRspMarketInfo(IntPtr pQuotApi, IntPtr pBuffer, ref MarketInfo pMarketInfo, int bLast) { IntPtr ptrHead = (IntPtr)(pBuffer + Marshal.SizeOf(typeof(MarketInfo))); for (int i = 0; i < pMarketInfo.stocknum; ++i) { IntPtr ptr = (IntPtr)(ptrHead + Marshal.SizeOf(typeof(StockInfo)) * i); StockInfo si = (StockInfo)Marshal.PtrToStructure(ptr, typeof(StockInfo)); _dictCode2Market[si.szCode] = pMarketInfo.Market; } }
private void OnRspMarketInfo(IntPtr pQuotApi, IntPtr pBuffer, ref MarketInfo pMarketInfo, int bLast) { IntPtr ptrHead = (IntPtr)(pBuffer + Marshal.SizeOf(typeof(MarketInfo))); for (int i = 0; i < pMarketInfo.stocknum; ++i) { IntPtr ptr = (IntPtr)(ptrHead + Marshal.SizeOf(typeof(StockInfo)) * i); StockInfo si = (StockInfo)Marshal.PtrToStructure(ptr, typeof(StockInfo)); StockInfoEx sie = new StockInfoEx() { stockinfo = si, market = pMarketInfo.Market, }; _dictInstruments[si.szCode] = sie; } ehlog.Info("接收到 {0} 信息包,{1}条",pMarketInfo.Market,pMarketInfo.stocknum); }