| | |
| | | using System; |
| | | using System.IO; |
| | | using System.Threading; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | |
| | | TextID = StringId.AboutFaceIdAndPrivacy |
| | | }; |
| | | contentView.AddChidren(btnTip); |
| | | btnTip.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | string url = "https://developer.hdlcontrol.com/FaceProtocolSantam.html"; |
| | | new WebViewDialog().LoadPage(Language.StringByID(StringId.GetFaceProtocol), url); |
| | | |
| | | }; |
| | | |
| | | |
| | | btnSetFaceId = new Button() |
| | |
| | | { |
| | | //1.读取裁剪后的图片,然后删除 |
| | | var imageBytes = Shared.IO.FileUtils.ReadFile(selectImagePath); |
| | | |
| | | |
| | | System.IO.FileStream fs = null; |
| | | try |
| | | { |
| | | if (System.IO.File.Exists(System.IO.Path.Combine(Application.RootPath, selectImagePath))) |
| | | { |
| | | fs = new FileStream(System.IO.Path.Combine(Application.RootPath, selectImagePath), FileMode.Open, FileAccess.Read); |
| | | } |
| | | else if (System.IO.File.Exists(selectImagePath)) |
| | | { |
| | | fs = new FileStream(selectImagePath, FileMode.Open, FileAccess.Read); |
| | | } |
| | | else |
| | | { |
| | | } |
| | | byte[] bytes = new byte[fs.Length]; |
| | | fs.Read(bytes, 0, bytes.Length); |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | Console.WriteLine(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | if (fs != null) |
| | | { |
| | | fs.Close(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | System.IO.File.Delete(selectImagePath); |
| | | |
| | | var waitPage = new Loading(); |
| | |
| | | try |
| | | { |
| | | string base64string = Convert.ToBase64String(imageBytes); |
| | | Console.WriteLine("wxr" + base64string); |
| | | //Utlis.WriteLine("上传图片Length:" + imageBytes.Length + " base64:" + base64string); |
| | | var pack = new HttpServerRequest().FaceSetting(base64string); |
| | | if (pack != null) |