/// <summary> /// Initializes a new OVPN Object. /// Also set a LogEventDelegate so that the first log lines are reveived. /// </summary> /// <param name="bin">Path to openvpn binary</param> /// <param name="config">Path to configuration file</param> /// <param name="earlyLogEvent">Delegate to a event processor</param> /// <param name="earlyLogLevel">Log level</param> /// <param name="logfile">File to write OpenVPN log message to</param> /// <seealso cref="OVPNConnection.logs"/> public OVPNUserConnection(string bin, string config, string logfile, OVPNLogManager.LogEventDelegate earlyLogEvent, int earlyLogLevel) : base("127.0.0.1", 11195 + obj_count++, earlyLogEvent, earlyLogLevel) { if (bin == null) { throw new ArgumentNullException("Binary is null"); } if (config == null) { throw new ArgumentNullException("Config file is null"); } if (!new FileInfo(bin).Exists) { throw new FileNotFoundException("Binary \"" + bin + "\" does not exist"); } if (!new FileInfo(config).Exists) { throw new FileNotFoundException("Config file \"" + config + "\" does not exist"); } m_ovpnService = new OVPNService(bin, config, Path.GetDirectoryName(config), logs, base.host, base.port, logfile); m_ovpnService.serviceExited += new EventHandler(m_ovpnService_serviceExited); }
/// <summary> /// Initializes a new OVPN Object. /// Also set a LogEventDelegate so that the first log lines are reveived. /// </summary> /// <param name="bin">Path to openvpn binary</param> /// <param name="config">Path to configuration file</param> /// <param name="earlyLogEvent">Delegate to a event processor</param> /// <param name="earlyLogLevel">Log level</param> /// <param name="logfile">File to write OpenVPN log message to</param> /// <seealso cref="OVPNConnection.logs"/> public OVPNUserConnection(string bin, string config, string logfile, OVPNLogManager.LogEventDelegate earlyLogEvent, int earlyLogLevel) : base("127.0.0.1", 11195 + obj_count++, earlyLogEvent, earlyLogLevel) { if (bin == null) throw new ArgumentNullException("Binary is null"); if (config == null) throw new ArgumentNullException("Config file is null"); if (!new FileInfo(bin).Exists) throw new FileNotFoundException("Binary \"" + bin + "\" does not exist"); if (!new FileInfo(config).Exists) throw new FileNotFoundException("Config file \"" + config + "\" does not exist"); m_ovpnService = new OVPNService(bin, config, Path.GetDirectoryName(config), logs, base.host, base.port, logfile); m_ovpnService.serviceExited += new EventHandler(m_ovpnService_serviceExited); }