|
|
@@ -61,7 +61,7 @@ namespace CamTool
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- strImageDir = AppDomain.CurrentDomain.BaseDirectory + "\\image";
|
|
|
+ strImageDir = AppDomain.CurrentDomain.BaseDirectory + "image";
|
|
|
MyClass.Net_Init();
|
|
|
UsbSwitch.usb_relay_init();
|
|
|
if (!Directory.Exists(strImageDir))
|
|
|
@@ -173,7 +173,7 @@ namespace CamTool
|
|
|
{
|
|
|
if (tHandle == nCamIdIn || tHandle == nCamIdOut)
|
|
|
{
|
|
|
- string strTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss:fff");
|
|
|
+ string strTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd_HH_mm_ss_fff");
|
|
|
log.Info("检测到车牌信息\n");
|
|
|
//车辆图像
|
|
|
if (tImageInfo.ucViolateCode == 0)
|
|
|
@@ -258,29 +258,45 @@ namespace CamTool
|
|
|
string strImageFile1 = null;
|
|
|
if (tPicInfo.ptPanoramaPicBuff != IntPtr.Zero && tPicInfo.uiPanoramaPicLen != 0)
|
|
|
{
|
|
|
- byte[] BytePanoramaPicBuff = new byte[tPicInfo.uiPanoramaPicLen];
|
|
|
- Marshal.Copy(tPicInfo.ptPanoramaPicBuff, BytePanoramaPicBuff, 0, (int)tPicInfo.uiPanoramaPicLen);
|
|
|
- strImageFile1 = String.Format("{0}\\{1}.jpg", strImageDir, strTime);
|
|
|
- FileStream fs = new FileStream(strImageFile1, FileMode.Create, FileAccess.Write | FileAccess.Read, FileShare.None);
|
|
|
- fs.Write(BytePanoramaPicBuff, 0, (int)tPicInfo.uiPanoramaPicLen);
|
|
|
- //pictureBoxPlate.Image = Image.FromStream(fs);
|
|
|
- fs.Close();
|
|
|
- fs.Dispose();
|
|
|
- log.Info("图片1:" + strImageFile1);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ log.Info("图片1:" + strImageFile1);
|
|
|
+ byte[] BytePanoramaPicBuff = new byte[tPicInfo.uiPanoramaPicLen];
|
|
|
+ Marshal.Copy(tPicInfo.ptPanoramaPicBuff, BytePanoramaPicBuff, 0, (int)tPicInfo.uiPanoramaPicLen);
|
|
|
+ strImageFile1 = String.Format("{0}\\{1}.jpg", strImageDir, strTime);
|
|
|
+ FileStream fs = new FileStream(strImageFile1, FileMode.Create, FileAccess.Write | FileAccess.Read, FileShare.None);
|
|
|
+ fs.Write(BytePanoramaPicBuff, 0, (int)tPicInfo.uiPanoramaPicLen);
|
|
|
+ //pictureBoxPlate.Image = Image.FromStream(fs);
|
|
|
+ fs.Close();
|
|
|
+ fs.Dispose();
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ strImageFile1 = null;
|
|
|
+ log.Error("写入图片出错", e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string strImageFile2 = null;
|
|
|
if (tPicInfo.ptVehiclePicBuff != IntPtr.Zero && tPicInfo.uiVehiclePicLen != 0)
|
|
|
{
|
|
|
- byte[] ByteVehiclePicBuff = new byte[tPicInfo.uiVehiclePicLen];
|
|
|
- Marshal.Copy(tPicInfo.ptVehiclePicBuff, ByteVehiclePicBuff, 0, (int)tPicInfo.uiVehiclePicLen);
|
|
|
- strImageFile2 = String.Format("{0}\\{1}_plate.jpg", strImageDir, strTime);
|
|
|
- FileStream fs = new FileStream(strImageFile2, FileMode.Create, FileAccess.Write | FileAccess.Read, FileShare.None);
|
|
|
- fs.Write(ByteVehiclePicBuff, 0, (int)tPicInfo.uiVehiclePicLen);
|
|
|
- //pictureBoxPlateImage.Image = Image.FromStream(fs);
|
|
|
- fs.Close();
|
|
|
- fs.Dispose();
|
|
|
- log.Info("图片2:" + strImageFile2);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ log.Info("图片2:" + strImageFile2);
|
|
|
+ byte[] ByteVehiclePicBuff = new byte[tPicInfo.uiVehiclePicLen];
|
|
|
+ Marshal.Copy(tPicInfo.ptVehiclePicBuff, ByteVehiclePicBuff, 0, (int)tPicInfo.uiVehiclePicLen);
|
|
|
+ strImageFile2 = String.Format("{0}\\{1}_plate.jpg", strImageDir, strTime);
|
|
|
+ FileStream fs = new FileStream(strImageFile2, FileMode.Create, FileAccess.Write | FileAccess.Read, FileShare.None);
|
|
|
+ fs.Write(ByteVehiclePicBuff, 0, (int)tPicInfo.uiVehiclePicLen);
|
|
|
+ //pictureBoxPlateImage.Image = Image.FromStream(fs);
|
|
|
+ fs.Close();
|
|
|
+ fs.Dispose();
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ strImageFile2 = null;
|
|
|
+ log.Error("写入图片出错", e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|