Exemple #1
0
 public static HunterConfig Load()
 {
     try
     {
         HunterConfig  hConfig;
         XmlSerializer ser = new XmlSerializer(typeof(HunterConfig));
         FileStream    fs  = new FileStream("config.xml", FileMode.Open, FileAccess.Read);
         hConfig = (HunterConfig)ser.Deserialize(fs);
         fs.Close();
         return(hConfig);
     }
     catch
     {
         HunterConfig t = new HunterConfig();
         t.ProxyFilterKeywords.Add("'请把需要使用的代理信息输入在此,如输入\"广州\",Hunter将会使用所有代理描述中含有\"广州\"二字的代理服务器。不支持空格分词,若什么都不输入,则表示使用所有可用的代理服务器。关闭此窗口,将自动保存内容。");
         t.Save();
         return(t);
     }
 }
Exemple #2
0
 void HunterMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (hunter != null)
     {
         hunter.CloseHunter();
     }
     try
     {
         {
             mHunterConfig.viewOption.HTML          = cbViewHTML.Checked;
             mHunterConfig.viewOption.AbandonFiles  = cbViewAbandonFiles.Checked;
             mHunterConfig.viewOption.AbandonLinks  = cbViewAbandonLinks.Checked;
             mHunterConfig.viewOption.DownloadItems = cbViewDownloads.Checked;
             mHunterConfig.viewOption.Proxies       = cbViewProxy.Checked;
             mHunterConfig.viewOption.Details       = cbViewDetails.Checked;
             mHunterConfig.viewOption.Exceptions    = cbViewExceptions.Checked;
         }
         mHunterConfig.Save();
     }
     catch (Exception ex)
     {
         WriteException(ex);
     }
 }