| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using Common;
- using MeterPlugInLibrary;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CarMeterSystem.OptionCls
- {
- /// <summary>
- /// 截图调用类
- /// </summary>
- public class CameraShotCls
- {
- public void Connection()
- {
- foreach (DhCameraShot shot in CarCache.cameraShots)
- {
- shot.Connection();
- }
- }
- public void Close()
- {
- foreach (DhCameraShot shot in CarCache.cameraShots)
- {
- shot.Close();
- }
- }
- /// <summary>
- /// 截图
- /// </summary>
- /// <param name="actualFirstNo">作业编号</param>
- public void CapPic(string actualFirstNo)
- {
- int iCnt = 1; //抓拍摄像头配置顺序必须是前面2个
- foreach (DhCameraShot shot in CarCache.cameraShots)
- {
- //放在tempImg文件夹下面就进行图片的压缩操作,否则不进行图片压缩
- //shot.CapPic(iCnt < 3 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\tempImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt));
- shot.CapPic(iCnt < 3 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt));
- iCnt++;
- }
- }
- /// <summary>
- /// 从硬盘录像机 进行截图
- /// </summary>
- /// <param name="actualFirstNo"></param>
- public void CapPicFromVideo(string actualFirstNo)
- {
- string fullfilename = Path.Combine(AppConfigCache.ftpPath, DateTime.Now.ToString("yyyy-MM-dd"));
- if (fullfilename.Substring(0, 8) == "https://")
- {
- fullfilename = fullfilename.Substring(0, 8) + fullfilename.Substring(8).Replace("//", "/").Replace("//", "/");
- }
- else if (fullfilename.Substring(0, 7) == "http://")
- {
- fullfilename = fullfilename.Substring(0, 7) + fullfilename.Substring(7).Replace("//", "/").Replace("//", "/");
- }
- else
- {
- fullfilename = fullfilename.Replace("//", "/").Replace("//", "/");
- }
- fullfilename = fullfilename.Replace("upload", "download");
- foreach (DhCameraShot shot in CarCache.cameraShots)
- {
- //放在tempImg文件夹下面就进行图片的压缩操作,否则不进行图片压缩
- //shot.CapPic(iCnt < 3 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\tempImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt));
- shot.CapPicFromVedio(PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo));
- PbCache.listImage[0].imageFile1 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "1.jpg";
- PbCache.listImage[0].imageFile2 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "2.jpg";
- PbCache.listImage[0].imageFile3 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "3.jpg";
- PbCache.listImage[0].imageFile4 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "4.jpg";
- PbCache.listImage[0].imageFile5 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "5.jpg";
- PbCache.listImage[0].imageFile6 = fullfilename + string.Format("/{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo) + "6.jpg";
- }
- }
- /// <summary>
- /// 连接视频截图并关闭
- /// </summary>
- /// <param name="actualFirstNo">作业编号</param>
- public void CapMethod(string actualFirstNo)
- {
- Connection();
- //CapPic(actualFirstNo);
- CapPicFromVideo(actualFirstNo);
- Close();
- }
- }
- }
|