public override void InitializeResource() { IsFirstRun = true; lstAccessDateTime = DateTime.Now; overlapSeconds = ApplicationConfig.OverlapSeconds; RequestHistoryHelper.InitializeResource(); }
/// <summary> /// WebSocket HttpListener /// </summary> /// <param name="frm"></param> /// <param name="request"></param> /// <returns></returns> public static string SendResponse(BaseForm frm, HttpListenerRequest request) { string result = string.Empty; try { if (frm.InvokeRequired) { frm.Invoke(new MethodInvoker(delegate() { if (frm.IsRunning == false) { var idx = RequestHistoryHelper.AddItem(request); frm.ShowForm(request, idx); } })); } } catch (Exception ex) { result = string.Format("Fail, {0}, {1}", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), ex.Message); return(MessageHelper.HttpResponseMessage(result)); } if (frm.IsRunning) { result = string.Format("Running, {0}, {1}", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), request.QueryString.Count); } else { result = string.Format("Success, {0}, {1}", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), request.QueryString.Count); } return(MessageHelper.HttpResponseMessage(result)); }
private void ShowBalloonTip(string message, ToolTipIcon icon = 0, bool isHistory = true, int timeout = 1000) { if (isHistory) { RequestHistoryHelper.GetActiveItem().Message = message; RequestHistoryHelper.GetActiveItem().State = "Error"; } notifyIcon.BalloonTipIcon = icon; notifyIcon.BalloonTipText = message; notifyIcon.BalloonTipTitle = ApplicationConfig.SolutionTitle; notifyIcon.ShowBalloonTip(timeout); }
private void BtnClear_Click(object sender, EventArgs e) { this.dataGridView1.DataSource = null; RequestHistoryHelper.InitializeResource(); }
/// <summary> /// WebSocket Process /// </summary> /// <param name="r"></param> /// <param name="i"></param> public override void ShowForm(HttpListenerRequest r, int i) { var host = r.UrlReferrer == null ? string.Empty : r.UrlReferrer.Host; var pid = r.QueryString[KeyContext.QueryKey.ProcessId]; var sid = r.QueryString[KeyContext.QueryKey.SecurityId]; var mode = r.QueryString[KeyContext.QueryKey.Mode]; var authcode = r.QueryString[KeyContext.QueryKey.AuthCode]; //AES bool isRun = false; try { this.Cursor = Cursors.WaitCursor; //연속호출 체크 if (CheckOverlapRequest() == false) { return; } this.Cursor = Cursors.WaitCursor; string message = string.Empty; string eninsttcd = string.Empty; string enuserid = string.Empty; int sindex = -1; if (string.IsNullOrEmpty(pid) || string.IsNullOrEmpty(sid) || string.IsNullOrEmpty(mode) || string.IsNullOrEmpty(authcode)) { ShowBalloonTip("필수 매겨변수가 누락되었습니다.", ToolTipIcon.Error); return; } //개발모드가 아니면 도메인 체크 //if (ApplicationConfig.DevMode == false) //{ // if (string.IsNullOrEmpty(host) || // host.Equals(ApplicationConfig.ServerHostName, StringComparison.CurrentCultureIgnoreCase) == false) // { // ShowBalloonTip("정상적인 접근이 아닙니다.", ToolTipIcon.Error); // return; // } //} sindex = GetSecurityIndex(sid); if (sindex < 0 || lastSecurityId.Equals(sindex)) { ShowBalloonTip("정상적인 요청이 아닙니다.", ToolTipIcon.Error); return; } //복호화 string[] dec = GetDecryptUserId(sindex, authcode); if (string.IsNullOrEmpty(dec[0]) || string.IsNullOrEmpty(dec[1])) { ShowBalloonTip("복호화에 실패했습니다 \r\n 다시 호출해 주십시오.", ToolTipIcon.Error); return; } if (Request == null || Request.CORR_INSTT_CD.Equals(dec[0], StringComparison.CurrentCultureIgnoreCase) == false || Request.USR_ID.Equals(dec[1], StringComparison.CurrentCultureIgnoreCase) == false) { //사용자 정보 조회 isRun = SetUserAuthInfo(dec); } else { //마지막 호출 사용자와 현재 호출 사용자 비교 isRun = (Request.CORR_INSTT_CD.Equals(dec[0], StringComparison.CurrentCultureIgnoreCase) && Request.USR_ID.Equals(dec[1], StringComparison.CurrentCultureIgnoreCase)); } if (isRun == false || Request == null || string.IsNullOrEmpty(Request.USR_ID)) { ShowBalloonTip("사용자 인증에 실패 하였습니다.", ToolTipIcon.Error); return; } else { launcherService.ClearProcess(pid); } if (launcherService.Status == LauncherRunStatus.IsRuning) { RequestHistoryHelper.GetActiveItem(i).Message = string.Empty; RequestHistoryHelper.GetActiveItem(i).State = "Complete"; ProcessItem item = GetProcessInfo(r.QueryString); string prgName = launcherService.RunAt(item); if (string.IsNullOrEmpty(prgName) == false) { InteropHelper.SwitchToThisWindowApp(prgName); } } else { if (launcherService.Status.Equals(LauncherRunStatus.IsRuning) == false) { ShowBalloonTip("요청을 수행 할 수 없습니다. \r\n 프로그램을 다시 시작해 주십시오.", ToolTipIcon.Error); return; } } } catch (Exception ex) { this.Cursor = Cursors.Default; ShowBalloonTip(ex.Message, ToolTipIcon.Error); } finally { this.Cursor = Cursors.Default; } }