/// <summary> /// 获取配置值集合 /// </summary> /// <typeparam name="T">值类型</typeparam> /// <param name="configSetting">配置节</param> /// <param name="name">值名</param> /// <param name="settingName">集合值名</param> /// <param name="initializer">对元素进行初始化</param> /// <returns>配置值集合</returns> public static ICollection <T> GetRequiredSettingsWithInitializer <T>(this IConfigSetting configSetting, string name, string settingName, Action <T> initializer) where T : IConfigSettingElement, new() { var list = new List <T>(); if (configSetting != null) { var setting = configSetting[name]; if (setting != null) { var settings = string.IsNullOrEmpty(settingName) ? setting.GetChildSettings() : setting.GetChildSettings(settingName); foreach (var item in settings) { var t = item.ToSetting <T>(); if (initializer != null) { initializer(t); } list.Add(t); } } else { throw new ConfigException(string.Format("必须配置节点 {0}", name)); } } return(list); }
/// <summary> /// Initializes a new instance of the <see cref="LoginBll" /> class. /// </summary> /// <param name="config">The config value.</param> public LoginBll(IConfigSetting config, IUnitOfWork unitOfWork, IAdService adService, IRoleBll roleBll) { _config = config; _unitOfWork = unitOfWork; _adService = adService; _roleBll = roleBll; }
private bool ImportPlugInSettings(string dir, IConfigSetting set, bool clean) { bool r = false; Dictionary <string, string> gs = new Dictionary <string, string>(); gs.Add("p17a988de71b3fb81d5cc2d6612dfe072", "Motion.PlugIns.Alarm.EMail.xml"); gs.Add("p4f2679987e0e6e85cf70ca40feaac595", "Motion.PlugIns.Alarm.Sound.xml"); gs.Add("p1f25f05340a17e6e6acdf656d3360ea0", "Motion.PlugIns.IPCam.General.xml"); gs.Add("p532c301e3373bcd1b7a0b63e9367e5d1", "Motion.PlugIns.IPCam.Axis.xml"); gs.Add("pe5087ee4b071dafd9744d6201dbe65b8", "Motion.PlugIns.USBCam.General.xml"); foreach (KeyValuePair <string, string> kv in gs) { string f = Path.Combine(dir, kv.Value); if (File.Exists(f)) { XMLConfig x = new XMLConfig(f, true); XMLConfigSetting i = x.Settings["motion"] as XMLConfigSetting; XMLConfigSetting d = set[kv.Key] as XMLConfigSetting; d.Copy(i); r = true; if (clean) { File.Delete(f); } } } return(r); }
/// <summary> /// 获取配置值 /// </summary> /// <typeparam name="T">值类型</typeparam> /// <param name="configSetting">配置节</param> /// <param name="name">值名</param> /// <param name="defaultValue">值缺省值</param> /// <param name="required">是否必须配置</param> /// <returns>配置值</returns> public static object GetSetting(this IConfigSetting configSetting, string name, Type type, object defaultValue = null, bool required = false) { if (configSetting == null) { return(defaultValue); } if (type == typeof(string) || type.IsValueType) { var settingValue = configSetting.GetSettingValue(name); if (settingValue == null && required) { throw new ConfigException($"{configSetting.Name} 必须配置 {name} 节点"); } return(settingValue == null ? defaultValue : settingValue.TryToObject(type, defaultValue)); } if (typeof(IConfigSettingElement).IsAssignableFrom(type)) { var setting = name == null ? configSetting : configSetting[name]; if (setting == null && required) { throw new ConfigException($"{configSetting.Name} 必须配置 {name} 节点"); } return(setting.ToSetting(type)); } return(defaultValue); }
protected virtual bool Validate(IConfigSetting x) { IConfigSetting i = x["license"]; this.mUsername = "******"; this.mVersion = null; string k = "<RSAKeyValue><Modulus>plCFGoZo+FV6WC0Za3DhlWJgx4Ifs8P2iMNcQip2zwLvwnWozsxZZ9/SbzA1FPXxX5rW+Wttec2iGohLiQiQDBYvPRlccBQgAk7GeTicyFqYZ8KuON0XgNfe1TSf5a17YBgfjI/zNaUypchUoMqMZHTho8UEaEa6pomtfOY3grs=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(k); #if SAFE_ANYWHERE_WITHUK string p = this.HostID; #else string p = i["username"].Value; #endif string s = i["signature"].Value; bool b = rsa.VerifyData(System.Text.UTF8Encoding.ASCII.GetBytes(p), new SHA1CryptoServiceProvider(), Convert.FromBase64String(s)); if (b) { this.mUsername = i["username"].Value; this.mVersion = x["version"].Value; } return(b); }
protected override bool Validate(IConfigSetting x) { bool r = false; try { this.mVersion = x["version"].Value; switch (x["version"].intValue) { case 2: r = this.ValidateV2(x["license"]); break; default: r = this.ValidateV1(x["license"]); break; } } catch (Exception) { r = false; } if (false == r) { this.mCount = 0; this.mUsername = "******"; this.mVersion = null; } return r; }
/// <summary> /// 初始化,由框架调用 /// </summary> /// <param name="setting"></param> public void Init(IConfigSetting setting) { if (!this.initialized) { this.setting = setting; this.questions = new CollectionBase<Question>(); IConfigSetting[] questionSettings = setting["questions"].GetChildSettings(); for (int i = 0; i < questionSettings.Length; i++) { string id = questionSettings[i].Property["id"].Value; if (this.questions.Contains(id)) { throw new Exception("重复加载"); } Question question = new Question(); question.ID = questionSettings[i].Property["id"].Value; question.Text = questionSettings[i].Property["text"].Value; question.Answer = questionSettings[i].Property["answer"].Value; this.questions.Add(id,question); } this.initialized = true; } }
public static void Save(IConfigSetting s, System.Windows.Forms.Form f) { s["w"].intValue = f.Width; s["h"].intValue = f.Height; s["l"].intValue = f.Left; s["t"].intValue = f.Top; }
public void SaveConfig(IConfigSetting i) { i.RemoveChildren(); i["version"].floatValue = 2.0F; i["id"].Value = this.ID; i["name"].Value = this.Name; i["stream"].Value = this.Stream; i["capture"].intValue = (int)this.Capture; i["sensi"].intValue = (int)this.Sensibility; i["alarmelapse"].intValue = (int)this.AlarmElapse; i["differencethreshold"].intValue = (int)this.DifferenceThreshold; i["codec"].Value = this.Codec; i["banner"].boolValue = this.Banner; i["showmotionrect"].boolValue = this.ShowMotionRect; i["showregion"].boolValue = this.ShowRegion; i["captureelapse"].intValue = this.CaptureElapse; i["detectmode"].intValue = (int)this.DetectMode; i["mirror"].boolValue = this.Mirror; i["flip"].boolValue = this.Flip; try { byte[] bs = this.CameraRegions.Serialize(); i["regions"].Value = Convert.ToBase64String(bs); } catch (Exception) { } IConfigSetting s = i["plugins"]; this.PlugIns.SaveConfigAll(s); }
protected override bool Validate(IConfigSetting x) { bool r = false; try { this.mVersion = x["version"].Value; switch (x["version"].intValue) { case 2: r = this.ValidateV2(x["license"]); break; default: r = this.ValidateV1(x["license"]); break; } } catch (Exception) { r = false; } if (false == r) { this.mCount = 0; this.mUsername = "******"; this.mVersion = null; } return(r); }
/// <summary> /// 获取必须配置的值 /// </summary> /// <typeparam name="T">值类型</typeparam> /// <param name="configSetting">配置节</param> /// <param name="name">值名</param> /// <returns>配置值</returns> public static T GetRequiredSetting <T>(this IConfigSetting configSetting, string name) { ISettingValue settingValue = null; if (configSetting != null) { settingValue = configSetting.Property[name]; if (settingValue == null) { var setting = name == null ? configSetting : configSetting[name]; if (setting != null) { var type = typeof(T); if (typeof(IConfigSettingElement).IsAssignableFrom(typeof(T))) { return((T)setting.ToSetting(type)); } settingValue = setting.Value; } } } if (settingValue != null) { return(settingValue.TryToObject <T>()); } throw new ConfigException(string.Format("必须配置节点 {0}", name)); }
/// <summary> /// Initializes a new instance of the <see cref="K2Service" /> class. /// </summary> /// <param name="config">The config value.</param> public K2Service(IConfigSetting config, IManageToken token) { _config = config; _token = token; _client = new HttpClient(); _k2ProfileModel = this.InitialK2Profile(); }
public void SaveConfig(IConfigSetting section) { IConfigSetting i = section[this.ID]; i.RemoveChildren(); i["device"].Value = this.Device; }
/// <summary> /// 从资源(Uri)中生成 <see cref="IConfigSetting"/> /// </summary> /// <param name="xmlSource">Uri字符串</param> /// <param name="sourceInType">如果是内嵌资源所在的程序集</param> /// <returns><see cref="IConfigSetting"/></returns> public static IConfigSetting CreateFromXmlSource(string xmlSource, Type sourceInType) { IConfigSetting setting = null; if (xmlSource.StartsWith("res://", true, null)) { string sourceName = xmlSource.Substring(6); Assembly assembly = sourceInType.Assembly; Stream stream = assembly.GetManifestResourceStream(sourceName); if (stream == null) { throw new ConfigException("未找到资源" + xmlSource); } StreamReader sr = new StreamReader(stream); string xmlString = sr.ReadToEnd(); setting = CreateFromXmlString(xmlString); } else if (xmlSource.StartsWith("http://", true, null)) { throw new ConfigException("未实现http://"); } else { setting = CreateFromXmlFile(xmlSource); } return(setting); }
/// <summary> /// 把配置节转化成强类型配置类 /// </summary> /// <param name="configSetting">配置节</param> /// <param name="objectType">强类型配置类型</param> /// <param name="xpath">需被转换的配置节路径</param> /// <param name="required">是否必须配置</param> /// <returns>强类型配置实例</returns> public static object ToSetting(this IConfigSetting configSetting, Type objectType, string xpath = null, bool required = false) { if (configSetting == null) { return(null); } var setting = configSetting; if (!string.IsNullOrEmpty(xpath)) { setting = configSetting.GetChildSetting(xpath); } if (setting == null) { if (required) { throw new ConfigException($"{configSetting.Name} 必须配置 {xpath} 节点"); } return(null); } var elementType = typeof(IConfigSettingElement); if (elementType.IsAssignableFrom(objectType)) { if (TypeHelper.CreateObject(objectType, elementType, true) is IConfigSettingElement instance) { instance.ConfigSetting = setting; return(instance); } } return(null); }
public void SaveConfigAll(IConfigSetting section) { foreach (AvailablePlugIn <IPlugIn> p in this.AvailablePlugInCollection) { p.Instance.SaveConfig(section); } }
public virtual void LoadConfig(IConfigSetting s) { this.ID = s["id"].Value; this.Name = s["name"].Value; this.mChildren = new ItemClassCollection(s, this); }
/// <summary> /// 复制配置节到当前节点,与<see cref="IConfigSetting.Merge"/>方法类似,但复制方向正好相反,且配置节名可以不一致 /// </summary> /// <param name="configSetting">需要复制的配置节</param> /// <param name="fromSetting">被复制的配置节</param> /// <returns>合并后的配置节</returns> public static IConfigSetting CopyFrom(this IConfigSetting configSetting, IConfigSetting fromSetting) { if (configSetting is ConfigSetting setting) { setting.CopyFrom(fromSetting as ConfigSetting); } return(configSetting); }
/// <summary> /// Initializes a new instance of the <see cref="TaskBll" /> class. /// </summary> /// <param name="unitOfWork">The utilities unit of work.</param> /// <param name="k2Service">The k2 service provides k2 service functionality.</param> public TaskBll(IUnitOfWork unitOfWork, IK2Service k2Service, IManageToken token, IConfigSetting config, IMapper mapper) { _unitOfWork = unitOfWork; _k2Service = k2Service; _token = token; _config = config; _mapper = mapper; }
/// <summary> /// Initializes a new instance of the <see cref="SapTranferBll" /> class. /// </summary> /// <param name="unitOfWork">The utilities unit of work control.</param> /// <param name="mapper">The auto mapper.</param> public SapTranferBll(ServiceResolver unitOfWork, IMapper mapper, IConfigSetting config, ILoggerManager logger) { _dmUnitOfWork = unitOfWork("DM"); _evfUnitOfWork = unitOfWork("EVF"); _mapper = mapper; _config = config; _logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="VendorTransectionTranferBll" /> class. /// </summary> /// <param name="unitOfWork">The utilities unit of work control.</param> /// <param name="mapper">The auto mapper.</param> public VendorTransectionTranferBll(ServiceResolver unitOfWork, IMapper mapper, IConfigSetting config, ILoggerManager logger) { _brbUnitOfWork = unitOfWork("BRB"); _evfUnitOfWork = unitOfWork("EVF"); _mapper = mapper; _config = config; _logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="RegisterBll" /> class. /// </summary> /// <param name="unitOfWork">The utilities unit of work.</param> /// <param name="emailService">The email service provides email functionality.</param> /// <param name="token">The ClaimsIdentity in token management.</param> public PasswordBll(IUnitOfWork unitOfWork, IEmailService emailService, IManageToken token, IConfigSetting config, IMapper mapper) { _unitOfWork = unitOfWork; _emailService = emailService; _token = token; _config = config; _mapper = mapper; }
public virtual void LoadConfig(IConfigSetting section) { IConfigSetting i = section[this.ID]; this.Username = i["username"].Value; this.Password = i["password"].Value; this.URL = i["url"].Value; this.Stream = (IPCAM)i["stream"].intValue; }
/// <summary> /// 获取必须配置的值 /// </summary> /// <param name="configSetting">配置节</param> /// <param name="name">值名</param> /// <returns>配置值</returns> public static string GetRequiredSetting(this IConfigSetting configSetting, string name) { var settingValue = GetSettingValue(configSetting, name); if (settingValue != null) { return(settingValue.Value); } throw new ConfigException(string.Format("必须配置节点 {0}", name)); }
/// <summary> /// Initializes a new instance of the <see cref="BasicAuthenticationHandler" /> class. /// </summary> /// <param name="options">The Interfaces option monitor.</param> /// <param name="logger">The Logger class.</param> /// <param name="encoder">The Url Encoder class.</param> /// <param name="clock">The system clock.</param> /// <param name="config">The config value in appsetting.json.</param> public BasicAuthenticationHandler( IOptionsMonitor <AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IConfigSetting config) : base(options, logger, encoder, clock) { _config = config; }
/// <summary> /// Initializes a new instance of the <see cref="SummaryEmailTaskBll" /> class. /// </summary> /// <param name="unitOfWork">The utilities unit of work.</param> /// <param name="token">The ClaimsIdentity in token management.</param> public SummaryEmailTaskBll(IUnitOfWork unitOfWork, IManageToken token, IEmailTaskBll emailTask, IEmailService emailService, ILoggerManager logger, IConfigSetting config) { _unitOfWork = unitOfWork; _token = token; _emailTask = emailTask; _emailService = emailService; _logger = logger; _config = config; }
public override void LoadConfig(IConfigSetting section) { base.LoadConfig(section); IConfigSetting i = section[this.ID]; this.Host = i["host"].Value; this.Port = i["port"].intValue; this.CamID = i["cameraid"].intValue; }
public override void SaveConfig(IConfigSetting section) { base.SaveConfig(section); IConfigSetting i = section[this.ID]; i["host"].Value = this.Host; i["port"].intValue = this.Port; i["cameraid"].intValue = this.CamID; }
/// <summary> /// ��һ�������ý���ʵ���������� /// </summary> /// <param name="cacheSetting">���������ý�</param> /// <returns>ʵ��ICache�ӿڵĻ�����ʵ��</returns> public ICache GetCache(IConfigSetting cacheSetting) { string cacheName = cacheSetting.Property["name"].Value; ICache cache = this.GetCache(cacheName); if(cache == null) { cache = this.CreateCache(cacheSetting); this.caches.Add(cacheName, cache); } return cache; }
/// <summary> /// 复制配置节到当前节点,与<see cref="IConfigSetting.Merge"/>方法类似,但复制方向正好相反,且配置节名可以不一致 /// </summary> /// <param name="configSetting">需要复制的配置节</param> /// <param name="fromSetting">被复制的配置节</param> /// <returns>合并后的配置节</returns> public static IConfigSetting CopyFrom(this IConfigSetting configSetting, IConfigSetting fromSetting) { var setting = configSetting as ConfigSetting; if (setting != null) { setting.CopyFrom(fromSetting as ConfigSetting); } return(configSetting); }
public virtual void SaveConfig(IConfigSetting section) { IConfigSetting i = section[this.ID]; i.RemoveChildren(); i["username"].Value = this.Username; i["password"].Value = this.Password; i["url"].Value = this.URL; i["stream"].intValue = (int)this.Stream; }
/// <summary> /// Initializes a new instance of the <see cref="TicketBll" /> class. /// </summary> /// <param name="unitOfWork">The utilities unit of work.</param> public TicketBll(IUnitOfWork unitOfWork, IMapper mapper, IManageToken token, ITicketCommentBll ticketComment, ITicketTransectionBll ticketTransection, IConfigSetting config, IEmailService emailService) { _unitOfWork = unitOfWork; _mapper = mapper; _token = token; _ticketComment = ticketComment; _ticketTransection = ticketTransection; _config = config; _emailService = emailService; }
/// <summary> /// Initializes a new instance of the <see cref="SummaryEvaluationBll" /> class. /// </summary> /// <param name="unitOfWork">The utilities unit of work.</param> /// <param name="mapper">The auto mapper.</param> /// <param name="token">The ClaimsIdentity in token management.</param> public SummaryEvaluationBll(IUnitOfWork unitOfWork, IMapper mapper, IManageToken token, IWorkflowBll workflow, IEmailTaskBll emailTask, IEmailService emailService, IConfigSetting config) { _unitOfWork = unitOfWork; _mapper = mapper; _token = token; _workflow = workflow; _emailTask = emailTask; _emailService = emailService; _config = config; }
/// <summary> /// ģ��ij�ʼ������ȡ������Ϣ����Ϊ֧��Framework�� /// </summary> /// <param name="framework">������IFramework</param> /// <param name="setting">���ý�</param> protected override void OnInit(IFramework framework, IConfigSetting setting) { base.OnInit(framework, setting); try { MailSender.SmtpServer = this.setting["smtpServer"].Value.Value; MailSender.ServerPort = this.setting["serverPort"].Value.ToInt32(); MailSender.UserName = this.setting["userName"].Value.Value; MailSender.Password = this.setting["password"].Value.Value; } catch (Exception e) { Exceptor.Publish(e, LogLevel.WARN); } }
public static void Load(IConfigSetting s, System.Windows.Forms.Form f) { int w = s["w"].intValue; int h = s["h"].intValue; int l = s["l"].intValue; int t = s["t"].intValue; if (w > 0) f.Width = w; if (h > 0) f.Height = h; if (s["l"].Exists) f.Left = l; if (s["t"].Exists) f.Top = t; }
/// <summary> /// ��ʼ�����ɿ�ܵ��� /// </summary> /// <param name="setting">��־�����������ý�</param> public virtual void Init(IConfigSetting setting) { if(this.isInit) { return; } this.setting = setting; this.loggers = new CollectionBase<ILogger>(); IConfigSetting[] logSettings = setting["loggers"].GetChildSettings(); for(int i = 0; i < logSettings.Length; i++) { string loggerName = logSettings[i].Property["name"].Value; if(loggerName == null) { throw new LogException("��־��¼����ΪNull"); } if(this.loggers.Contains(loggerName)) { throw new LogException("��־��¼�����ظ���" + loggerName); } ILogger logger = (ILogger)logSettings[i].Property["type"].ToObject(typeof(ILogger), true); logger.Init(logSettings[i]); this.loggers.Add(loggerName, logger); } this.isInit = true; }
public GroupClass(IConfigSetting i, GroupClass parent) { this.LoadConfig(i); this.Group = parent; }
/// <summary> /// ��ʼ��ģ�� /// </summary> /// <param name="framework">IFramework</param> /// <param name="setting">��Ӧ�����ý�</param> protected override void OnInit(IFramework framework, IConfigSetting setting) { base.OnInit(framework, setting); cacheManager = this.GetCacheManager(); }
ICache ICacheManager.GetCache(IConfigSetting cacheSetting) { return cacheManager.GetCache(cacheSetting); }
IConfigSetting IConfigSetting.Merge(IConfigSetting setting) { return this.Merge((ConfigSetting)setting); }
public CameraClass(IConfigSetting section) { this.LoadConfig(section); }
public void LoadConfig(IConfigSetting i) { this.PlugIns.LoadConfigAll(i["plugins"]); float version = i["version"].floatValue; if (version < 1.1F) { this.Capture = (i["capture"].boolValue == true) ? CAPTUREFLAG.ONALARM : CAPTUREFLAG.NOCAPTURE; this.ShowMotionRect = true; } else { this.Capture = (CAPTUREFLAG)(i["capture"].intValue); this.ShowMotionRect = i["showmotionrect"].boolValue; } this.Stream = i["stream"].Value; if (version < 1.2F) { this.Stream = (i["stream"].intValue == 0) ? null : "Motion.PlugIns.IPCam.General"; foreach (AvailablePlugIn<IPlugIn> pi in this.PlugIns.AvailablePlugInCollection) { IPlugInIPCam c = pi.Instance as IPlugInIPCam; if (c != null) { c.URL = i["url"].Value; c.Username = i["login"].Value; c.Password = i["password"].Value; c.Stream = (i["stream"].intValue == 1) ? IPCAM.JPEG : IPCAM.MJPEG; } } } if (version < 2.0F) { if (this.Stream != null) { Dictionary<string, string> gs = new Dictionary<string, string>(); gs.Add("motion.plugins.alarm.email", "p17a988de71b3fb81d5cc2d6612dfe072"); gs.Add("motion.plugins.alarm.sound", "p4f2679987e0e6e85cf70ca40feaac595"); gs.Add("motion.plugins.ipcam.general", "p1f25f05340a17e6e6acdf656d3360ea0"); gs.Add("motion.plugins.ipcam.axis", "p532c301e3373bcd1b7a0b63e9367e5d1"); gs.Add("motion.plugins.usbcam.general", "pe5087ee4b071dafd9744d6201dbe65b8"); string k = this.Stream.ToLower(); this.Stream = gs.ContainsKey(k) ? gs[k] : null; } } this.ID = i["id"].Value; this.Name = i["name"].Value; this.Sensibility = (decimal)i["sensi"].intValue; this.AlarmElapse = (decimal)i["alarmelapse"].intValue; this.DifferenceThreshold = i["differencethreshold"].intValue; this.Banner = i["banner"].boolValue; this.CaptureElapse = i["captureelapse"].intValue; this.ShowRegion = i["showregion"].boolValue; this.DetectMode = (DETECTMODE)i["detectmode"].intValue; this.Codec = i["codec"].Value; this.Mirror = i["mirror"].boolValue; this.Flip = i["flip"].boolValue; try { byte[] bs = Convert.FromBase64String(i["regions"].Value); this.CameraRegions.Unserialize(bs); } catch (Exception) { } }
/// <summary> /// ��ʼ��ģ�� /// </summary> /// <param name="framework">IFramework</param> /// <param name="setting">��Ӧ�����ý�</param> protected virtual void OnInit(IFramework framework, IConfigSetting setting) { if (setting == null) { throw new BaseException("ģ���ʼ��ʧ�ܣ�û���ṩ���ý�"); } this.framework = framework; this.moduleSetting = setting; this.name = setting.Property["name"].Value; string linkNode = setting.Property.TryGetPropertyValue("linkNode"); if (string.IsNullOrEmpty(linkNode)) { if (setting.Children > 0) { this.setting = setting[0]; } } else { this.setting = setting.GetChildSetting(linkNode); } }
/// <summary> /// ��ʼ��ģ�� /// </summary> /// <param name="framework">IFramework</param> /// <param name="setting">��Ӧ�����ý�</param> public virtual void Init(IFramework framework, IConfigSetting setting) { if(!this.initialized) { this.OnInit(framework, setting); this.initialized = true; } }
void IModule.Init(IFramework framework, IConfigSetting setting) { this.Init(framework, setting); }
protected virtual bool Validate(IConfigSetting x) { IConfigSetting i = x["license"]; this.mUsername = "******"; this.mVersion = null; string k = "<RSAKeyValue><Modulus>plCFGoZo+FV6WC0Za3DhlWJgx4Ifs8P2iMNcQip2zwLvwnWozsxZZ9/SbzA1FPXxX5rW+Wttec2iGohLiQiQDBYvPRlccBQgAk7GeTicyFqYZ8KuON0XgNfe1TSf5a17YBgfjI/zNaUypchUoMqMZHTho8UEaEa6pomtfOY3grs=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(k); #if SAFE_ANYWHERE_WITHUK string p = this.HostID; #else string p = i["username"].Value; #endif string s = i["signature"].Value; bool b = rsa.VerifyData(System.Text.UTF8Encoding.ASCII.GetBytes(p), new SHA1CryptoServiceProvider(), Convert.FromBase64String(s)); if (b) { this.mUsername = i["username"].Value; this.mVersion = x["version"].Value; } return b; }
IConfigSetting IConfigSetting.SetParent(IConfigSetting parent) { this.Parent = (ConfigSetting)parent; return this; }
public CameraClass(IConfigSetting section, GroupClass parent) { this.LoadConfig(section); this.Group = parent; }
void ICacheManager.Init(IConfigSetting setting) { }
private ICacheManager CreateCacheManager(IConfigSetting setting) { ICacheManager cacheManager = (ICacheManager)setting.Property["type"].ToObject(typeof(ICacheManager), true); cacheManager.Init(setting); return cacheManager; }
public virtual void SaveConfig(IConfigSetting s) { s.RemoveChildren(); if (this.mChildren != null) { this.mChildren.SaveConfig(s); } // this 2 lines must be the last s["id"].Value = this.ID; s["name"].Value = this.Name; }
/// <summary> /// ��ʼ��ģ�� /// </summary> /// <param name="framework">IFramework</param> /// <param name="setting">��Ӧ�����ý�</param> public override void Init(IFramework framework, IConfigSetting setting) { if(setting != null) { base.Init(framework, setting); } }
public GroupClass(IConfigSetting i) { this.LoadConfig(i); }
private bool ValidateV2(IConfigSetting i) { string k = "<RSAKeyValue><Modulus>plCFGoZo+FV6WC0Za3DhlWJgx4Ifs8P2iMNcQip2zwLvwnWozsxZZ9/SbzA1FPXxX5rW+Wttec2iGohLiQiQDBYvPRlccBQgAk7GeTicyFqYZ8KuON0XgNfe1TSf5a17YBgfjI/zNaUypchUoMqMZHTho8UEaEa6pomtfOY3grs=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(k); string p = i["count"].intValue + "+ZYY+" + i["username"].Value; if (this.IsUK()) { p = this.HostID + "+ZYY+" + p; } string s = i["signature"].Value; bool b = rsa.VerifyData(System.Text.UTF8Encoding.ASCII.GetBytes(p), new SHA1CryptoServiceProvider(), Convert.FromBase64String(s)); if (b) { this.mCount = i["count"].intValue; this.mUsername = i["username"].Value; } return b; }
/// <summary> /// ���캯�� /// </summary> /// <param name="setting">��Ӧ�����ý�</param> public MailLogger(IConfigSetting setting) : base(setting) { }
void IConfigSetting.Merge(IConfigSetting setting) { this.Merge((ConfigSetting)setting); }
/// <summary> /// ��ʼ�� /// </summary> /// <param name="setting">���ý�</param> public override void Init(IConfigSetting setting) { if(!this.isInit) { base.Init(setting); this.msgCount = 0; this.bufferSize = setting["mail"].Property["bufferSize"].ToInt32(); this.mailFrom = setting["mail"].Property["mailFrom"].Value; this.mailSubject = setting["mail"].Property["mailSubject"].Value; this.mailList = setting["mail"].Property["mailList"].Value; this.msg = new StringBuilder(); this.SendMail(); } }