/// <summary> /// The constructor is private so that only the class itself can create an instance. /// </summary> private PluginSettings() { settings = new DUPluginSettings(); settings.DataPath = String.Empty; settings.PauseBetweenOperations = false; settings.PauseDelay = 0; settings.UseTransactions = false; settings.DBActionTimeout = 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.DBUpdater.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(DUPluginSettings)); settings = (DUPluginSettings)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.DBUpdater.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(DUPluginSettings)); settings=(DUPluginSettings)serializer.Deserialize(ReadStream); ReadStream.Close(); } catch {} }