/// <summary> /// The constructor is private so that only the class itself can create an instance. /// </summary> private Settings() { settings = new SCSettings(); settings.SQLServer = "."; settings.SQLLogin = "******"; settings.SQLPass = String.Empty; settings.DataFilesPath = String.Empty; settings.MaxDBSize = 0; LoadSettings(); }
/// <summary> /// Loads the settings of the plugin from the configuration file. /// </summary> internal void LoadSettings() { string configFile = GetPath() + "CrawlWave.ServerCommon.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(SCSettings)); settings = (SCSettings)serializer.Deserialize(ReadStream); ReadStream.Close(); } catch {} }
/// <summary> /// Loads the settings of the plugin from the configuration file. /// </summary> internal void LoadSettings() { string configFile = GetPath()+"CrawlWave.ServerCommon.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(SCSettings)); settings=(SCSettings)serializer.Deserialize(ReadStream); ReadStream.Close(); } catch {} }