/// <summary> /// Loads the settings of the plugin from the configuration file. /// </summary> internal void LoadSettings() { string configFile = GetPath() + "CrawlWave.ServerWorker.Config.xml"; try { if (!File.Exists(configFile)) { //perhaps the file does not exist - probably because it has not been //created yet. In this case just let the class retain default values. return; } Stream ReadStream = File.Open(configFile, FileMode.Open); SoapFormatter serializer = new SoapFormatter(); settings = (SWSettings)serializer.Deserialize(ReadStream); ReadStream.Close(); } catch (Exception e) { if (log != null) { log.LogWarning("CrawlWave.ServerWorker failed to load its settings: " + e.ToString()); } } }
/// <summary> /// The constructor is private so that only the class itself can create an instance. /// </summary> private Settings() { settings = new SWSettings(); try { log = new FileEventLogger(GetPath() + "CrawlWave.ServerWorker.log", true, "CrawlWave.ServerWorker"); } catch { log = null; } LoadSettings(); }
/// <summary> /// Loads the settings of the plugin from the configuration file. /// </summary> internal void LoadSettings() { string configFile = GetPath()+"CrawlWave.ServerWorker.Config.xml"; try { if(!File.Exists(configFile)) { //perhaps the file does not exist - probably because it has not been //created yet. In this case just let the class retain default values. return; } Stream ReadStream=File.Open(configFile, FileMode.Open); SoapFormatter serializer=new SoapFormatter(); settings=(SWSettings)serializer.Deserialize(ReadStream); ReadStream.Close(); } catch(Exception e) { if(log != null) { log.LogWarning("CrawlWave.ServerWorker failed to load its settings: " + e.ToString()); } } }