/// <summary> /// The constructor is private so that only the class itself can create an instance. /// </summary> private PluginSettings() { settings = new INPluginSettings(); settings.Threads = 5; settings.CleanUrls = true; settings.CheckUrls = true; settings.PauseBetweenOperations = false; settings.PauseDelay = 0; dbProvider = DBConnectionStringProvider.Instance(); rnd = new Random(); appName = Assembly.GetExecutingAssembly().GetName().Name; inputFile = String.Empty; outputFile = String.Empty; LoadSettings(); }
/// <summary> /// Loads the settings of the plugin from the configuration file. /// </summary> internal void LoadSettings() { string configFile = GetPluginPath() + "CrawlWave.ServerPlugins.Initializer.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(INPluginSettings)); settings = (INPluginSettings)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.Initializer.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(INPluginSettings)); settings=(INPluginSettings)serializer.Deserialize(ReadStream); ReadStream.Close(); } catch {} }