Exemple #1
0
    void reloadConfig()
    {
        _clash.ReloadConfig(_currentConfig);

        // 读取 API 端口,并连接 API
        string cfg = File.ReadAllText(_currentConfig);
        Dictionary <string, object> dict = new Deserializer().Deserialize <Dictionary <string, object> >(cfg);
        string extController             = dict["external-controller"].ToString();

        _clashAPI.UpdateURL(extController); //TODO: external controller protentially not started yet.

        // 更新系统代理
        _sysproxy         = new Sysproxy(_clashAPI.config.port);
        _sysproxy.Enabled = true;

        // 若当前托管配置记录了 selector 选择,则恢复选择状态
        if (_configList.index >= 0 && _configList.files[_configList.index].selections.Count > 0)
        {
            restoreSelections(_configList.files[_configList.index].selections);
        }
    }
Exemple #2
0
 private Task <bool> ReloadConfig()
 {
     return(clash.ReloadConfig());
 }