Пример #1
0
        private IDictionary <int, byte[]> GetImages(DataType dt, int second)
        {
            try
            {
                IDictionary <int, byte[]> ret = new Dictionary <int, byte[]>();

                if (screenIndexList == null)
                {
                    if (colhelperScreenImage == null)
                    {
                        colhelperScreenImage = GetCOLFilerHelper(dt);
                    }
                    screenIndexList = colhelperScreenImage.GetIndexList();
                }

                List <Index> screenImageIndexs = screenIndexList.GetImageIndexBySecond(second);

                foreach (Index index in screenImageIndexs)
                {
                    byte[] buf = colhelperScreenImage.SeekData(index.DataOffset, (int)index.DataLength);
                    ret.Add(new KeyValuePair <int, byte[]>((index.Row * Constants.MAX_ROW_NO + index.Col), buf));
                }

                return(ret);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
            }
        }
Пример #2
0
        List <T> GetDataList <T>(COLFilerHelper colhelper, List <Index> indexlist, IDictionary <int, int> mapindex, int streamSize, TimeSpan tspan)
        {
            List <T> result = new List <T>();

            Index indeximage = null;

            if (mapindex.ContainsKey((int)tspan.TotalMinutes))
            {
                indeximage = indexlist[mapindex[(int)tspan.TotalMinutes]];
            }
            try
            {
                if (indeximage != null && indeximage.DataLength > 0)
                {
                    byte[] buf = colhelper.SeekData(indeximage.DataOffset, (int)indeximage.DataLength);
                    if (buf.Length == indeximage.DataLength)
                    {
                        result = Read <T>(streamSize, buf);
                    }
                }
            }
            catch (Exception e)
            {
            }

            return(result);
        }