/// <summary> /// 初始化(默认配置文件为 sales.config) /// </summary> private Configure() { _filepath = _fileDirect + "Nicholas.cfg"; _param = new ConfigParam(); bool isExistFile; if (File.Exists(_filepath)) { xDoc.Load(_filepath); isExistFile = true; } else { xDoc.AppendChild(xDoc.CreateElement("Config")); isExistFile = false; } xNode = xDoc.SelectSingleNode("//Config"); if (isExistFile) { ReadConfig(); } else { SaveConfig(); } }
private void AddParam(string key, string description, string type, bool general, string defalt) { bool commandLine = general ? generalCommandLineKeys.Contains(key) : specificCommandLineKeys.Contains(key); string shortKey = general ? (generalCommandLineShortKeys.ContainsKey(key) ? generalCommandLineShortKeys[key] : null) : (specificCommandLineShortKeys.ContainsKey(key) ? specificCommandLineShortKeys[key]: null); if (!_parameters.ContainsKey(key)) { _parameters.Add(key, new ConfigParam(key, description, type, general, Group, defalt, commandLine, shortKey)); } else { ConfigParam param = _parameters[key]; param.AddGroup(Group); if (!param.CommandLine && commandLine) { param.CommandLine = true; } if (param.ShortKey == null && shortKey != null) { param.ShortKey = shortKey; } } }
private static ConfigParam GetModelParam(ConfigInfo info) { var param = new ConfigParam { systemParam = new SystemParams(), ports = new Dictionary <string, string>() }; param.systemParam.testStation = info.TestStation; param.systemParam.comErrorTolarence = info.ComErrorTolarence; param.systemParam.conditionTimeout = info.ConditionTimeout; param.systemParam.heatTime = info.HeatTime; param.systemParam.tbiesServer = info.TbiesServer; param.ports["OvenPort"] = info.OvenPort; param.ports["Floor1"] = info.Floor1Port; param.ports["Floor2"] = info.Floor2Port; param.ports["Floor3"] = info.Floor3Port; param.ports["Floor4"] = info.Floor4Port; param.ports["Floor5"] = info.Floor5Port; param.ports["Floor6"] = info.Floor6Port; param.ports["Floor7"] = info.Floor7Port; param.ports["Floor8"] = info.Floor8Port; param.ports["Floor9"] = info.Floor9Port; param.ports["Floor10"] = info.Floor10Port; return(param); }
public void Run(ConfigParam configParam, params object[] parameters) { List <string> param = new List <string>(); if (parameters != null) { foreach (string p in parameters) { param.Add(p); } } Type type = GetClassType(className); object instance = CreateInstance(type); //dynamic instance = new DataCount(); MethodInfo mi = GetMethod(type, "StatFunc"); configParam.Result.BeginTime = DateTime.Now; RunMethod(mi, instance, new object[] { param.ToArray() }); configParam.Result.FinishTime = DateTime.Now; FieldInfo[] fi = { instance.GetType().GetField("dataTime", BindingFlags.Instance | BindingFlags.NonPublic), instance.GetType().GetField("totalBytes", BindingFlags.Instance | BindingFlags.NonPublic), instance.GetType().GetField("dataPath", BindingFlags.Instance | BindingFlags.NonPublic) }; configParam.Result.CountTime = (DateTime)fi[0].GetValue(instance); configParam.Result.TotalBytes = (long)fi[1].GetValue(instance); configParam.Result.DataPath = (HashSet <string>)fi[2].GetValue(instance); }
/// <summary> /// 启动配置服务 /// </summary> public static IServiceCollection AddNacosConfig(this IServiceCollection services, IConfigurationSection section) { var mainCfg = new ConfigParam(); section.Bind(mainCfg); return(AddNacosConfig(services, mainCfg)); }
/// <summary> /// 构造用户发送指令的配置信息 /// </summary> /// <param name="baseParametersList"></param> /// <returns></returns> public ConfigParam GetConfigParam(string strHeiPingCanShu, string strDaPeiZhiCanShu) { ConfigParam configparam = new ConfigParam(); try { string[] HeiPingCanShu = strHeiPingCanShu.Split('|'); string[] DaPeiZhiCanShu = strDaPeiZhiCanShu.Split('|'); //大配置信息 configparam.BigCfgIP = DaPeiZhiCanShu[0]; configparam.BigCfgPort = DaPeiZhiCanShu[1]; configparam.BigCfgOffice = DaPeiZhiCanShu[2]; configparam.BigCfgAccount = DaPeiZhiCanShu[3]; //小配置信息 configparam.WebBlackIP = HeiPingCanShu[0]; configparam.WebBlackPort = HeiPingCanShu[1]; configparam.WhiteScreenIP = HeiPingCanShu[2]; configparam.WhiteScreenPort = HeiPingCanShu[3]; configparam.Office = HeiPingCanShu[4]; configparam.WebBlackAccount = HeiPingCanShu[5]; configparam.WebBlackPwd = HeiPingCanShu[6]; configparam.ECPort = HeiPingCanShu[7]; configparam.TicketCompany = HeiPingCanShu[8]; configparam.IataCode = HeiPingCanShu[9]; } catch (Exception) { } return(configparam); }
public ClientWorker(ConfigParam config, IHttpAgent agent, ConfigFilterChainManager configFilterChainManager, LocalConfigInfoProcessor localConfigInfoProcessor) { _agent = agent; _configFilterChainManager = configFilterChainManager; _localConfigInfoProcessor = localConfigInfoProcessor; Init(config); _selfCheckConfigTimer = new Timer(x => { try { CheckConfigInfo(); } catch (Exception ex) { _logger.Error(ex, $"[{_agent.GetName()}] [sub-check] rotate check error"); } if (_selfCheckConfigTimer != null) { _selfCheckConfigTimer.Change(100, Timeout.Infinite); } }, null, 1, Timeout.Infinite); }
/// <summary> /// Applies configuration settings to the App.config file and updates the config object. /// </summary> /// <param name="initialPath"></param> /// <param name="configParam"></param> private void SetDirectoryInConfiguration(string initialPath, ConfigParam configParam, bool usePopup) { if (initialPath.StartsWith("%appdata%")) { initialPath = initialPath.Replace("%appdata%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); } if (usePopup) { if (Directory.Exists(initialPath)) { dlgOpenDirectory.SelectedPath = initialPath; } if (DialogResult.OK == dlgOpenDirectory.ShowDialog() && Directory.Exists(dlgOpenDirectory.SelectedPath)) { switch (configParam) { case ConfigParam.OriginalLogDirectory: config.OriginalLogsDirectory = dlgOpenDirectory.SelectedPath; break; case ConfigParam.OriginalScreenshotDirectory: config.OriginalScreenshotsDirectory = dlgOpenDirectory.SelectedPath; break; case ConfigParam.HighResolutionScreenshotsDirectory: config.HighResolutionScreenshotsDirectory = dlgOpenDirectory.SelectedPath; break; default: break; } } } else { switch (configParam) { case ConfigParam.OriginalLogDirectory: config.OriginalLogsDirectory = txtOriginalLogsDirectory.Text; break; case ConfigParam.OriginalScreenshotDirectory: config.OriginalScreenshotsDirectory = txtOriginalScreenshotsDirectory.Text; break; case ConfigParam.HighResolutionScreenshotsDirectory: config.HighResolutionScreenshotsDirectory = txtHighResolutionScreenshots.Text; break; default: break; } } }
public NacosConfigServiceTest() { _config = new ConfigParam { ServerAddr = new List <string> { "http://localhost:8443" }, LocalFileRoot = AppDomain.CurrentDomain.BaseDirectory, Namespace = "dev" }; }
/// <summary> /// 获取首页资讯信息 /// </summary> /// <param name="config"></param> /// <returns></returns> public DataTable GetIndex(ConfigParam config) { using (ISession s = SessionFactory.Instance.CreateSession()) { if (config != null) { string sql = "select * from v_info_informt where is_index = @0 and is_enable = @1 and catg_id in (" + config.config_value + ") order by order_index desc"; return(s.Fill(sql, true, true)); } return(null); } }
/// <summary> /// Read the configuration values from the passed node and /// update the target instance. /// </summary> /// <typeparam name="T">Target Instance type</typeparam> /// <param name="node">Configuration Node to read values from</param> /// <param name="target">Target Type instance</param> /// <returns>Updated Target Type instance</returns> private static T ReadValues <T>(ConfigPathNode node, T target, List <string> valuePaths) { Type type = target.GetType(); PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); if (properties != null) { foreach (PropertyInfo property in properties) { ConfigParam param = (ConfigParam)Attribute.GetCustomAttribute(property, typeof(ConfigParam)); if (param != null) { target = ProcessProperty(node, target, property, param, valuePaths); } ConfigAttribute attr = (ConfigAttribute)Attribute.GetCustomAttribute(property, typeof(ConfigAttribute)); if (attr != null) { target = ProcessProperty(node, target, property, attr, valuePaths); } ConfigValue value = (ConfigValue)Attribute.GetCustomAttribute(property, typeof(ConfigValue)); if (value != null) { target = ProcessProperty(node, target, property, value, valuePaths); } } } FieldInfo[] fields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); if (fields != null) { foreach (FieldInfo field in fields) { ConfigParam param = (ConfigParam)Attribute.GetCustomAttribute(field, typeof(ConfigParam)); if (param != null) { target = ProcessField(node, target, field, param, valuePaths); } ConfigAttribute attr = (ConfigAttribute)Attribute.GetCustomAttribute(field, typeof(ConfigAttribute)); if (attr != null) { target = ProcessField(node, target, field, attr, valuePaths); } ConfigValue value = (ConfigValue)Attribute.GetCustomAttribute(field, typeof(ConfigValue)); if (value != null) { target = ProcessField(node, target, field, value, valuePaths); } } } return(target); }
/// <summary> /// 登录用户信息转化 /// </summary> /// <param name="LoginIn"></param> /// <returns></returns> public SessionContent GetLoginUserModel(DataSet LoginIn) { //当前登录用户信息 User_Employees m_User = null; //当前登录公司信息 User_Company mCompany = null; //供应商和落地运营商公司信息 User_Company mSupCompany = null; //当前登录用户参数信息 List <Bd_Base_Parameters> baseParametersList = null; //落地运营商和供应商公司参数信息 List <Bd_Base_Parameters> SupParameters = null; //配置信息 ConfigParam configparam = null; //保存用户信息 SessionContent sessionContent = new SessionContent(); if (LoginIn.Tables.Count == 5) { m_User = MappingHelper <User_Employees> .FillModel(LoginIn.Tables[0].Rows[0]); mCompany = MappingHelper <User_Company> .FillModel(LoginIn.Tables[1].Rows[0]); baseParametersList = MappingHelper <Bd_Base_Parameters> .FillModelList(LoginIn.Tables[2]); mSupCompany = MappingHelper <User_Company> .FillModel(LoginIn.Tables[3].Rows[0]); SupParameters = MappingHelper <Bd_Base_Parameters> .FillModelList(LoginIn.Tables[4]); configparam = Bd_Base_ParametersBLL.GetConfigParam(SupParameters); } else if (LoginIn.Tables.Count == 3) { //管理员 m_User = MappingHelper <User_Employees> .FillModel(LoginIn.Tables[0].Rows[0]); mCompany = MappingHelper <User_Company> .FillModel(LoginIn.Tables[1].Rows[0]); baseParametersList = MappingHelper <Bd_Base_Parameters> .FillModelList(LoginIn.Tables[2]); } sessionContent.USER = m_User; // 用户信息 sessionContent.COMPANY = mCompany; // 公司信息 sessionContent.SUPCOMPANY = mSupCompany; //供应商和落地运营商公司信息 sessionContent.BASEPARAMETERS = baseParametersList; //公司参数信息 sessionContent.SupBASEPARAMETERS = SupParameters; //落地运营商和供应商公司参数信息 sessionContent.CONFIGPARAM = configparam; //配置信息 //设置到全局变量中 Program.UserModel = sessionContent; return(sessionContent); }
public void BindSupList() { //获取落地供应商 StringBuilder sbSelect = new StringBuilder(); sbSelect.Append("<select id=\"UserList\" style=\"width:250px;\" onchange=\"SetSel(this)\">\r\n"); if (Hid_sup.Value == "") { sbSelect.Append("<option value=\"\" selected=\"selected\">---请选择运营商---</option>\r\n"); } string key = "", Value = "", strHeiPingCanShu = "", strDaPeiZhiCanShu = "", CpyNo = "", UninAllName = ""; System.Data.DataTable table = this.baseDataManage.GetCompanyConfigInfo(); int i = 0; foreach (DataRow dr_item in table.Rows) { key = (dr_item["SetName"] != DBNull.Value ? dr_item["SetName"].ToString() : ""); if (key == "heiPingCanShu") { strHeiPingCanShu = (dr_item["SetValue"] != DBNull.Value ? dr_item["SetValue"].ToString() : ""); i++; } if (key == "daPeiZhiCanShu") { strDaPeiZhiCanShu = (dr_item["SetValue"] != DBNull.Value ? dr_item["SetValue"].ToString() : ""); i++; } if (i == 2) { CpyNo = (dr_item["UninCode"] != DBNull.Value ? dr_item["UninCode"].ToString() : ""); UninAllName = (dr_item["UninAllName"] != DBNull.Value ? dr_item["UninAllName"].ToString() : ""); ConfigParam CP = GetConfigParam(strHeiPingCanShu, strDaPeiZhiCanShu); Value = CpyNo + "#" + CP.Office + "$@@@@$" + strHeiPingCanShu + "@@@@" + strDaPeiZhiCanShu; if (Hid_sup.Value != "" && Hid_sup.Value == Value) { sbSelect.AppendFormat("<option value=\"{0}\" selected=\"true\">{1}</option>\r\n", Value, UninAllName); } else { sbSelect.AppendFormat("<option value=\"{0}\">{1}</option>\r\n", Value, UninAllName); } i = 0; } } sbSelect.Append("</select>"); UserSeelct.Text = sbSelect.ToString(); }
protected override void CreateDefaultConfigParams() { ConfigParam.Add(new ConfigParam { Name = "hostname", Value = "Counter-Strike 1.6 Server", DefaultValue = "Counter-Strike 1.6 Server", Type = ConfigParamType.String }); ConfigParam.Add(new ConfigParam { Name = "rcon_password", Value = "csrcon_password", DefaultValue = "csrcon_password", Type = ConfigParamType.String }); ConfigParam.Add(new ConfigParam { Name = "sv_password", Value = "csserver_password", DefaultValue = "csserver_password", Type = ConfigParamType.String }); ConfigParam.Add(new ConfigParam { Name = "mp_timelimit", Value = 20, DefaultValue = 20, Type = ConfigParamType.Int }); //ConfigParam.Add(new ConfigParam { Name = "mapcyclefile", Value = 20, DefaultValue = 20, Type = ConfigParamType.Array}); }
/// <summary> /// Applies configuration settings to the App.config file and updates the config object. /// </summary> /// <param name="initialPath"></param> /// <param name="configParam"></param> private void SetDirectoryInConfiguration(string initialPath, ConfigParam configParam) { if (initialPath.StartsWith("%appdata%")) { initialPath = initialPath.Replace("%appdata%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); } if (Directory.Exists(initialPath)) { dlgOpenDirectory.SelectedPath = initialPath; } if (DialogResult.OK == dlgOpenDirectory.ShowDialog() && Directory.Exists(dlgOpenDirectory.SelectedPath)) { switch (configParam) { case ConfigParam.OriginalLogDirectory: config.OriginalLogsDirectory = dlgOpenDirectory.SelectedPath; break; case ConfigParam.OriginalScreenshotDirectory: config.OriginalScreenshotsDirectory = dlgOpenDirectory.SelectedPath; break; case ConfigParam.CopiedScreentshotDirectory: config.CopiedScreenshotsDirectory = dlgOpenDirectory.SelectedPath; break; case ConfigParam.RemovedScreenshotDirectory: config.RemovedScreenshotsDirectory = dlgOpenDirectory.SelectedPath; break; case ConfigParam.RmobOutputDirectory: config.RmobFilesDirectory = dlgOpenDirectory.SelectedPath; break; case ConfigParam.UpdatedLogDirectory: config.UpdatedLogsDirectory = dlgOpenDirectory.SelectedPath; break; default: break; } } }
static void GetConfig(bool isFirst) { string url = "http://ConfigServer/api/config/Config/Pro"; #if DEBUG url = "http://" + ConfigServer + "/api/config/Config/Dev"; #endif ConfigParam configParam = new ConfigParam { env = ENV, group = GROUP }; RequestParam requestParam = new RequestParam { method = "GetConfig", param = configParam }; string body = JsonConvert.SerializeObject(requestParam); try { string resp = Utils.PostHttp(url, body, "application/json"); ResponseObj responseObj = JsonConvert.DeserializeObject <ResponseObj>(resp); foreach (ConfigItem item in responseObj.data) { Environment.SetEnvironmentVariable(item.key, item.value); } DatabaseOperation.TYPE = new DBManager(); RedisManager.ConfigurationOption = REDIS; Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "> " + "加载配置信息完成"); if (isFirst) { Subscribe(); } } catch (Exception e) { Console.WriteLine(url); Console.WriteLine(e.StackTrace); Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "> " + "加载配置信息失败"); } }
/// <summary> /// Unfortunately, the label is the only somewhat unique ID we'll have to work with, unless /// we were to use state mechanisms in ASP.NET. /// </summary> public ConfigParam this[string i_sLabel] // FIX - Why is this the 'label' and not the 'name'? { get { ConfigParam paramRet = null; int ii, iNumParams; iNumParams = List.Count; for (ii = 0; ii < iNumParams; ii++) { if (((ConfigParam)(List[ii])).Label == i_sLabel) { paramRet = ((ConfigParam)(List[ii])); } } return(paramRet); } }
private void LoadParameter(ConfigParam value) { textInput.Items.Clear(); switch (value.Type) { case ParameterTypes.Bool: BoolLoaded(); break; case ParameterTypes.Folder: case ParameterTypes.File: FileLoaded(); break; case ParameterTypes.Enum: EnumLoaded(); break; case ParameterTypes.Vector3: case ParameterTypes.Double: case ParameterTypes.Float: case ParameterTypes.Int: case ParameterTypes.String: StringLoaded(); break; } }
/// <summary> /// Find the parameter values for the method. /// </summary> /// <param name="pnode">Parameters Node</param> /// <param name="method">Method Name</param> /// <param name="parameters">Parameters</param> /// <returns>List of object values</returns> private static List <object> FindParameters(ConfigParametersNode pnode, string method, ParameterInfo[] parameters) { List <object> values = new List <object>(); foreach (ParameterInfo pi in parameters) { ConfigParam param = (ConfigParam)Attribute.GetCustomAttribute(pi, typeof(ConfigParam)); if (param != null) { object v = null; ConfigValueNode cv = pnode.GetValue(param.Name); if (cv != null) { string value = cv.GetValue(); if (!String.IsNullOrWhiteSpace(value)) { v = ReflectionUtils.ConvertFromString(pi.ParameterType, value); } } if (v != null) { values.Add(v); } else { throw new AnnotationProcessorException(String.Format("Error Invoking Method: Value not found for parameter. [method={0}][parameter={1}]", method, pi.Name)); } } else { throw new AnnotationProcessorException(String.Format("Error Invoking Method: Annotation not defined for parameter. [method={0}][parameter={1}]", method, pi.Name)); } } if (values.Count > 0) { return(values); } return(null); }
public ServerHttpAgentTest() { _config = new ConfigParam { ServerAddr = new List <string>() { "http://test:8338" }, EndPoint = "http://server:8338", Namespace = "default" }; _mockHttp = new MockHttpMessageHandler(); _getMockedRequest = _mockHttp.When(HttpMethod.Get, _config.ServerAddr[0] + "/g") .WithQueryString("k1", "v1") .WithHeaders("Client-Version", ServerHttpAgent.VERSION) .WithHeaders("User-Agent", ServerHttpAgent.VERSION) .WithHeaders("Request-Module", "Naming") .WithHeaders("h1", "v1") .Respond("application/json", "ok"); _postMockedRequest = _mockHttp.When(HttpMethod.Post, _config.ServerAddr[0] + "/p") .WithQueryString("k2", "v2") .WithHeaders("Client-Version", ServerHttpAgent.VERSION) .WithHeaders("User-Agent", ServerHttpAgent.VERSION) .WithHeaders("Request-Module", "Naming") .WithHeaders("h2", "v2") .Respond("application/json", "ok"); _deleteMockedRequest = _mockHttp.When(HttpMethod.Delete, _config.ServerAddr[0] + "/d") .WithQueryString("k3", "v3") .WithHeaders("Client-Version", ServerHttpAgent.VERSION) .WithHeaders("User-Agent", ServerHttpAgent.VERSION) .WithHeaders("Request-Module", "Naming") .WithHeaders("h3", "v3") .Respond("application/json", "ok"); _endpointMockedReqeust = _mockHttp.When(HttpMethod.Get, _config.EndPoint + "/nacos/serverlist") .Respond("plain/text", "http://test:8338\r\n"); }
/// <summary> /// 根据上级ID获取 /// </summary> /// <param name="parentId"></param> /// <returns></returns> public List <InformtCatg> GetIndexCtgy(ConfigParam config) { using (ISession s = SessionFactory.Instance.CreateSession()) { if (config != null) { //资讯类别 List <InformtCatg> catgs = new List <InformtCatg>(); foreach (string id in config.config_value.Split(',')) { InformtCatg cgty = s.Get <InformtCatg>(long.Parse(id)); if (cgty != null) { catgs.Add(cgty); } } return(catgs); } return(null); } }
/// <summary> /// 获取供应配置信息 /// </summary> /// <param name="strHeiPingCanShu"></param> /// <param name="strDaPeiZhiCanShu"></param> /// <returns></returns> public static ConfigParam GetConfigParam(string strHeiPingCanShu, string strDaPeiZhiCanShu) { ConfigParam configparam = new ConfigParam(); try { string[] HeiPingCanShu = strHeiPingCanShu.Split('|'); string[] DaPeiZhiCanShu = strDaPeiZhiCanShu.Split('|'); //大配置信息 configparam.BigCfgIP = DaPeiZhiCanShu[0]; configparam.BigCfgPort = DaPeiZhiCanShu[1]; configparam.BigCfgOffice = DaPeiZhiCanShu[2]; configparam.BigCfgAccount = DaPeiZhiCanShu[3]; //小配置信息 configparam.WebBlackIP = HeiPingCanShu[0]; configparam.WebBlackPort = HeiPingCanShu[1]; configparam.WhiteScreenIP = HeiPingCanShu[2]; configparam.WhiteScreenPort = HeiPingCanShu[3]; configparam.Office = HeiPingCanShu[4]; configparam.WebBlackAccount = HeiPingCanShu[5]; configparam.WebBlackPwd = HeiPingCanShu[6]; configparam.ECPort = HeiPingCanShu[7]; configparam.TicketCompany = HeiPingCanShu[8]; configparam.IataCode = HeiPingCanShu[9]; if (HeiPingCanShu.Length > 10) { string pidkeyno = HeiPingCanShu[10]; string[] strArr = pidkeyno.Split('^'); if (strArr.Length == 2) { configparam.Pid = strArr[0]; configparam.Pid = strArr[1]; } } } catch (Exception) { } return(configparam); }
/// <summary> /// 保存配置 /// </summary> /// <param name="user"></param> /// <param name="param"></param> /// <returns></returns> public JsonResult SaveConfigParamForm(SysUser user, ConfigParam param) { try { if (param.id == 0) { param.created_user_id = user.id; param.created_date = DateTime.Now; ServiceIoc.Get <ConfigParamService>().Insert(param); } else { param.updated_user_id = user.id; param.updated_date = DateTime.Now; ServiceIoc.Get <ConfigParamService>().Update(param); } } catch { return(Json(GetResult(StateCode.State_500))); } return(Json(GetResult(StateCode.State_200))); }
public BIModelTOSA(ConfigParam param, log4net.ILog logger, IDatabaseService dbStore) { _configParam = param; log = logger; _dbService = dbStore; try { _fetchPlans = FetchPlans.Inst(_configParam.systemParam.tbiesServer); _boardFactory = BoardFactory.Instance(log, _fetchPlans, _configParam.ports); _mesOperator = BiModelFactory.GetMesOperator(); boardManager = new BoardManager(log, dbStore, BiModelFactory.CreateIPosMapScheme(dbStore), _boardFactory, param.systemParam); unitManager = new UnitManager(log, param.systemParam); SyncDbStore(dbStore); InitTimer(); } catch (Exception ex) { log.Error(ex.Message); log.Error(ex.StackTrace); } }
private void Init(ConfigParam config) { _serverList = config.ServerAddr; _endpoint = config.EndPoint; if (_serverList != null && _serverList.Count == 1) { _nacosDomain = _serverList.First(); } if (_serverList != null && _serverList.Count > 0) { if (string.IsNullOrEmpty(config.Namespace)) { _name = $"{FIXED_NAME}-{GetFixedNameSuffix(_serverList)}"; } else { _tenant = config.Namespace; _name = $"{FIXED_NAME}-{GetFixedNameSuffix(_serverList)}-{config.Namespace}"; } } else { if (string.IsNullOrEmpty(config.Namespace)) { _name = _endpoint; } else { _tenant = config.Namespace; _name = $"{_endpoint}-{config.Namespace}"; } } InitRefreshSrvIfNeed(); }
/// <summary> /// 初始化参数配置 /// </summary> /// <param name="user"></param> /// <returns></returns> public ActionResult ConfigParamForm(SysUser user, ConfigParam entity = null) { if (Request.IsAjaxRequest()) { //保存菜单 StateCode code = ServiceIoc.Get <ConfigParamService>().Save(user.id, entity); //初始化 AppGlobal.Instance.Initial(); //返回数据 return(Json(GetResult(code))); } else { entity = ServiceIoc.Get <ConfigParamService>().GetById(bid); if (entity != null) { ViewBag.key = entity.config_key; ViewBag.entity = JsonConvert.SerializeObject(entity); } } return(View()); }
private void LoadParameter(ConfigParam parameter) { int row = parametersList.Rows.Add(parameter.Key, parameter, parameter.Default, parameter.Section, parameter.Description); }
/// <summary> /// 获取指令数据 /// </summary> /// <param name="SendIns"></param> /// <param name="Office"></param> /// <param name="cpyNo">公司编号</param> /// <returns></returns> public string GetData(string SendIns, string Office, string cpyNo, string Other) { string recvData = string.Empty; try { ConfigParam CP = null; if (!string.IsNullOrEmpty(Other)) { string[] strArr = Other.Split(new string[] { "@@@@" }, StringSplitOptions.None); string strHeiPingCanShu = strHeiPingCanShu = strArr[0]; string strDaPeiZhiCanShu = strArr[1]; CP = GetConfigParam(strHeiPingCanShu, strHeiPingCanShu); } if (string.IsNullOrEmpty(SendIns)) { recvData = "发送指令为空"; return(recvData); } if (CP == null) { recvData = "参数错误"; return(recvData); } IHashObject param = new HashObject(); string sqlWhere = string.Format("UninCode='{0}' and RoleType in(2,3) ", cpyNo); User_Company m_Company = null; List <User_Company> CompanyList = baseDataManage.CallMethod("User_Company", "GetList", null, new object[] { sqlWhere }) as List <User_Company>; if (CompanyList != null && CompanyList.Count > 0) { //该公司实体 m_Company = CompanyList[0]; //该公司参数表信息 List <Bd_Base_Parameters> db_param = baseDataManage.CallMethod("Bd_Base_Parameters", "GetList", null, new object[] { "CpyNo='" + cpyNo + "'" }) as List <Bd_Base_Parameters>; string Mark = BaseParams.getParams(db_param).KongZhiXiTong; string bigIP = "127.0.0.1", bigPort = "391", BigOffice = ""; string IP = "127.0.0.1", Port = "391"; Tb_SendInsData sendins = new Tb_SendInsData(); sendins.SendInsType = 11; //标识为控台系统发送的指令 sendins.UserAccount = mUser != null ? mUser.LoginName : "控台管理员"; sendins.CpyNo = mUser != null ? mUser.CpyNo : "控台管理员"; //查找白屏预订Pid的IP地址 IP = CP.WhiteScreenIP; //查找白屏预订Pid的端口 Port = CP.WhiteScreenPort; //查找大配置IP bigIP = CP.BigCfgIP; //查找大配置Port bigPort = CP.BigCfgPort; //查找大配置Office BigOffice = CP.BigCfgOffice; //使用的IP 端口 Office string ServerIP = ""; int ServerPort = 0; //是否开启大配置 bool IsUseBigConfig = Mark.Contains("|39|"); //是有使用新的PID bool IsUseNewPid = Mark.Contains("|48|"); if (IsUseBigConfig) { //大配置 int _Port = 451; int.TryParse(bigPort, out _Port); ServerIP = bigIP; ServerPort = _Port; //大配置Office Office = BigOffice; } else { int.TryParse(Port, out ServerPort); ServerIP = IP; } string[] OfficeNum = null; string tempOffice = CP.Office;//GetValue("office", db_param); if (Office == "") { //空台设置的Office OfficeNum = tempOffice.Split(new string[] { "|", " ", "/", ",", ",", "\\", "#", "^" }, StringSplitOptions.RemoveEmptyEntries); } else { //空台设置的Office OfficeNum = Office.Split(new string[] { "|", " ", "/", ",", ",", "\\", "#", "^" }, StringSplitOptions.RemoveEmptyEntries); } ///使用新的PID if (IsUseNewPid) { //DataModel.A2 = "新的PID"; // WebManage.ServerIp = ServerIP; // WebManage.ServerPort = ServerPort; ParamObject Pm = new ParamObject(); Pm.ServerIP = ServerIP; Pm.ServerPort = ServerPort; bool IsPn = false;//是否PN string patternPnr = @"\s*(?<=rt|\(eas\)rt|rtx/|\(eas\)rtx/)(?=\w{6})\s*"; Match mch = Regex.Match(SendIns, patternPnr, RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase); if (mch.Success) { IsPn = true; } SendIns = SendIns.ToLower().StartsWith("ig|") ? SendIns.Trim().Substring(2) : SendIns; if (Office != "" && Office.IndexOf("|") == -1) { //发送指令数据 SendIns = SendIns.Replace("\n", "").Replace("\r", "^"); //去掉ig SendIns = SendIns.ToLower().StartsWith("ig|") ? SendIns.Trim().Substring(3).ToLower() : SendIns.ToLower(); sendins.SendIns = SendIns; sendins.Office = Office; sendins.ServerIPAndPort = ServerIP + ":" + ServerPort; sendins.SendTime = System.DateTime.Now; Pm.code = SendIns; Pm.IsPn = IsPn; Pm.Office = Office; recvData = SendNewPID.SendCommand(Pm); //recvData = WebManage.SendCommand(SendIns, Office, IsPn, false, ServerIP, ServerPort); sendins.RecvTime = System.DateTime.Now; if (recvData == null) { recvData = ""; } recvData = recvData.Replace("^", "\r"); sendins.RecvData = recvData; //添加日志 AddLog(sendins); } if (recvData.Contains("授权") || Office == "") { foreach (string _Office in OfficeNum) { if (_Office.ToLower() != Office.ToLower()) { Office = _Office.ToLower(); //发送指令数据 SendIns = SendIns.Replace("\n", "").Replace("\r", "^"); //去掉ig SendIns = SendIns.ToLower().StartsWith("ig|") ? SendIns.Trim().Substring(3).ToLower() : SendIns.ToLower(); sendins.SendIns = SendIns; sendins.Office = Office; sendins.ServerIPAndPort = ServerIP + ":" + ServerPort; sendins.SendTime = System.DateTime.Now; Pm.code = SendIns; Pm.IsPn = IsPn; Pm.Office = Office; recvData = SendNewPID.SendCommand(Pm); //recvData = WebManage.SendCommand(SendIns, _Office, IsPn, false, ServerIP, ServerPort); sendins.RecvTime = System.DateTime.Now; if (recvData == null) { recvData = ""; } recvData = recvData.Replace("^", "\r"); sendins.RecvData = recvData; //添加日志 AddLog(sendins); } if (!recvData.Contains("授权")) { break; } } } } else { Office = (Office == "" ? "" : "&" + Office.TrimEnd('$').Trim() + "$") + "#1"; ECParam ecParam = new ECParam(); ecParam.ECIP = ServerIP; ecParam.ECPort = ServerPort.ToString(); //ecParam.PID = supModel.PId; //ecParam.KeyNo = supModel.KeyNo; ecParam.UserName = mUser == null ? "控台管理员" : mUser.UserName; SendEC sendec = new SendEC(ecParam); if (Office != "") { //发送指令数据 //logPnr.SSContent = "[EC:" + ServerIP + ":" + ServerPort + "|" + Office + "]" + SendIns + Office; sendins.Office = Office; sendins.ServerIPAndPort = ServerIP + ":" + ServerPort; sendins.SendTime = System.DateTime.Now; sendins.SendIns = SendIns + Office; recvData = sendec.SendData(SendIns + Office, out recvData); sendins.RecvData = recvData; sendins.RecvTime = System.DateTime.Now; // logPnr.ResultContent = recvData; //添加日志 AddLog(sendins); } if (recvData.Contains("授权") || Office == "" || Office == "#1") { tempOffice = ""; foreach (string _Office in OfficeNum) { if (_Office.ToLower() != Office.ToLower()) { tempOffice = (_Office == "" ? "" : "&" + _Office.TrimEnd('$').Trim() + "$") + "#1"; //logPnr.SSContent = "[EC:" + ServerIP + ":" + ServerPort + "|" + Office + "]" + SendIns + Office; //发送指令数据 sendins.SendIns = SendIns + Office; sendins.Office = _Office; sendins.ServerIPAndPort = ServerIP + ":" + ServerPort; sendins.SendTime = System.DateTime.Now; recvData = sendec.SendData(SendIns + tempOffice, out recvData); sendins.RecvData = recvData; sendins.RecvTime = System.DateTime.Now; // logPnr.ResultContent = recvData; //添加日志 AddLog(sendins); } if (!recvData.Contains("授权")) { break; } } } } } else { recvData = "该供应商不存在"; return(recvData); } } catch (Exception ex) { recvData = System.DateTime.Now + ":" + ex.Message + "|" + ex.StackTrace.ToString(); } return(escape(recvData)); }
public FastHttp(IHttpClientFactory httpClientFactory, ConfigParam config) { _httpClientFactory = httpClientFactory; _config = config; }
protected override void InitConfig() { //General ExperimentName = GetStr("ExperimentName", "Experiment", "The name of the experiment. Controls the folder where the results will be written to."); //mRunInfo = GetGeneralParam("RunInfo", Mode.ToString(), "The name of the specific run happening."); RunInfo = GetStr("RunInfo", Mode.ToString(), "The name of the specific run happening."); OneSecMininum = Get("LimitFrequency", true, "Whether to limit the maximum log frequency to one log per second. Viewer timestamps only go to the second so finer grained logging is not possible."); TimestampFormat = GetStr("TimestampFormat", TimestampFormat, "The format that all timestamps will be saved as. Should match second life's log's timestamps."); IncludeTimestamp = Get("IncludeTimestamp", true, "Whether to include a timestamp in file names when saving results."); ProcessOnFinish = Get("ProcessResults", false, "Whether to process the log files to <ExperimentName>/RunInfo(-<Timestamp>).csv file when closing."); string outputKeysStr = GetSection("Recorder", "OutputKeys", "CFPS,SFPS,FT", "The columns the output table should have. Each column is separted by a comma. Valid keys are: CFPS, SFPS, FT, PingTime."); OutputKeys = outputKeysStr.Split(','); RepeatCode = Get("RepeatCode", 12, "The exit code to use if the application should be launched again."); //Movement Tracker ExperimentFile = GetFileSection("MovementTracker", "File", null, "The xml file which defines the experiment."); FPSFolder = GetFolderSection("MovementTracker", "FPSFolder", "FPS", "The folder where FPS results will be written to."); //Avatar movement NodesFile = GetFileSection("AvatarMovement", "NodesFile", "Experiments/Cathedral.xml", "The xml file where the nodes which are potential targets for navigating to are stored."); TargetsFile = GetFileSection("AvatarMovement", "TargetsFile", "Experiments/CathedralRoute.xml", "The xml file where the nodes which make up a route are stored."); MapFile = GetFileSection("AvatarMovement", "MapFile", null, "The file where the map image one which the route is to be drawn on is stored."); UserSettingsFolder = GetFolderSection("AvatarMovement", "UserSettingsFolder", "C:/Users/johnmcc/AppData/Roaming/Firestorm/user_settings/", "The folder where the settings file will be loaded from."); SettingsFile = GetFileSection("AvatarMovement", "SettingsFile", null, "The file where the configuration of the client is to be loaded from."); Region = GetSection("AvatarMovement", "Region", "Cathedral 1", "The region to connect to."); Mode = GetEnum<ControlMode>("AvatarMovement", "Mode", ControlMode.Delta, "What mode the system should be in for the run.", LogManager.GetLogger("Experiments")); StartWaitMS = Get("AvatarMovement", "StartWaitMS", 0, "How many MS to wait before starting the loop."); AutoStart = Get("AvatarMovement", "AutoStart", false, "Whether to start the loop as soon as the plugin is enabled."); AutoShutdown = Get("AvatarMovement", "AutoShutdown", false, "Whether to stop Chimera when the route is completed. Will only work if Loop is disabled."); Loop = Get("AvatarMovement", "Loop", false, "Whether to start the loop again when it finishes."); StartAtHome = Get("AvatarMovement", "StartAtHome", false, "Whether to teleport the avatar home before starting. Overrides TeleportToStart if set."); SaveResults = Get("AvatarMovement", "SaveFPS", true, "Whether to save the log 'Experiments/<ExperimentName>/<Timestamp>-RunInfo(-Frame).log'."); TeleportToStart = Get("AvatarMovement", "TeleportToStart", false, "<CURRENTLY DOES NOT WORK> Whether to use the map dialog to teleport the avatar to the start location specified in RecorderBot / StartIsland/StartLocation. Won't work if StartAtHome is enabled."); MoveMouseOffscreen = Get("AvatarMovement", "MoveMouseOffscreen", true, "Whether the mouse should be moved off screen before the run starts."); StartupKeyPresses = GetSection("AvatarMovement", "StartupKeyPress", "", "Key presses which will be sent to the viewer before the run starts, separated by commas.").Split(','); TurnRate = Get("AvatarMovement", "TurnRate", .01, "How far the camera will turn each tick."); MoveRate = Get("AvatarMovement", "MoveRate", .03f, "How far the camera will move each tick."); HeightOffset = Get("AvatarMovement", "HeightOffset", 1f, "How much above the floor nodes the target is."); DistanceThreshold = Get("AvatarMovement", "DistanceThreshold", .5f, "How far away from a target the position has to be before the target is considered hit."); //Recorder Bot FirstName = GetSection("RecorderBot", "FirstName", "Recorder", "The first name of the bot that will be logged in to track server stats."); LastName = GetSection("RecorderBot", "LastName", "Bot", "The last name of the bot that will be logged in to track server stats."); Password = GetSection("RecorderBot", "Password", "password", "The password for the bot that will be logged in to track server stats."); AutoLogin = Get("RecorderBot", "AutoLogin", false, "Whether the bot should automatically log in as soon as the plugin is enabled."); StartLocation = GetV("RecorderBot", "StartLocation", new Vector3(128f, 128f, 24f), "Where on the island the bot should be logged in to."); StartIsland = GetSection("RecorderBot", "StartIsland", "Cathedral 1", "Which island the bot should log in to."); UpdateStatsGUI = Get("RecorderBot", "UpdateStatsGUI", false, "Whether to regularly update the Recorder's GUI with Recorder bot stats."); //Settings Changer Setting = GetSection("SettingsChanger", "Setting", null, "Which of the viewer's debug settings to change each launch."); mIncrement = GetParam("SettingsChanger", "Increment", .01f, "The amount to increment 'Value' for before the next run."); IncrementMultiplier = Get("SettingsChanger", "IncrementMultiplier", 1f, "How much to multiply the increment by after every run. Allows log scales. Leave at 1 for normal incrementing."); Max = Get("SettingsChanger", "Max", .2f, "The amount for value to reach before the test stops."); mValue = GetParam("SettingsChanger", "Value", .01f, "The current value to set 'Setting' to on this run. Will be incremented by 'Increment' after being set."); SettingsChangerEnabled = Get("SettingsChanger", "Enabled", true, "Whether the settings changer pluging should be enabled. If false 'Setting' will not be changed.");
/// <summary> /// Process the annotated field and set the values from the configuration parameters. /// </summary> /// <typeparam name="T">Target Instance type</typeparam> /// <param name="node">Configuration Node</param> /// <param name="target">Target Type instance.</param> /// <param name="field">Property to update</param> /// <param name="param">Config param annotation</param> /// <returns>Updated Target Type instance.</returns> private static T ProcessField <T>(ConfigPathNode node, T target, FieldInfo field, ConfigParam param, List <string> valuePaths) { string pname = param.Name; if (String.IsNullOrWhiteSpace(pname)) { pname = field.Name; } string value = null; if (!String.IsNullOrWhiteSpace(param.Path)) { AbstractConfigNode nnode = node.Find(param.Path); if (nnode != null && nnode.GetType() == typeof(ConfigPathNode)) { node = (ConfigPathNode)nnode; } else { node = null; } } if (node != null) { ConfigParametersNode pnode = node.GetParameters(); if (pnode != null) { ConfigValueNode vn = pnode.GetValue(pname); if (vn != null) { value = vn.GetValue(); } if (valuePaths != null) { valuePaths.Add(pnode.GetSearchPath()); } } } if (!String.IsNullOrWhiteSpace(value)) { object v = GetValue <T>(pname, value, param.Function, field.FieldType, target, param.Required); if (v != null) { TypeUtils.CallSetter(field, target, v); } } else if (param.Required) { throw AnnotationProcessorException.Throw(target.GetType(), pname); } return(target); }
private static extern int SetValue(IntPtr desc, ConfigParam configParam, ConfigValue configValue);