示例#1
0
        /// <summary>
        /// Loads the settings of the plugin from the configuration file.
        /// </summary>
        internal void LoadSettings()
        {
            string configFile = GetPath() + "CrawlWave.ServerWorker.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);
                SoapFormatter serializer = new SoapFormatter();
                settings = (SWSettings)serializer.Deserialize(ReadStream);
                ReadStream.Close();
            }
            catch (Exception e)
            {
                if (log != null)
                {
                    log.LogWarning("CrawlWave.ServerWorker failed to load its settings: " + e.ToString());
                }
            }
        }
示例#2
0
 /// <summary>
 /// The constructor is private so that only the class itself can create an instance.
 /// </summary>
 private Settings()
 {
     settings = new SWSettings();
     try
     {
         log = new FileEventLogger(GetPath() + "CrawlWave.ServerWorker.log", true, "CrawlWave.ServerWorker");
     }
     catch
     {
         log = null;
     }
     LoadSettings();
 }
示例#3
0
 /// <summary>
 /// The constructor is private so that only the class itself can create an instance.
 /// </summary>
 private Settings()
 {
     settings = new SWSettings();
     try
     {
         log = new FileEventLogger(GetPath() + "CrawlWave.ServerWorker.log", true, "CrawlWave.ServerWorker");
     }
     catch
     {
         log = null;
     }
     LoadSettings();
 }
示例#4
0
 /// <summary>
 /// Loads the settings of the plugin from the configuration file.
 /// </summary>
 internal void LoadSettings()
 {
     string configFile = GetPath()+"CrawlWave.ServerWorker.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);
         SoapFormatter serializer=new SoapFormatter();
         settings=(SWSettings)serializer.Deserialize(ReadStream);
         ReadStream.Close();
     }
     catch(Exception e)
     {
         if(log != null)
         {
             log.LogWarning("CrawlWave.ServerWorker failed to load its settings: " + e.ToString());
         }
     }
 }