示例#1
0
        //按类型添加文件
        private void AddDataByType(FileInfo fileInfo)
        {
            if (fileInfo.Extension == ".jpg")
            {
                CaptureImgData imgData = new CaptureImgData();
                imgData.fileInfo = fileInfo;

                byte[] allBytes = ImageExtensions.GetAllByteData(fileInfo.FullName);
                imgData.imgByteData = allBytes;

                SScreenShotImgInfo imgInfo = new SScreenShotImgInfo();
                imgInfo = ImageExtensions.GetCustomData <SScreenShotImgInfo>(allBytes);

                if (imgInfo.nHeroID < 0 || imgInfo.nDBWarID < 0)
                {
                    return;
                }

                imgData.imgInfo = imgInfo;

                string createTime = fileInfo.CreationTime.ToString("yyyy-MM-dd");

                if (!m_ImageFileTable.ContainsKey(createTime))
                {
                    m_ImageFileTable.Add(createTime, new List <CaptureImgData>());
                }
                m_ImageFileTable[createTime].Add(imgData);

                if (imgInfo.nDBWarID > 0)
                {
                    if (!m_DBWarIDList.Contains(imgInfo.nDBWarID))
                    {
                        m_DBWarIDList.Add(imgInfo.nDBWarID);
                    }
                }
            }
            else if (fileInfo.Extension == ".mp4" || fileInfo.Extension == ".avi")
            {
                CaptureVideoData videoData;

                if (!CheckVideo(fileInfo, out videoData))
                {
                    return;
                }

                string createTime = fileInfo.CreationTime.ToString("yyyy-MM-dd");

                if (!m_VideoFileTable.ContainsKey(createTime))
                {
                    m_VideoFileTable.Add(createTime, new List <CaptureVideoData>());
                }
                m_VideoFileTable[createTime].Add(videoData);
            }
        }