Example #1
0
        private byte[] MergeOneQuote(byte[] bs, DataPackage dp)
        {
            float[] fs = new float[bs.Length / 4 + 7];
            System.Buffer.BlockCopy(bs, 0, fs, 0, bs.Length);
            DateTime d2    = DateTime.FromOADate(dp.DATE);
            int      Count = fs.Length / 7 - 1;

            for (int i = Count - 1; i >= -1; i--)
            {
                DateTime d1 = DateTime.MinValue;
                if (i > -1)
                {
                    d1 = DateTime.FromOADate(fs[i * 7]);
                }

                if (d1 <= d2)
                {
                    if (d1 < d2)
                    {
                        if (i < Count - 1 && Count > 0)
                        {
                            System.Buffer.BlockCopy(fs, (i + 1) * 7 * 4, fs, (i + 2) * 7 * 4, (Count - i - 1) * 7 * 4);
                        }
                        float[] fsCurrent = dp.GetFloat();
                        System.Buffer.BlockCopy(fsCurrent, 0, fs, (i + 1) * 7 * 4, 7 * 4);
                        bs = new byte[fs.Length * 4];
                        System.Buffer.BlockCopy(fs, 0, bs, 0, fs.Length * 4);
                    }
                    return(bs);
                }
                ;
            }
            return(bs);
        }