public static void LoadBimtProxySetting() { BimtProxyService <ShadowSocksEntity> bps = new BimtProxyService <ShadowSocksEntity>(ShadowSocksEntity.URL); Configuration cfg = Configuration.Load(); Random ro = new Random(); cfg.localPort = ro.Next(5000, 65534); //"strategy" : "com.shadowsocks.strategy.ha" cfg.strategy = "com.shadowsocks.strategy.ha"; List <param> list = bps.Entity.GetParams(); cfg.configs.Clear(); foreach (var item in list) { Server server = new Server(); server.auth = false; server.method = "aes-256-cfb"; server.server = item.server; server.password = item.password; server.server_port = int.Parse(item.server_port); server.timeout = 6; cfg.configs.Add(server); } Configuration.Save(cfg); }
private void frmGoogleSearch_FormClosed(object sender, FormClosedEventArgs e) { BimtProxyService.ShutDown(); Application.Exit(); //app.ShutDown(); //BimtProxyService.ShutDown(); Process p = GetProcess("Shadowsocks"); if (p != null) { p.Kill(); } }
public frmGoogleSearch(IShutDownable i) { try { InitializeComponent(); app = i; } catch (Exception) { BimtProxyService.ShutDown(); MessageBox.Show(null, "代理初始化失败!", "代理设置"); } }
private void button2_Click(object sender, EventArgs e) { MessageBox.Show(null, "代理已停止!", "Setting"); BimtProxyService.ShutDown(); this.FindForm().Close(); }