| | |
| | | } |
| | | ExitJudgeStack.TryPop(out int exitJudgeVal); |
| | | }); |
| | | |
| | | /// <summary> |
| | | /// ç¨åºç段:Program1 |
| | | /// æè¿°: |
| | |
| | | System.Threading.Thread.Sleep(3000); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// ç¨åºç段:æ°çº¿ç¨æ»çº¿ |
| | | /// æè¿°:1 |
| | | /// </summary> |
| | | System.Threading.Tasks.Task.Factory.StartNew(() => |
| | | { |
| | | System.Threading.Thread.CurrentThread.IsBackground = true; |
| | | ExitJudgeStack.Push(0); |
| | | //ä¸ç´æ§è¡ï¼ç´å°æ»¡è¶³ç»ææ¡ä»¶ |
| | | while (true) |
| | | { |
| | | if (IsExitApp) { break; } |
| | | try |
| | | { |
| | | #region [èæ¬][20250708095248653][ä¸å¡é»è¾.æ°çº¿ç¨æ»çº¿] |
| | | AutoThread.InvokeMethod(AutoThread.Instance, "ThreaTotal", new object[] { tag }); |
| | | #endregion [èæ¬][20250708095248653][ä¸å¡é»è¾.æ°çº¿ç¨æ»çº¿] |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Conn.é»è®¤æ¥å¿.Error(ex.ToString()); |
| | | } |
| | | finally |
| | | { |
| | | System.Threading.Thread.Sleep(3000); |
| | | } |
| | | } |
| | | ExitJudgeStack.TryPop(out int exitJudgeVal); |
| | | }); |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | Device.RGV?.Stop(); |
| | | Device.påé£ç§2ä¸çº¿?.Stop(); |
| | | Device.påé£ç§3ä¸çº¿?.Stop(); |
| | | Device.påé£ç§4ä¸çº¿?.Stop(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | || (Device.RGV == null ? false : Device.RGV.State != GZ.Device.PLC.PlcRunState.Stoped) |
| | | || (Device.påé£ç§2ä¸çº¿ == null ? false : Device.påé£ç§2ä¸çº¿.State != GZ.Device.PLC.PlcRunState.Stoped) |
| | | || (Device.påé£ç§3ä¸çº¿ == null ? false : Device.påé£ç§3ä¸çº¿.State != GZ.Device.PLC.PlcRunState.Stoped) |
| | | || (Device.påé£ç§4ä¸çº¿ == null ? false : Device.påé£ç§4ä¸çº¿.State != GZ.Device.PLC.PlcRunState.Stoped) |
| | | ) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | |
| | | #endregion |
| | | |
| | | #region Httpæå¡çå¬ |
| | | private async void HttpSvcListenerCallback(IAsyncResult ar) |
| | | private void HttpSvcListenerCallback(IAsyncResult ar) |
| | | { |
| | | System.Net.HttpListenerContext context = null; |
| | | try |
| | | { |
| | | HttpSvcHost.BeginGetContext(HttpSvcListenerCallback, null); |
| | | context = HttpSvcHost.EndGetContext(ar); |
| | | System.Net.HttpListenerContext context = HttpSvcHost.EndGetContext(ar); |
| | | System.Net.HttpListenerRequest request = context.Request; |
| | | System.Net.HttpListenerResponse response = context.Response; |
| | | switch (request.LocalEndPoint.ToString()) |
| | |
| | | using (var reader = new System.IO.StreamReader(request.InputStream, System.Text.Encoding.UTF8)) |
| | | { |
| | | string requestJson = reader.ReadToEnd(); |
| | | System.Net.HttpStatusCode statusCode = 0; |
| | | string respstr = await Task.Run(() => |
| | | { |
| | | return HttpSvcListenerCallback_he(request.HttpMethod, request.Url.AbsolutePath, requestJson, out statusCode); |
| | | }); |
| | | |
| | | string respstr = HttpSvcListenerCallback_he(request.HttpMethod, request.Url.AbsolutePath, requestJson, out System.Net.HttpStatusCode statusCode); |
| | | |
| | | string logContent = ""; |
| | | logContent += $"\r\n[{request.HttpMethod}]{request.Url.AbsolutePath}"; |
| | | logContent += $"\r\n[request]{requestJson}"; |
| | | logContent += $"\r\n[response]{respstr}"; |
| | | _ = Task.Run(() => |
| | | { |
| | | Conn.é»è®¤æ¥å¿?.Info(logContent); |
| | | }); |
| | | |
| | | byte[] bytstr = Encoding.UTF8.GetBytes(respstr); |
| | | response.StatusCode = (int)statusCode; |
| | | response.SendChunked = false; |
| | | response.ContentLength64 = bytstr.Length; |
| | | response.OutputStream.Write(bytstr, 0, bytstr.Length); |
| | | // 弿¥åå
¥ååº |
| | | await response.OutputStream.WriteAsync(bytstr, 0, bytstr.Length); |
| | | |
| | | response.Close(); |
| | | } |
| | | break; |
| | | } |
| | |
| | | catch (Exception ex) |
| | | { |
| | | Conn.é»è®¤æ¥å¿.Error(ex.ToString()); |
| | | } |
| | | finally |
| | | { |
| | | context?.Response.Close(); |
| | | } |
| | | } |
| | | private System.String HttpSvcListenerCallback_he(System.String method, System.String path, System.String requestJson, out System.Net.HttpStatusCode statusCode) |
| | |
| | | { |
| | | switch (path) |
| | | { |
| | | case var _ when System.Text.RegularExpressions.Regex.IsMatch(path, @"\.(html|ico|js|css)(\?.*)?$", System.Text.RegularExpressions.RegexOptions.IgnoreCase): |
| | | case "/inddddddddddddddddd": |
| | | { |
| | | statusCode = System.Net.HttpStatusCode.OK; |
| | | // å¤å¶å°case ä¸ |