diff --git a/CPF_Cef/Devices/LhtCF.cs b/CPF_Cef/Devices/LhtCF.cs
new file mode 100644
index 0000000..0f4dfd6
--- /dev/null
+++ b/CPF_Cef/Devices/LhtCF.cs
@@ -0,0 +1,159 @@
+using AKSWebBrowser.Commen;
+using CPF.Windows;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AksWebBrowser.Devices
+{
+ public class LhtCF
+ {
+ public LhtCF() { }
+
+ ///
+ /// 人脸比对
+ ///
+ ///
+ ///
+ public static string LhtCFFace(string code,string faceA)
+ {
+ string result = string.Empty;
+ try
+ {
+ int status = libLhtCFs.CF_Init();
+ Log.Info("初始化函数" + status);
+ if (status == 0)
+ {
+ status = libLhtCFs.CF_GetCameraStatus(0);
+ Log.Info("获取摄像头状态" + status);
+ if (status == 0)
+ {
+ status = libLhtCFs.CF_OpenCamera();
+ Log.Info("打开摄像头" + status);
+ if (status == 0)
+ {
+ status = libLhtCFs.CF_CreatWindow(0, 0, 300, 800, 600, 500);
+ Log.Info("创建视频预览窗口" + status);
+ if (status == 0)
+ {
+ status = libLhtCFs.CF_StartLiveDetectEx(10000);
+ Log.Info("活体检测超时时间:" + status);
+ if (status == 0)
+ {
+ string time = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
+ var tmpFile = "/tmp/" + time + ".jpg";
+
+
+
+ //停止活体检测
+ Task.Run(() => { libLhtCFs.CF_StopLiveDetect(); });
+ }
+ //关闭视频预览窗口
+ Task.Run(() => { libLhtCFs.CF_CloseWindow(0); });
+ }
+ //关闭摄像头
+ Task.Run(() => { libLhtCFs.CF_CloseCamera(); });
+ }
+ }
+ }
+
+ }
+ catch (Exception ex)
+ {
+ Log.Error("双目摄像头采集人脸异常:" + ex.Message);
+ }
+ return "";
+ }
+ }
+
+ class libLhtCFs
+ {
+ // 检测回调函数定义
+ [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.Cdecl)]
+ public delegate void DetectCallBack(int nEventId, IntPtr lpContext);
+
+ //RGB数据回调函数定义
+ [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.Cdecl)]
+ public delegate void GetVideoStream([MarshalAs(UnmanagedType.LPArray)] byte[] rgbData, int width, int height);
+
+ //mjpeg数据回调函数定义
+ [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.Cdecl)]
+ public delegate void GetMjpegStream([MarshalAs(UnmanagedType.LPArray)] byte[] mjpegData, int dataLen);
+
+ //初始化
+ [DllImport("libLhtCF", EntryPoint = "CF_Init", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_Init();
+
+ //反初始化函数
+ [DllImport("libLhtCF", EntryPoint = "CF_Uninit", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_Uninit();
+
+ //反初始化函数
+ [DllImport("libLhtCF", EntryPoint = "CF_GetCameraStatus", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_GetCameraStatus(int status);
+
+ //设置检测回调函数
+ [DllImport("libLhtCF", EntryPoint = "CF_GetCameraStatus", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_SetDetectCallBack(DetectCallBack pCB, IntPtr lpContext);
+
+ //设置彩色摄像头视频流回调
+ [DllImport("libLhtCF", EntryPoint = "SetCamADataCallback", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int SetCamADataCallback(GetVideoStream cb);
+
+ //设置红外摄像头视频流回调
+ [DllImport("libLhtCF", EntryPoint = "SetCamBDataCallback", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int SetCamBDataCallback(GetVideoStream cb);
+
+ //设置彩色摄像头mjpeg数据流回调
+ [DllImport("libLhtCF", EntryPoint = "SetCamADataCallbackEx", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int SetCamADataCallbackEx(GetMjpegStream cb);
+
+ //设置红外摄像头mjpeg数据流回调
+ [DllImport("libLhtCF", EntryPoint = "SetCamBDataCallbackEx", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int SetCamBDataCallbackEx(GetMjpegStream cb);
+
+ //设置分辨率
+ [DllImport("libLhtCF", EntryPoint = "CF_SetResolution", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_SetResolution(int width, int height);
+
+ //打开摄像头
+ [DllImport("libLhtCF", EntryPoint = "CF_OpenCamera", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_OpenCamera();
+
+ //关闭摄像头
+ [DllImport("libLhtCF", EntryPoint = "CF_CloseCamera", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_CloseCamera();
+
+ //开始活体检测
+ [DllImport("libLhtCF", EntryPoint = "CF_StartLiveDetect", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_StartLiveDetect();
+
+ //活体检测超时时间
+ [DllImport("libLhtCF", EntryPoint = "CF_StartLiveDetectEx", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_StartLiveDetectEx(int timeout);
+
+ //停止活体检测
+ [DllImport("libLhtCF", EntryPoint = "CF_StopLiveDetect", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_StopLiveDetect();
+
+ //获取采集图像
+ [DllImport("libLhtCF", EntryPoint = "CF_GetImage", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_GetImage(int nImageType, [MarshalAs(UnmanagedType.LPArray)] byte[] FilePath);
+
+ //获取采集图像
+ [DllImport("libLhtCF", EntryPoint = "CF_GetImage", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_FaceCompare(byte[] picPathA, byte[] picPathB, int score);
+
+ //创建视频预览窗口
+ [DllImport("libLhtCF", EntryPoint = "CF_CreatWindow", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_CreatWindow(int nWndType, long hWnd, int iX, int iY, int iWidth, int iHeight);
+
+ //关闭视频预览窗口
+ [DllImport("libLhtCF", EntryPoint = "CF_CloseWindow", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int CF_CloseWindow(int nWndType);
+ }
+}
diff --git a/CPF_Cef/Devices/PrintPJ.cs b/CPF_Cef/Devices/PrintPJ.cs
index a4dca87..d38e6e2 100644
--- a/CPF_Cef/Devices/PrintPJ.cs
+++ b/CPF_Cef/Devices/PrintPJ.cs
@@ -71,8 +71,6 @@ namespace AksWebBrowser.Devices
{
try
{
- //注册gb2312
- Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
string txt = string.Format(" 您预约办理的{0}业务-,排号为:", ywmc);
LibPrint.SetClean();
LibPrint.SetReadZKmode(0);
diff --git a/CPF_Cef/Devices/SignDll.cs b/CPF_Cef/Devices/SignDll.cs
deleted file mode 100644
index bd28989..0000000
--- a/CPF_Cef/Devices/SignDll.cs
+++ /dev/null
@@ -1,188 +0,0 @@
-using AksWebBrowser;
-using AksWebBrowser.Common;
-using AKSWebBrowser.Commen;
-using System;
-using System.Globalization;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-public struct TOUCH_INFO
-{
- public int btnID;//5寸 确定 重签 取消按钮
-}
-namespace DevicesService.Devices
-{
- public class SignDll
- {
- public static int status = -1;
- public static string callback;
- public SignDll()
- {
- //OpenSDK();
- }
- //打开签字版
- public void OpenSDK()
- {
- try
- {
- status = FiveInchDll.GWQ_Init();
- Log.Info("初始化SDK:" + status.ToString());
- string UIFile = System.IO.Directory.GetCurrentDirectory();
- UIFile = UIFile + @"/aks/adv_ui.jpg";
- FiveInchDll.GWQ_SetImage(UIFile);
- FiveInchDll.GWQ_ShowImage();
- //加载回调
- FiveInchDll.GWQ_setCallback(callback_str_receive);
- FiveInchDll.GWQ_OnOffPointReporting(0);
- //FiveInchDll.GWQ_setSignatureData(callback_signatureData);
- }
- catch (Exception ex) { Log.Error(ex.Message); }
- finally { }
- }
-
- public void callback_str_receive(int number, byte[] data, byte[] path)
- {
- try
- {
- //Log.Info(number.ToString());
- //1 签字确定按钮 2签字取消按钮 3 签字重签按钮(清空界面)
- if (number == 0x10)
- {
- //確認
- int ret = FiveInchDll.GWQ_GetImage();
- Log.Info("GWQ_GetImage:" + ret);
- FiveInchDll.GWQ_ShowImage();
- }
- else if (number == 0x40)
- {
- //重簽
- int ret = FiveInchDll.GWQ_ReSign();
- Log.Info("GWQ_ReSign:" + ret);
- }
- else if (number == 0xB0)
- {
- //Task.Run(async () =>
- //{
- // Log.Info(callback);
- // Log.Info(path);
- // byte[] img = File.ReadAllBytes(path);
- // string base64 = Convert.ToBase64String(img);
- // Log.Info(base64);
- // //完成圖片保存
- // string result = "{\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"png\",\"data\":\"" + base64 + "\"}";
- // Log.Info(result);
- // string _parm = callback + "('" + result + "')";
- // await Parame.webBrowser.ExecuteJavaScript(_parm);
- //});
-
- }
- else if (number == 0x30)
- {
- //取消
- FiveInchDll.GWQ_ShowImage();
- }
- }
- catch (Exception ex) { Log.Error(ex.Message); }
- finally { }
- }
-
- //0816加报点
- public void callback_signatureData(int x, int y, int p, int sn)
- {
- return;
- }
-
- //打开签字版
- public void OpenComDevice(string _callback)
- {
- try
- {
- callback = _callback;
- OpenSDK();
- FiveInchDll.GWQ_SwitchLanguage(0);
- }
- catch (Exception ex) { Log.Error(ex.Message); }
- finally { }
- }
-
- //釋放簽字版
- public int ReleaseComDevice()
- {
- int ret = -1;
- //try
- //{
- // if (status == 0)
- // {
- // ret = FiveInchDll.GWQ_Release();
- // if (ret == 0)
- // {
- // status = -1;
- // //取消
- // FiveInchDll.GWQ_ShowImage();
- // }
- // }
- //}
- //catch { }
- //finally { }
- return ret;
- }
- }
-
- class FiveInchDll
- {
-
- [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
- public delegate void callback_str_receive(int type, byte[] data, byte[] path);// (int number);
- [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
- public delegate void callback_signatureData(int x, int y, int p, int sn);
- //0816加报点
- [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
- public delegate void TOUCH_INFO_FUNC([MarshalAs(UnmanagedType.LPArray, SizeConst = 160)] TOUCH_INFO[] info);
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_Init(); //1.1SDK初始化
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_Release();//SDK释放
-
- [DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_DeviceOnline();//检查设备是否在线
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_setCallback(callback_str_receive cb);
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_setSignatureData(callback_signatureData cb);
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_SwitchLanguage(int language);//语言切换
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_GetImage();//获取签字图片(用户点击确定后发送)
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_SetImage(string uifile);//设置签字图片
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_ShowImage();//显示设置的图片
-
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_OnOffScreen(int type);//亮屏熄屏 1 熄屏 0亮屏
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_Reboot();//重启设备
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_ReSign();// 重新签字
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_OnOffPointReporting(int type);//开启关闭报点(同屏报点) 1 开启 0关闭
-
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_SetStartUpLogo(string path);//设置开机logo
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_SetSigningBackground(byte[] path, int len);//发送签字背景
- [DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
- public static extern int GWQ_SetSigningBackground2(byte[] path, int len);//设置开机logo
- }
-}
diff --git a/CPF_Cef/FrmMain.cs b/CPF_Cef/FrmMain.cs
index 1193c84..6b85ef4 100644
--- a/CPF_Cef/FrmMain.cs
+++ b/CPF_Cef/FrmMain.cs
@@ -24,13 +24,15 @@ namespace AKS.EnterpriseLibrary.WebBrowser
protected override void InitializeComponent()
{
+ //注册gb2312
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
LoadStyleFile("res://AksWebBrowser/StyleSheet.css");
//加载样式文件,文件需要设置为内嵌资源
Title = "控申业务专用浏览器";
CanResize = false;
ShowInTaskbar = true;
WindowState = WindowState.FullScreen;
- var v = new VideoView
+ Parame.videoV = new VideoView
{
Name = "player",
PresenterFor = this,
@@ -48,7 +50,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
Size = SizeField.Fill,
Children =
{
- v,
+ //Parame.videoV,
new CusWebBrowser
{
PresenterFor = this,
diff --git a/CPF_Cef/MainModel.cs b/CPF_Cef/MainModel.cs
index d72a300..0ba8609 100644
--- a/CPF_Cef/MainModel.cs
+++ b/CPF_Cef/MainModel.cs
@@ -2,6 +2,8 @@
using AksWebBrowser.Common;
using AksWebBrowser.Devices;
using AKSWebBrowser.Commen;
+using CPF.Shapes;
+using CPF.Windows;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
@@ -28,95 +30,102 @@ namespace AKS.EnterpriseLibrary.WebBrowser
SAEA.WebSocket.WSServer ws = new SAEA.WebSocket.WSServer(19983);
ws.OnConnected += (s) =>
{
- byte[] bytes = SerializeContent("连接成功");
+ string result = "{\"keycode\":\"" + "" + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"连接成功\"}";
+ byte[] bytes = SerializeContent(result);
ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes));
};
ws.OnMessage += (s, e) =>
{
- string content = Encoding.UTF8.GetString(e.Content);
- var json = content.ConvertToAnonymousType(new
- {
- code = default(string)
- });
- //接收指令和参数
- string keycode = json.code;
- //返回内容
- string result = string.Empty;
- switch (keycode)
+ string content = Encoding.GetEncoding("GB2312").GetString(e.Content);
+ if (content != "ping")
{
- //aks100101
- //读取身份证卡号 {"code":"aks100101"}
- case "aks100101":
- result = IDCardRead(keycode);
- break;
- //aks100102
- //打印排队票据 {"code":"aks100102","ph":"100101","ddrs":"中国检察","qrcode":"90087100100124433002","ywmc":"信访"}
- case "aks100102":
- result = SendByPrint(content);
- break;
- //aks100103
- //文字语音播报
- //播放:{ "code":"aks100103","text":"你好!","ispaye":false},
- //停止播放:{ "code":"aks100104","text":"","ispaye":true}
- case "aks100103":
- result = payleText(content);
- break;
- //aks100104
- //打开高拍仪并且进行快速扫描文件 {"code":"aks100104"}
- case "aks100104":
- result = openCamera(keycode);
- break;
- //aks100105
- //打开签字版 {"code":"aks100105"}
- case "aks100105":
- result = OpenSign(content);
- break;
- //aks100112
- //关闭签字版 {"code":"aks100112"}
- case "aks100112":
- result = CloseSign(keycode);
- break;
- //aks100106
- //指纹 {"code":"aks100106"}
- case "aks100106":
- result = ReadFingerData(keycode);
- break;
- //aks100107 开始录音、取消录音、结束录音
- // 开始录音:{ "code":"aks100107","url":"","isopen":true}
- // 取消录音: { "code":"aks100107","url":"","isopen":false}
- // 结束录音: { "code":"aks100107","url":"http://127.0.0.1/Upload","isopen":false}
- case "aks100107":
- result = SoundRecording(content);
- break;
- //aks100108
- //根据文件地址在线打印 { "code":"aks100108","url":"http://127.0.0.1/test.doc","ext":"doc"}
- case "aks100108":
- result = PrintFile(content);
- break;
- //aks100109
- //根据文件base64打印(PDF) { "code":"aks100109","base64":"ADFJLAKSDJFLKASJF...","ext":"pdf"}
- case "aks100109":
- result = PrintBase64(content);
- break;
- //aks100110 播放音频文件 {"code":"aks100110"}
- case "aks100110":
- result = PalyFile(content);
- break;
- //aks100111 唤醒键盘 {"code":"aks100111"}
- case "aks100111":
- result = openKey(keycode);
- break;
- //aks100113 指纹 {"code":"aks100113"}
- case "aks100113":
- result = ReadFingerData(keycode);
- break;
- default:
- result = "{\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}";
- break;
+ var json = content.ConvertToAnonymousType(new
+ {
+ code = default(string)
+ });
+ //接收指令和参数
+ string keycode = json.code;
+ //返回内容
+ string result = string.Empty;
+ switch (keycode)
+ {
+ //aks100101
+ //读取身份证卡号 {"code":"aks100101"}
+ case "aks100101":
+ result = IDCardRead(keycode);
+ break;
+ //aks100102
+ //打印排队票据 {"code":"aks100102","ph":"100101","ddrs":"中国检察","qrcode":"90087100100124433002","ywmc":"信访"}
+ case "aks100102":
+ result = SendByPrint(content);
+ break;
+ //aks100103
+ //文字语音播报
+ //播放:{ "code":"aks100103","text":"你好!","ispaye":false},
+ //停止播放:{ "code":"aks100104","text":"","ispaye":true}
+ case "aks100103":
+ result = payleText(content);
+ break;
+ //aks100104
+ //打开高拍仪并且进行快速扫描文件 {"code":"aks100104"}
+ case "aks100104":
+ result = openCamera(keycode);
+ break;
+ //aks100105
+ //打开签字版 {"code":"aks100105"}
+ case "aks100105":
+ result = OpenSign(content);
+ break;
+ //aks100112
+ //关闭签字版 {"code":"aks100112"}
+ case "aks100112":
+ result = CloseSign(keycode);
+ break;
+ //aks100106
+ //指纹 {"code":"aks100106"}
+ case "aks100106":
+ result = ReadFingerData(keycode);
+ break;
+ //aks100107 开始录音、取消录音、结束录音
+ // 开始录音:{ "code":"aks100107","url":"","isopen":true}
+ // 取消录音: { "code":"aks100107","url":"","isopen":false}
+ // 结束录音: { "code":"aks100107","url":"http://127.0.0.1/Upload","isopen":false}
+ case "aks100107":
+ result = SoundRecording(content);
+ break;
+ //aks100108
+ //根据文件地址在线打印 { "code":"aks100108","url":"http://127.0.0.1/test.doc","ext":"doc"}
+ case "aks100108":
+ result = PrintFile(content);
+ break;
+ //aks100109
+ //根据文件base64打印(PDF) { "code":"aks100109","base64":"ADFJLAKSDJFLKASJF...","ext":"pdf"}
+ case "aks100109":
+ result = PrintBase64(content);
+ break;
+ //aks100110
+ //播放音频文件 { "code":"aks100110","url":"http://127.0.0.1/test.wav","ispaye":false}
+ //停止播放音频文件 { "code":"aks100110","url":"","ispaye":true}
+ case "aks100110":
+ result = PalyFile(content);
+ break;
+ //aks100111 唤醒键盘 {"code":"aks100111"}
+ case "aks100111":
+ result = openKey(keycode);
+ break;
+ //aks100113 指纹 {"code":"aks100113"}
+ case "aks100113":
+ result = ReadFingerData(keycode);
+ break;
+ default:
+ result = "{\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}";
+ break;
+ }
+ //答复请求者(处理完请求后在些答复)
+ byte[] bytes = SerializeContent(result);
+ ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes));
}
- //答复请求者(处理完请求后在些答复)
- byte[] bytes = SerializeContent(result);
- ws.Reply(s.ToString(), new SAEA.WebSocket.Model.WSProtocal(SAEA.WebSocket.Type.WSProtocalType.Text, bytes));
+
};
ws.Start();
}
@@ -284,6 +293,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
Typrocess.WaitForExit();
}
}
+ //AutoAudio(false, "");
});
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "停止播放成功" + "}";
SubmitLogs(result, "payleText");
@@ -295,9 +305,10 @@ namespace AKS.EnterpriseLibrary.WebBrowser
{
//形成语音
tempWav = GenerateWavFromText(text);
- //开始播放
+ ////开始播放
string command = $"sox {tempWav} -d";
ShllCommad(command);
+ //AutoAudio(true, tempWav);
});
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "开始播放" + "}";
SubmitLogs(result, "payleText");
@@ -583,7 +594,7 @@ namespace AKS.EnterpriseLibrary.WebBrowser
});
try
{
-
+
string url = param.url;
string ext = param.ext;
if (!isFuncisFuncObject("PrintFile"))
@@ -722,6 +733,27 @@ namespace AKS.EnterpriseLibrary.WebBrowser
else
{
if (ispaly)
+ {
+ Task.Run(() =>
+ {
+ //if (Typrocess != null)
+ //{
+ // // 如果进程还在运行
+ // if (!Typrocess.HasExited)
+ // {
+ // // 发送SIGTERM信号来停止进程
+ // Typrocess.Kill();
+ // // 等待进程真正停止
+ // Typrocess.WaitForExit();
+ // }
+ //}
+ AutoAudio(ispaly, "");
+ });
+ string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "停止播放成功" + "}";
+ SubmitLogs(result, "PalyFile");
+ return result;
+ }
+ else
{
Task.Run(() =>
{
@@ -752,33 +784,14 @@ namespace AKS.EnterpriseLibrary.WebBrowser
response.Close();
//开始播放
- string command = $"sox {path} -d";
- ShllCommad(command);
+ //string command = $"sox {path} -d";
+ //ShllCommad(command);
+ AutoAudio(ispaly, path);
});
string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "开始播放" + "}";
SubmitLogs(result, "PalyFile");
return result;
}
- else
- {
- Task.Run(() =>
- {
- if (Typrocess != null)
- {
- // 如果进程还在运行
- if (!Typrocess.HasExited)
- {
- // 发送SIGTERM信号来停止进程
- Typrocess.Kill();
- // 等待进程真正停止
- Typrocess.WaitForExit();
- }
- }
- });
- string result = "{\"keycode\":\"" + param.code + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"data\":" + "停止播放成功" + "}";
- SubmitLogs(result, "PalyFile");
- return result;
- }
}
}
catch (Exception ex)
@@ -818,23 +831,31 @@ namespace AKS.EnterpriseLibrary.WebBrowser
///
public static string Bash(string command)
{
- var escapedArgs = command.Replace("\"", "\\\"");
- var process = new Process()
+ try
{
- StartInfo = new ProcessStartInfo
+ var escapedArgs = command.Replace("\"", "\\\"");
+ var process = new Process()
{
- FileName = "/bin/bash",
- Arguments = $"-c \"{escapedArgs}\"",
- RedirectStandardOutput = true,
- UseShellExecute = false,
- CreateNoWindow = true,
- }
- };
- process.Start();
- string result = process.StandardOutput.ReadToEnd();
- process.WaitForExit();
- process.Dispose();
- return result;
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = "/bin/bash",
+ Arguments = $"-c \"{escapedArgs}\"",
+ RedirectStandardOutput = true,
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ }
+ };
+ process.Start();
+ string result = process.StandardOutput.ReadToEnd();
+ process.WaitForExit();
+ process.Dispose();
+ return result;
+ }
+ catch (Exception ex)
+ {
+ Log.Error("执行文件异常:" + ex.Message);
+ }
+ return "";
}
///
@@ -843,39 +864,47 @@ namespace AKS.EnterpriseLibrary.WebBrowser
///
public static string GetSnIndex()
{
- //获取设备信息
- string param = "/GetAllDisplayInfo";
- Task.Run(() => HttpResponse(param));
- @event6.WaitOne();
- if (string.IsNullOrEmpty(gpyStr))
- {
- return "";
- }
- else
+ try
{
- JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
- if (jo["returnCode"].ToString() == "0")
+ //获取设备信息
+ string param = "/GetAllDisplayInfo";
+ Task.Run(() => HttpResponse(param));
+ @event6.WaitOne();
+ if (string.IsNullOrEmpty(gpyStr))
{
- string result = jo["data"].ToString();
- Log.Info(result);
- JArray jo1 = (JArray)JsonConvert.DeserializeObject(result);
- string devidx = string.Empty;
- string name = string.Empty;
- foreach (JObject jo2 in jo1)
- {
- devidx = jo2["dev_idx"].ToString();
- name = jo2["name"].ToString();
- Log.Info(name);
- break;
- }
- return devidx;
+ return "";
}
else
{
- Log.Info(jo["returnMsg"].ToString());
- return "";
+ JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
+ if (jo["returnCode"].ToString() == "0")
+ {
+ string result = jo["data"].ToString();
+ Log.Info(result);
+ JArray jo1 = (JArray)JsonConvert.DeserializeObject(result);
+ string devidx = string.Empty;
+ string name = string.Empty;
+ foreach (JObject jo2 in jo1)
+ {
+ devidx = jo2["dev_idx"].ToString();
+ name = jo2["name"].ToString();
+ Log.Info(name);
+ break;
+ }
+ return devidx;
+ }
+ else
+ {
+ Log.Info(jo["returnMsg"].ToString());
+ return "";
+ }
}
}
+ catch (Exception ex)
+ {
+ Log.Error("获取设备index异常:" + ex.Message);
+ }
+ return "";
}
///
@@ -884,31 +913,39 @@ namespace AKS.EnterpriseLibrary.WebBrowser
///
public static string OpenSn(string dev_idx)
{
- //获取设备信息
- string param = "/StartPreview?dev_idx=" + dev_idx + "&res_id=0";
- Task.Run(() => HttpResponse(param));
- @event6.WaitOne();
- if (string.IsNullOrEmpty(gpyStr))
- {
- return "";
- }
- else
+ try
{
- JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
- if (jo["returnCode"].ToString() == "0")
+ //获取设备信息
+ string param = "/StartPreview?dev_idx=" + dev_idx + "&res_id=0";
+ Task.Run(() => HttpResponse(param));
+ @event6.WaitOne();
+ if (string.IsNullOrEmpty(gpyStr))
{
- return "200";
- }
- if (jo["returnCode"].ToString() == "2")
- {
- return "200";
+ return "";
}
else
{
- Log.Info(jo["returnMsg"].ToString());
- return "";
+ JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
+ if (jo["returnCode"].ToString() == "0")
+ {
+ return "200";
+ }
+ if (jo["returnCode"].ToString() == "2")
+ {
+ return "200";
+ }
+ else
+ {
+ Log.Info(jo["returnMsg"].ToString());
+ return "";
+ }
}
}
+ catch (Exception ex)
+ {
+ Log.Error("打开高拍仪异常:" + ex.Message);
+ }
+ return "";
}
///
@@ -946,29 +983,37 @@ namespace AKS.EnterpriseLibrary.WebBrowser
///
public static string getFrame()
{
- //获取设备信息
- string param = "/getFrame";
- Task.Run(() => HttpResponse(param));
- @event6.WaitOne();
- if (string.IsNullOrEmpty(gpyStr))
- {
- return "";
- }
- else
+ try
{
- JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
- if (jo["returnCode"].ToString() == "0")
+ //获取设备信息
+ string param = "/getFrame";
+ Task.Run(() => HttpResponse(param));
+ @event6.WaitOne();
+ if (string.IsNullOrEmpty(gpyStr))
{
- string result = jo["data"].ToString();
- JObject jo1 = (JObject)JsonConvert.DeserializeObject(result);
- return jo1["img"].ToString();
+ return "";
}
else
{
- Log.Info(jo["returnMsg"].ToString());
- return "";
+ JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
+ if (jo["returnCode"].ToString() == "0")
+ {
+ string result = jo["data"].ToString();
+ JObject jo1 = (JObject)JsonConvert.DeserializeObject(result);
+ return jo1["img"].ToString();
+ }
+ else
+ {
+ Log.Info(jo["returnMsg"].ToString());
+ return "";
+ }
}
}
+ catch (Exception ex)
+ {
+ Log.Error("拍照异常:" + ex.Message);
+ }
+ return "";
}
///
@@ -977,27 +1022,35 @@ namespace AKS.EnterpriseLibrary.WebBrowser
///
public static string RotateRight()
{
- //获取设备信息
- string param = "/rotate/right";
- Task.Run(() => HttpResponse(param));
- @event6.WaitOne();
- if (string.IsNullOrEmpty(gpyStr))
- {
- return "";
- }
- else
+ try
{
- JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
- if (jo["returnCode"].ToString() == "0")
+ //获取设备信息
+ string param = "/rotate/right";
+ Task.Run(() => HttpResponse(param));
+ @event6.WaitOne();
+ if (string.IsNullOrEmpty(gpyStr))
{
- return "200";
+ return "";
}
else
{
- Log.Info(jo["returnMsg"].ToString());
- return "";
+ JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
+ if (jo["returnCode"].ToString() == "0")
+ {
+ return "200";
+ }
+ else
+ {
+ Log.Info(jo["returnMsg"].ToString());
+ return "";
+ }
}
}
+ catch (Exception ex)
+ {
+ Log.Error("右转异常:" + ex.Message);
+ }
+ return "";
}
///
@@ -1006,27 +1059,35 @@ namespace AKS.EnterpriseLibrary.WebBrowser
///
public static string RotateLeft()
{
- //获取设备信息
- string param = "/rotate/left";
- Task.Run(() => HttpResponse(param));
- @event6.WaitOne();
- if (string.IsNullOrEmpty(gpyStr))
- {
- return "";
- }
- else
+ try
{
- JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
- if (jo["returnCode"].ToString() == "0")
+ //获取设备信息
+ string param = "/rotate/left";
+ Task.Run(() => HttpResponse(param));
+ @event6.WaitOne();
+ if (string.IsNullOrEmpty(gpyStr))
{
- return "200";
+ return "";
}
else
{
- Log.Info(jo["returnMsg"].ToString());
- return "";
+ JObject jo = (JObject)JsonConvert.DeserializeObject(gpyStr);
+ if (jo["returnCode"].ToString() == "0")
+ {
+ return "200";
+ }
+ else
+ {
+ Log.Info(jo["returnMsg"].ToString());
+ return "";
+ }
}
}
+ catch (Exception ex)
+ {
+ Log.Error("左转异常:" + ex.Message);
+ }
+ return "";
}
///
@@ -1036,10 +1097,17 @@ namespace AKS.EnterpriseLibrary.WebBrowser
private static AutoResetEvent @event6 = new AutoResetEvent(false);
private static async void HttpResponse(string param)
{
- var httpClient = new HttpClient();
- var uploader = new ChunkedUpload(httpClient);
- gpyStr = await uploader.getReq(param);
- @event6.Set();
+ try
+ {
+ var httpClient = new HttpClient();
+ var uploader = new ChunkedUpload(httpClient);
+ gpyStr = await uploader.getReq(param);
+ @event6.Set();
+ }
+ catch (Exception ex)
+ {
+ Log.Error("高拍仪异常:" + ex.Message);
+ }
}
private static string sginStr = string.Empty;
@@ -1048,10 +1116,17 @@ namespace AKS.EnterpriseLibrary.WebBrowser
///
private static async void HttpPostResponseBySign(string type, int typeCode, string code)
{
- var httpClient = new HttpClient();
- var uploader = new ChunkedUpload(httpClient);
- sginStr = await uploader.PostSign(type, typeCode, code);
- @event2.Set();
+ try
+ {
+ var httpClient = new HttpClient();
+ var uploader = new ChunkedUpload(httpClient);
+ sginStr = await uploader.PostSign(type, typeCode, code);
+ @event2.Set();
+ }
+ catch (Exception ex)
+ {
+ Log.Error("签字版异常:" + ex.Message);
+ }
}
///
@@ -1061,10 +1136,17 @@ namespace AKS.EnterpriseLibrary.WebBrowser
private static AutoResetEvent @event2 = new AutoResetEvent(false);
private static async void UploadInfo(string url, string srpath)
{
- var httpClient = new HttpClient();
- var uploader = new ChunkedUpload(httpClient);
- urlpath = await uploader.UploadFileAsync(url, srpath);
- @event2.Set();
+ try
+ {
+ var httpClient = new HttpClient();
+ var uploader = new ChunkedUpload(httpClient);
+ urlpath = await uploader.UploadFileAsync(url, srpath);
+ @event2.Set();
+ }
+ catch (Exception ex)
+ {
+ Log.Error("初始文件上传异常:" + ex.Message);
+ }
}
//上传本地文件中转
@@ -1072,49 +1154,40 @@ namespace AKS.EnterpriseLibrary.WebBrowser
private static AutoResetEvent @event5 = new AutoResetEvent(false);
private static async void UploadInfoByFile(string url, string strpath)
{
- var httpClient = new HttpClient();
- var uploader = new ChunkedUpload(httpClient);
- urlP = await uploader.UploadFileAsync(url, strpath);
- File.Delete(strpath);
- @event5.Set();
- }
-
- ///
- /// string 转换为 base64
- ///
- ///
- public static string str2Base64(string str)
- {
- byte[] b = System.Text.Encoding.UTF8.GetBytes(str);
- string result = Convert.ToBase64String(b);
- return result;
- }
-
- ///
- /// base64 转换为 string
- ///
- ///
- public static string Base64str2(string data)
- {
- byte[] c = Convert.FromBase64String(data);
- string result = System.Text.Encoding.UTF8.GetString(c);
- //Log.Info("接收返回数据:" + result);
- return result;
+ try
+ {
+ var httpClient = new HttpClient();
+ var uploader = new ChunkedUpload(httpClient);
+ urlP = await uploader.UploadFileAsync(url, strpath);
+ File.Delete(strpath);
+ @event5.Set();
+ }
+ catch (Exception ex)
+ {
+ Log.Error("上传本地文件中转异常:" + ex.Message);
+ }
}
//根据程序名称杀死进程
public static void KillProcessByName(string processName)
{
- Process[] processes = Process.GetProcessesByName(processName);
-
- foreach (Process process in processes)
+ try
{
- try
+ Process[] processes = Process.GetProcessesByName(processName);
+
+ foreach (Process process in processes)
{
- process.Kill();
- process.WaitForExit(); // 等待进程退出
+ try
+ {
+ process.Kill();
+ process.WaitForExit(); // 等待进程退出
+ }
+ catch (Exception ex) { }
}
- catch (Exception ex) { }
+ }
+ catch (Exception ex)
+ {
+ Log.Error("根据程序名称杀死进程异常:" + ex.Message);
}
}
@@ -1199,22 +1272,29 @@ namespace AKS.EnterpriseLibrary.WebBrowser
///
public static void ShllCommad(string command)
{
- //Log.Info("执行命令:" + command);
- // 启动进程
- Typrocess = new Process
+ try
{
- StartInfo = new ProcessStartInfo
+ //Log.Info("执行命令:" + command);
+ // 启动进程
+ Typrocess = new Process
{
- FileName = "/bin/bash",
- Arguments = $"-c \"{command}\"",
- UseShellExecute = false,
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- CreateNoWindow = true
- }
- };
- Typrocess.Start();
- Typrocess.WaitForExit();
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = "/bin/bash",
+ Arguments = $"-c \"{command}\"",
+ UseShellExecute = false,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ CreateNoWindow = true
+ }
+ };
+ Typrocess.Start();
+ Typrocess.WaitForExit();
+ }
+ catch (Exception ex)
+ {
+ Log.Error("执行命令异常:" + ex.Message);
+ }
}
///
@@ -1229,25 +1309,33 @@ namespace AKS.EnterpriseLibrary.WebBrowser
"yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
string dirpath = System.IO.Directory.GetCurrentDirectory();
dirpath = dirpath + @"/wwwroot/WavFile";
+ Log.Info(dirpath);
if (!Directory.Exists(dirpath))
{
Directory.CreateDirectory(dirpath);
}
var tempFile = dirpath + "/" + time + ".wav";
- text = text.Replace("(", "").Replace(")", "、");
- ProcessStartInfo startInfo = new ProcessStartInfo
- {
- FileName = "espeak",
- Arguments = $" -vzh -s 150 \"{text}\" -w {tempFile}", // 设置语速为150,输出为WAV文件
- UseShellExecute = false,
- RedirectStandardOutput = true,
- CreateNoWindow = true
- };
- using (Process process = Process.Start(startInfo))
+ try
{
- process.WaitForExit(); // 等待进程结束
- process.Close();
- process.Dispose();
+ text = text.Replace("(", "").Replace(")", "、");
+ ProcessStartInfo startInfo = new ProcessStartInfo
+ {
+ FileName = "espeak",
+ Arguments = $" -vzh -s 150 \"{text}\" -w {tempFile}", // 设置语速为150,输出为WAV文件
+ UseShellExecute = false,
+ RedirectStandardOutput = true,
+ CreateNoWindow = true
+ };
+ using (Process process = Process.Start(startInfo))
+ {
+ process.WaitForExit(); // 等待进程结束
+ process.Close();
+ process.Dispose();
+ }
+ }
+ catch (Exception ex)
+ {
+ Log.Error("文字转语音失败:" + ex.Message);
}
return tempFile;
}
@@ -1260,17 +1348,27 @@ namespace AKS.EnterpriseLibrary.WebBrowser
public static bool isFuncisFuncObject(string funcName)
{
bool isFunc = false;
- if (Parame.FuncObject.Count > 0)
+ try
{
- foreach (Func func in Parame.FuncObject)
+ if (Parame.FuncObject != null)
{
- if (func.Interfaceaddress.Contains(funcName))
+ if (Parame.FuncObject.Count > 0)
{
- isFunc = true;
- break;
+ foreach (Func func in Parame.FuncObject)
+ {
+ if (func.Interfaceaddress.Contains(funcName))
+ {
+ isFunc = true;
+ break;
+ }
+ }
}
}
}
+ catch (Exception ex)
+ {
+ Log.Error("是否已获取收取异常:" + ex.Message);
+ }
return isFunc;
}
@@ -1281,44 +1379,113 @@ namespace AKS.EnterpriseLibrary.WebBrowser
///
public static void SubmitLogs(string Describer, string funcName)
{
- Task.Run(async () =>
+ try
{
- string ApiId = string.Empty;
- string Name = string.Empty;
- string Interfaceaddress = string.Empty;
- bool isFunc = false;
- if (Parame.FuncObject != null)
- {
- if (Parame.FuncObject.Count > 0)
+ Task.Run(async () =>
{
- foreach (Func func in Parame.FuncObject)
+ string ApiId = string.Empty;
+ string Name = string.Empty;
+ string Interfaceaddress = string.Empty;
+ bool isFunc = false;
+ if (Parame.FuncObject != null)
{
- if (func.Interfaceaddress.Contains(funcName))
+ if (Parame.FuncObject.Count > 0)
{
- isFunc = true;
- ApiId = func.Id;
- Name = func.Platform;
- Interfaceaddress = func.Interfaceaddress;
- break;
+ foreach (Func func in Parame.FuncObject)
+ {
+ if (func.Interfaceaddress.Contains(funcName))
+ {
+ isFunc = true;
+ ApiId = func.Id;
+ Name = func.Platform;
+ Interfaceaddress = func.Interfaceaddress;
+ break;
+ }
+ }
}
}
- }
+ if (isFunc)
+ {
+ var client = new HttpClient();
+ var request = new HttpRequestMessage(HttpMethod.Post, $"{Parame.apiUrl}/api/Interface/JournalAdd");
+ var content = new StringContent("{\"Name\": \"" + Name + "\",\"Describer\": \"" + str2Base64(Describer) + "\", \"Interfaceaddress\": \"" + Interfaceaddress + "\", \"ApiId\": \"" + ApiId + "\"}", null, "application/json");
+ request.Content = content;
+ var response = await client.SendAsync(request);
+ if (response.StatusCode.ToString() == "200")
+ {
+ response.EnsureSuccessStatusCode();
+ var body = await response.Content.ReadAsStringAsync();
+ //Log.Info(body);
+ }
+ }
+ });
+ }
+ catch (Exception ex)
+ {
+ Log.Error("提交设备操作日志异常:" + ex.Message);
+ }
+ }
+
+ ///
+ /// 播放语音文件
+ ///
+ ///
+ public static void AutoAudio(bool ispaly, string path)
+ {
+ try
+ {
+ if (ispaly)
+ {
+ Parame.videoV.Play(new Uri(path));//播放
}
- if (isFunc)
+ else
{
- var client = new HttpClient();
- var request = new HttpRequestMessage(HttpMethod.Post, $"{Parame.apiUrl}/api/Interface/JournalAdd");
- var content = new StringContent("{\"Name\": \"" + Name + "\",\"Describer\": \"" + str2Base64(Describer) + "\", \"Interfaceaddress\": \"" + Interfaceaddress + "\", \"ApiId\": \"" + ApiId + "\"}", null, "application/json");
- request.Content = content;
- var response = await client.SendAsync(request);
- if (response.StatusCode.ToString() == "200")
- {
- response.EnsureSuccessStatusCode();
- var body = await response.Content.ReadAsStringAsync();
- //Log.Info(body);
- }
+ Parame.videoV.Pause();//停止
}
- });
+ }
+ catch (Exception ex)
+ {
+ Log.Error("播放语音文件异常:" + ex.Message);
+ }
+ }
+
+ ///
+ /// string 转换为 base64
+ ///
+ ///
+ public static string str2Base64(string str)
+ {
+ try
+ {
+ byte[] b = System.Text.Encoding.UTF8.GetBytes(str);
+ string result = Convert.ToBase64String(b);
+ return result;
+ }
+ catch (Exception ex)
+ {
+ Log.Error("string 转换为 base64异常:" + ex.Message);
+ }
+ return "";
+ }
+
+ ///
+ /// base64 转换为 string
+ ///
+ ///
+ public static string Base64str2(string data)
+ {
+ try
+ {
+ byte[] c = Convert.FromBase64String(data);
+ string result = System.Text.Encoding.UTF8.GetString(c);
+ //Log.Info("接收返回数据:" + result);
+ return result;
+ }
+ catch (Exception ex)
+ {
+ Log.Error("base64 转换为 string异常:" + ex.Message);
+ }
+ return "";
}
}
}
diff --git a/CPF_Cef/Parame.cs b/CPF_Cef/Parame.cs
index ec3f9ec..c9fe396 100644
--- a/CPF_Cef/Parame.cs
+++ b/CPF_Cef/Parame.cs
@@ -1,4 +1,5 @@
using AKS.EnterpriseLibrary.WebBrowser;
+using CPF.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,6 +12,7 @@ namespace AksWebBrowser
public class Parame
{
public static TcpClient tcpClient { get; set; }
+ public static VideoView videoV { get; set; }
public static CusWebBrowser webBrowser { get; set; }
public static List FuncObject { get; set; }
//接口地址