/// <summary> /// The constructor is private so that only the class itself can create an instance. /// </summary> private PluginSettings() { settings = new WCPluginSettings(); settings.Threshold = 1000; settings.SelectionSize = 10000; settings.SelectionMode = false; settings.PauseBetweenOperations = false; settings.PauseDelay = 0; settings.UseTransactions = false; settings.DBTimeout = 60; dbProvider = DBConnectionStringProvider.Instance(); connectionString = dbProvider.ProvideDBConnectionString(Assembly.GetExecutingAssembly().GetName().Name); LoadSettings(); }
/// <summary> /// Loads the settings of the plugin from the configuration file. /// </summary> internal void LoadSettings() { string configFile = GetPluginPath() + "CrawlWave.ServerPlugins.WordCleanup.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(WCPluginSettings)); settings = (WCPluginSettings)serializer.Deserialize(ReadStream); ReadStream.Close(); } catch {} }
/// <summary> /// Loads the settings of the plugin from the configuration file. /// </summary> internal void LoadSettings() { string configFile = GetPluginPath()+"CrawlWave.ServerPlugins.WordCleanup.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(WCPluginSettings)); settings=(WCPluginSettings)serializer.Deserialize(ReadStream); ReadStream.Close(); } catch {} }