public override IDataProvider GetData(string Code, int Count) { CommonDataProvider cdp = new CommonDataProvider(this); string s = LookupDataFile(Code, cdp, ref Fields); if (s != "" && File.Exists(s)) { using (FileStream fs = ReadData(s)) { byte[] bb = new byte[Fields * 4]; byte[] bs = new byte[fs.Length - bb.Length]; fs.Read(bb, 0, bb.Length); fs.Read(bs, 0, bs.Length); float[] ff = new float[bs.Length / 4]; Buffer.BlockCopy(bs, 0, ff, 0, bs.Length); fmsbin2ieee(ff); int N = ff.Length / Fields; double[] Date = new double[N]; double[] Open = new double[N]; double[] High = new double[N]; double[] Low = new double[N]; double[] Close = new double[N]; double[] Volume = new double[N]; double[] OpenInt = new double[N]; if (Fields == 5) { Open = Close; OpenInt = Close; } for (int i = 0; i < N; i++) { int D = (int)ff[i * Fields]; DateTime DD = new DateTime(D / 10000 + 1900, (D / 100) % 100, D % 100); int j = 0; if (Fields == 8) { int T = (int)ff[i * Fields + 1]; DD += new TimeSpan(T / 10000, (T / 100) % 100, T % 100); j = 1; } Date[i] = DD.ToOADate(); if (Fields >= 7) { Open[i] = ff[i * Fields + 1 + j]; High[i] = ff[i * Fields + 2 + j]; Low[i] = ff[i * Fields + 3 + j]; Close[i] = ff[i * Fields + 4 + j]; Volume[i] = ff[i * Fields + 5 + j]; OpenInt[i] = Close[i]; } else { High[i] = ff[i * Fields + 1]; Low[i] = ff[i * Fields + 2]; Close[i] = ff[i * Fields + 3]; Volume[i] = ff[i * Fields + 4]; } } cdp.LoadBinary(new double[][] { Open, High, Low, Close, Volume, Date, OpenInt }); return(cdp); } } else { cdp.LoadByteBinary(new byte[] {}); } return(cdp); }