Exemplo n.º 1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Constructeur pour un log à partir des données fournies dans une configuration
        /// </summary>
        /// <param name="prefix">le prefixe dans la configuration ex: application/log</param>
        /// <param name="config">la configuration pour la lecture des parametres</param>
        /// -----------------------------------------------------------------------------
        public FileLogger(string prefix, ConfigPackage config)
            : base(null, prefix, config)
        {
            Filename = config.Value(prefix + BaseConfig.SourceItemAttribute + ConfigFilename, Filename);
            Append = config.ValueBool(prefix + BaseConfig.SourceItemAttribute + ConfigAppend, Append);
	        
			if (Enabled)
		        Writer = new StreamWriter(Filename, Append, System.Text.Encoding.Default);
        }
Exemplo n.º 2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Constructeur
        /// </summary>
        /// <param name="config">la configuration</param>
        /// <param name="localPort">le port local</param>
        /// -----------------------------------------------------------------------------
        public PortForward (ConfigPackage config, int localPort)
        {
            LocalPort = localPort;
            var prefix = string.Format(CfgForwardTemplate, localPort);

	        if (config == null)
				return;
	        
			Enabled = config.ValueBool(prefix + ClientConfig.WordEnabled, false);
	        Shared = config.ValueBool(prefix + ClientConfig.WordShared, false);
	        RemotePort = config.ValueInt(prefix + SharedConfig.WordPort, 0);
	        Address = config.Value(prefix + SharedConfig.WordAddress, string.Empty);
        }
Exemplo n.º 3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Constructeur
        /// </summary>
        /// <param name="config">la configuration</param>
        /// -----------------------------------------------------------------------------
        public ClientConfig (ConfigPackage config, BaseLogger consoleLogger, FileLogger fileLogger)
            : base(config)
        {
            ConsoleLogger = consoleLogger;
            FileLogger = fileLogger;

            if (config != null)
            {
                ProxyEnabled = config.ValueBool(CfgProxyEnabled, false);
				Expect100Continue = config.ValueBool(CfgProxyExpect100, true);
                ProxyAutoConfiguration = config.ValueBool(CfgProxyConfigAuto, false);
                ProxyAddress = config.Value(CfgProxyAddress, string.Empty);
                ProxyAutoAuthentication = config.ValueBool(CfgProxyAuthAuto, false);
                ProxyUserName = config.Value(CfgProxyUsername, string.Empty);
                ProxyPassword = config.Value(CfgProxyPassword, string.Empty);
                ProxyDomain = config.Value(CfgProxyDomain, string.Empty);
                ProxyPort = config.ValueInt(CfgProxyPort, 0);
                SocksEnabled = config.ValueBool(CfgSocksEnabled, false);
                SocksShared = config.ValueBool(CfgSocksShared, false);
                SocksPort = config.ValueInt(CfgSocksPort, 0);
            }

            Forwards = new Dictionary<int,PortForward>();
            for (var i = IPEndPoint.MinPort; i <= IPEndPoint.MaxPort; i++)
            {
                var forward = new PortForward(config, i);
                if ((forward.RemotePort > 0) && (forward.Address != String.Empty))
                    Forwards.Add(i, forward);
            }
        }