Ejemplo n.º 1
0
        private List <WBLine> GetWhiteBoardImage(DataType dt, int second)
        {
            try
            {
                if (wbImageIndexs == null)
                {
                    if (colhelperWbImage == null)
                    {
                        colhelperWbImage = GetCOLFilerHelper(dt, false);
                    }
                    IndexList list = colhelperWbImage.GetIndexList();
                    wbImageIndexs = list.GetIndexList();
                }
                IDictionary <int, int> mapIndex = GetIndexMapByMinute(wbImageIndexs);

                List <WBLine> lines = new List <WBLine>();

                TimeSpan tspan = TimeSpan.FromSeconds(second);

                lines = GetDataList <WBLine>(colhelperWbImage, wbImageIndexs, mapIndex, WBLine.StreamSize, tspan);

                return(lines);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
            }
        }
Ejemplo n.º 2
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
            {
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        private List <WBEvent> GetWhiteBoardSequence(DataType dt, int ts)
        {
            try
            {
                if (wbSequenceIndexs == null)
                {
                    if (colhelperWbSequence == null)
                    {
                        colhelperWbSequence = GetCOLFilerHelper(dt, true);
                    }
                    IndexList list = colhelperWbSequence.GetIndexList();
                    wbSequenceIndexs = list.GetIndexList();
                }

                IDictionary <int, int> mapIndex = GetIndexMapByMinute(wbSequenceIndexs);

                List <WBEvent> events = new List <WBEvent>();

                TimeSpan tspan = TimeSpan.FromSeconds(ts);
                events = GetDataList <WBEvent>(colhelperWbSequence, wbSequenceIndexs, mapIndex, WBEvent.StreamSize, tspan);

                return(events);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
            }
        }
Ejemplo n.º 5
0
        private COLFilerHelper GetCOLFilerHelper(DataType dt, bool wbseq)
        {
            string         indexFileName = "";
            string         dataFileName  = string.Empty;
            COLFilerHelper dataFile      = null;

            Utility.Root      = this.Root;
            Utility.LectureId = this.LectureId;
            Utility.Course    = this.Course;

            switch (dt)
            {
            case DataType.ScreenShot:
                indexFileName = Utility.GetFilePath(FileType.ScreenshotImageIndex);
                dataFileName  = Utility.GetFilePath(FileType.ScreenshotImageData);;
                break;

            case DataType.WB_1:
                if (!wbseq)
                {
                    indexFileName = Utility.GetFilePath(FileType.Whiteboard1ImageIndex);
                    dataFileName  = Utility.GetFilePath(FileType.Whiteboard1ImageData);;
                }
                else
                {
                    indexFileName = Utility.GetFilePath(FileType.Whiteboard1SequenceIndex);
                    dataFileName  = Utility.GetFilePath(FileType.Whiteboard1SequenceData);
                }
                break;

            case DataType.WB_2:
                if (!wbseq)
                {
                    indexFileName = Utility.GetFilePath(FileType.Whiteboard2ImageIndex);
                    dataFileName  = Utility.GetFilePath(FileType.Whiteboard2ImageData);;
                }
                else
                {
                    indexFileName = Utility.GetFilePath(FileType.Whiteboard2SequenceIndex);
                    dataFileName  = Utility.GetFilePath(FileType.Whiteboard2SequenceData);
                }
                break;

            default:
                break;
            }

            if (!String.IsNullOrEmpty(indexFileName) && !String.IsNullOrEmpty(dataFileName))
            {
                dataFile = new COLFilerHelper(indexFileName, dataFileName);
            }

            return(dataFile);
        }