private void BtnSalva_Click(object sender, RoutedEventArgs e) { config.QuartzConfigPath = QuartzFileSelector.Path; config.WhereRootPath = WhereFileSelector.Path; ExternalConfig.Save(config); this.Close(); }
/// <summary> /// Check if an ip address, dns name or user name is blacklisted /// </summary> /// <param name="ipAddress">IP address, dns name or user name</param> /// <returns>True if blacklisted, false otherwise</returns> public bool IsBlackListed(string ipAddress) { return(!string.IsNullOrWhiteSpace(ipAddress) && ((blackList.Contains(ipAddress) || (blackListRegex != null && blackListRegex.IsMatch(ipAddress))) || ShouldBanUserNameAfterFailedLoginAttempt(ipAddress) || (ExternalConfig != null && ExternalConfig.IsBlacklisted(ipAddress)))); }
/// <summary> /// Check if an ip address is whitelisted /// </summary> /// <param name="ipAddress">IP Address</param> /// <returns>True if whitelisted, false otherwise</returns> public bool IsWhiteListed(string ipAddress) { return(!string.IsNullOrWhiteSpace(ipAddress) && (whiteList.Contains(ipAddress) || !IPAddress.TryParse(ipAddress, out IPAddress ip) || (whiteListRegex != null && whiteListRegex.IsMatch(ipAddress)) || (ExternalConfig != null && ExternalConfig.IsWhitelisted(ipAddress)))); }
private void InitConfig() { var path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var configPath = System.IO.Path.Combine(path, "config", "AppConfig.json"); config = ExternalConfig.GetConfig <JsonConfiguration>(configPath); if (!string.IsNullOrEmpty(config.QuartzConfigPath)) { QuartzFileSelector.Label = config.QuartzConfigPath; } if (!string.IsNullOrEmpty(config.WhereRootPath)) { WhereFileSelector.Label = config.WhereRootPath; } }
private void InitConfig() { var path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var configPath = System.IO.Path.Combine(path, "config", "AppConfig.json"); if (!System.IO.File.Exists(configPath)) { WpfUtils.DialogUtils.Alert("Configurare il path del file .json"); } else { config = ExternalConfig.GetConfig <JsonConfiguration>(configPath); if (string.IsNullOrEmpty(config.QuartzConfigPath) || !System.IO.File.Exists(config.QuartzConfigPath)) { WpfUtils.DialogUtils.Alert("Configurare il path del file .json"); config = null; } } }
public BaseProxy() { //Recupero il file di configurazione del proxy, se non è presente lo crea Config = ExternalConfig.GetConfig <ProxyConfig>(GetType().Name + ".json"); Initialize(); }