Ejemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     try
     {
         filename = Directory.GetCurrentDirectory() + @"\config.yaml";
         if (File.Exists(filename))
         {
             tools      = new ConfigTools(filename.Replace("\\", "/"));
             YamlConfig = tools.ReadConfig();
             if (YamlConfig != null)
             {
                 foreach (GROUP G in YamlConfig.ProxyGroup)
                 {
                     rulebox.Items.Add(G.name);
                 }
                 foreach (string r in YamlConfig.Rule)
                 {
                     string[] z = r.Split(',');
                     if (z.Length >= 3)
                     {
                         RuleList.Items.Add(new Rule_Struct(z[0], z[1], z[2]));
                     }
                     else
                     {
                         RuleList.Items.Add(new Rule_Struct(z[0], "剩余目标地址", z[1]));
                     }
                 }
             }
         }
     }
     catch { }
 }
Ejemplo n.º 2
0
 public void loadConfig()
 {
     tools      = new ConfigTools(filename.Replace("\\", "/"));
     YamlConfig = tools.ReadConfig();
     if (YamlConfig != null)
     {
         foreach (GROUP G in YamlConfig.ProxyGroup)
         {
             rulebox.Items.Add(G.name);
         }
         foreach (string r in YamlConfig.Rule)
         {
             string[] z = r.Split(',');
             if (z.Length >= 3)
             {
                 RuleList.Items.Add(new Rule_Struct(z[0], z[1], z[2]));
             }
             else
             {
                 RuleList.Items.Add(new Rule_Struct(z[0], "剩余目标地址", z[1]));
             }
         }
     }
 }