/// <summary> /// loads /etc/default/isc-dhcp-server file /// </summary> public void LoadEtcDefaultConfigFile() { this.newEtcDefaultConfig = null; IOController.Log(this, "LoadEtcDefaultConfigFile enter", Flag.debug); if (OsIsUnix) { if (this.settings.IsDHCPServerInstalled) { if (File.Exists("/etc/default/isc-dhcp-server")) { IOController.Log(this, "LoadEtcDefaultConfig", Flag.debug); ReadConfigFileDelegate readConfigFileDelegate = new ReadConfigFileDelegate(ProcessConfigFile); IAsyncResult readConfigFileDelegateResult = readConfigFileDelegate.BeginInvoke("/etc/default/isc-dhcp-server", processEtcDefaultConfigFile, null); } else { IOController.Log(this, "FileNotFoundException /etc/default/isc-dhcp-server", Flag.error); throw new FileNotFoundException("/etc/default/isc-dhcp-server" + " not found."); } } else { IOController.Log(this, "DHCP Server not installed", Flag.error); throw new System.Exception("DHCP Server not installed"); } } else { IOController.Log(this, "System in not a Unix environment", Flag.error); throw new System.Exception("System in not a Unix environment"); } }
/// <summary> /// loads DHCP setting from file with filename /// </summary> /// <param name="filename">path and filename as string</param> public void LoadSettingsFile(String filename) { if (File.Exists(filename)) { IOController.Log(this, "LoadSettingsFile filename: " + filename, Flag.status); ReadConfigFileDelegate readConfigFileDelegate = new ReadConfigFileDelegate(ProcessConfigFile); IAsyncResult readConfigFileDelegateResult = readConfigFileDelegate.BeginInvoke(filename, parseConfig, null); } else { throw new FileNotFoundException(filename + " not found."); } }