/// <summary> /// 启动服务 /// </summary> /// <param name="fileName">文件名</param> public static void startService() { readPlots(); m_userCookieService = new UserCookieService(); m_exportService = new ExportService(); m_userSecurityService = new UserSecurityService(); SecurityService.start(); }
/// <summary> /// 保存信息 /// </summary> public void save() { UserCookie cookie = new UserCookie(); cookie.m_key = "USERSECURITY"; cookie.m_value = JsonConvert.SerializeObject(m_codes); UserCookieService cookieService = DataCenter.UserCookieService; cookieService.addCookie(cookie); }
/// <summary> /// 设置COOKIE /// </summary> /// <param name="var">变量</param> /// <returns>结果</returns> private double SETCOOKIE(CVariable var) { String cookieName = m_indicator.getText(var.m_parameters[0]); UserCookieService cookieService = DataCenter.UserCookieService; UserCookie cookie = new UserCookie(); cookie.m_key = cookieName; cookie.m_value = m_indicator.getText(var.m_parameters[1]); return(cookieService.AddCookie(cookie)); }
/// <summary> /// 获取COOKIE /// </summary> /// <param name="var">变量</param> /// <returns>状态</returns> private double GETCOOKIE(CVariable var) { String cookieName = m_indicator.getText(var.m_parameters[1]); UserCookieService cookieService = DataCenter.UserCookieService; UserCookie cookie = new UserCookie(); if (cookieService.GetCookie(cookieName, ref cookie) > 0) { CVariable newVar = new CVariable(m_indicator); newVar.m_expression = "'" + cookie.m_value + "'"; m_indicator.setVariable(var.m_parameters[0], newVar); return(1); } return(0); }
/// <summary> /// 创建服务 /// </summary> public UserSecurityService() { UserCookie cookie = new UserCookie(); UserCookieService cookieService = DataCenter.UserCookieService; if (cookieService.getCookie("USERSECURITY", ref cookie) > 0) { try { m_codes = JsonConvert.DeserializeObject <List <UserSecurity> >(cookie.m_value); } catch (Exception ex) { } if (m_codes == null) { try { m_codes = JsonConvert.DeserializeObject <List <UserSecurity> >(cookie.m_value); } catch (Exception ex) { } } } }