Ejemplo n.º 1
0
 /// <summary>
 /// 读取配置
 /// </summary>
 public static void ReadConfig()
 {
     try
     {
         string json = File.ReadAllText("Config.json");
         Config = JsonSerialization.DeSerialize <Config>(json);
     }
     catch (Exception ex)
     {
         LogManager.ShowException(ex, "Read config file fail!");
         LogManager.WriteLine("Creating config file...");
         Config = new Config();
         SaveConfig();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 读取规则
 /// </summary>
 public static void ReadRules()
 {
     try
     {
         string json = File.ReadAllText("ParseRules.json");
         _rules = JsonSerialization.DeSerialize <ArticleParseRule[]>(json);
     }
     catch (Exception ex)
     {
         LogManager.ShowException(ex, "Read parse rules file fail!");
         LogManager.WriteLine("Creating parse rules file...");
         _rules = GetDefaultRules();
         SaveRules();
     }
 }