Esempio 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);
        }
Esempio n. 2
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// Constructeur
 /// </summary>
 /// <param name="prefix">le prefixe dans la configuration ex: application/log</param>
 /// <param name="config">la configuration pour la lecture des parametres</param>
 /// <param name="guiclient">le client bdt</param>
 /// <param name="tipTitle">le titre à utiliser</param>
 /// <param name="timeout">le timeout d'affichage</param>
 /// -----------------------------------------------------------------------------
 public NotifyIconLogger(string prefix, ConfigPackage config, BdtGuiClient guiclient, string tipTitle, int timeout)
     : base(null, prefix, config)
 {
     // on utilise le référence d'un BdtGuiClient au lieu de passer directement un NotifyIcon car à ce stade
     // on ne peut pas créer de formulaire, car la Culture serait incorrecte, le fichier de configuration
     // n'étant pas déjà parsé
     _guiclient = guiclient;
     _tipTitle = tipTitle;
     _timeout = timeout;
 }
Esempio n. 3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Initialisation des loggers
        /// </summary>
        /// <returns>un MultiLogger lié à une source fichier et console</returns>
        /// -----------------------------------------------------------------------------
        protected override BaseLogger CreateLoggers ()
        {
            var ldcConfig = new StringConfig(Args, 0);
            var xmlConfig = new XMLConfig(ConfigFile, 1);
            Configuration = new ConfigPackage();
            Configuration.AddSource(ldcConfig);
            Configuration.AddSource(xmlConfig);

            var log = new MultiLogger();
            // on utilise le référence d'un BdtGuiClient au lieu de passer directement un NotifyIcon car à ce stade
            // on ne peut pas créer de formulaire, car la Culture serait incorrecte, le fichier de configuration
            // n'étant pas déjà parsé
            ConsoleLogger = new NotifyIconLogger(CfgConsole, Configuration, this, GetType().Assembly.GetName().Name, 1);
            FileLogger = new FileLogger(CfgFile, Configuration);
            log.AddLogger(ConsoleLogger);
            log.AddLogger(FileLogger);

            return log;
        }
Esempio n. 4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Initialisation des loggers
        /// </summary>
        /// <returns>un MultiLogger lié à une source fichier et console</returns>
        /// -----------------------------------------------------------------------------
        protected override BaseLogger CreateLoggers()
        {
            var xmlConfig = new XMLConfig(ConfigFile, 1);
            Configuration = new ConfigPackage();
            Configuration.AddSource(xmlConfig);

            // Map the path to the current Web Application
            const string key = CfgFile + Shared.Configuration.BaseConfig.SourceItemAttribute + FileLogger.ConfigFilename;
            var filename = xmlConfig.Value(key, null);
	        if ((filename != null) && (!Path.IsPathRooted(filename)))
		        xmlConfig.SetValue(key, _server.MapPath("App_Data" + Path.DirectorySeparatorChar + filename));

	        var log = new MultiLogger();
            ConsoleLogger = new ConsoleLogger(CfgConsole, Configuration);
            FileLogger = new FileLogger(CfgFile, Configuration);
            log.AddLogger(ConsoleLogger);
            log.AddLogger(FileLogger);

            return log;
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Initialisation des loggers
        /// </summary>
        /// <returns>un MultiLogger lié à une source fichier et console</returns>
        /// -----------------------------------------------------------------------------
        protected virtual BaseLogger CreateLoggers ()
        {
            var ldcConfig = new StringConfig(Args, 0);
            var xmlConfig = new XMLConfig(ConfigFile, 1);
            Configuration = new ConfigPackage();
            Configuration.AddSource(ldcConfig);
            Configuration.AddSource(xmlConfig);

            var log = new MultiLogger();
            ConsoleLogger = new ConsoleLogger(CfgConsole, Configuration);
            FileLogger = new FileLogger(CfgFile, Configuration);
            log.AddLogger(ConsoleLogger);
            log.AddLogger(FileLogger);

            return log;
        }
Esempio n. 7
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// Constructeur
 /// </summary>
 /// <param name="context">le contexte du test</param>
 /// <param name="config">la configuration serveur</param>
 /// -----------------------------------------------------------------------------
 public TestServer(TestContext context, ConfigPackage config)
 {
     _context = context;
     _servercfg = new SharedConfig(config);
     Configuration = config;
 }
Esempio n. 8
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);
            }
        }
Esempio n. 9
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 ConsoleLogger(string prefix, ConfigPackage config)
     : base(System.Console.Out, prefix, config)
 {
 }
Esempio n. 10
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Constructeur
        /// </summary>
        /// <param name="context">le contexte du test</param>
        /// <param name="config">la configuration client</param>
        /// -----------------------------------------------------------------------------
        public TestClient(TestContext context, ConfigPackage config)
        {
            _context = context;
			ClientConfig = new ClientConfig(config, null, null);
            Configuration = config;
        }