/// <summary> /// The constructor is private so that only the class itself can create an instance. /// </summary> private PluginSettings() { settings = new WEPluginSettings(); settings.UseDatabase = false; settings.ExtractTitleTag = true; settings.ExtractMetaTags = false; settings.PerformSpellChecking = false; settings.PauseBetweenOperations = false; settings.PauseDelay = 0; settings.DBActionTimeout = 30; //settings.DBConnectionString = String.Empty; LoadSettings(); }
/// <summary> /// Loads the settings of the plugin from the configuration file. /// </summary> internal void LoadSettings() { string configFile = GetPluginPath() + "CrawlWave.ServerPlugins.WordExtraction.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); XmlSerializer serializer = new XmlSerializer(typeof(WEPluginSettings)); settings = (WEPluginSettings)serializer.Deserialize(ReadStream); ReadStream.Close(); } catch (Exception e) { e.ToString(); } }
/// <summary> /// Loads the settings of the plugin from the configuration file. /// </summary> internal void LoadSettings() { string configFile = GetPluginPath()+"CrawlWave.ServerPlugins.WordExtraction.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); XmlSerializer serializer=new XmlSerializer(typeof(WEPluginSettings)); settings=(WEPluginSettings)serializer.Deserialize(ReadStream); ReadStream.Close(); } catch(Exception e) { e.ToString(); } }