Example #1
0
        public void RefreshServerListView()
        {
            lvServers.Items.Clear();

            var servers = setting.GetAllServers();

            if (servers.Count <= 0)
            {
                Debug.WriteLine("FormMain: servers is empty!");
                return;
            }

            int     count = 0;
            int     actServ = setting.GetSelectedServerIndex();
            string  s, proxy;
            JObject o;

            foreach (var b64cfgStr in servers)
            {
                try
                {
                    s = Lib.Utils.Base64Decode(b64cfgStr);
                    o = JObject.Parse(s);
                }
                catch { continue; }

                string ip, port, type, tls, path, streamType, alias;
                proxy = Lib.Utils.GetStrFromJToken(o, "outbound.protocol");
                if (proxy.Equals("shadowsocks"))
                {
                    ip   = Lib.Utils.GetStrFromJToken(o, "outbound.settings.servers.0.address");
                    port = Lib.Utils.GetStrFromJToken(o, "outbound.settings.servers.0.port");
                }
                else
                {
                    ip   = Lib.Utils.GetStrFromJToken(o, "outbound.settings.vnext.0.address");
                    port = Lib.Utils.GetStrFromJToken(o, "outbound.settings.vnext.0.port");
                }

                streamType = Lib.Utils.GetStrFromJToken(o, "outbound.streamSettings.network");
                type       = Lib.Utils.GetStrFromJToken(o, "outbound.streamSettings.kcpSettings.header.type");
                path       = Lib.Utils.GetStrFromJToken(o, "outbound.streamSettings.wsSettings.path");
                tls        = Lib.Utils.GetStrFromJToken(o, "outbound.streamSettings.security");
                alias      = Lib.Utils.GetStrFromJToken(o, "v2raygcon.alias");

                lvServers.Items.Add(new ListViewItem(new string[] {
                    (count + 1).ToString(),  //no.
                    alias,                   //alias
                    proxy,                   // proxy
                    ip,                      // ip
                    port,                    // port
                    count == actServ?"√":"", //active
                    path,                    // Url
                    streamType,              //protocol
                    tls,                     //encryption
                    type                     // disguise
                }));
                count++;
            }
        }
Example #2
0
        public void CopyAllV2RayLink()
        {
            var    servers = setting.GetAllServers();
            string s       = string.Empty;

            foreach (var server in servers)
            {
                s += "v2ray://" + server + "\r\n";
            }

            MessageBox.Show(
                Lib.Utils.CopyToClipboard(s) ?
                I18N("LinksCopied") :
                I18N("CopyFail"));
        }
Example #3
0
        void UpdateServList()
        {
            index    = 0;
            linkType = 0;
            servers  = setting.GetAllServers();
            cboxServList.Items.Clear();
            int count = 1;

            foreach (var s in servers)
            {
                cboxServList.Items.Add(count++);
            }
            if (cboxServList.Items.Count > 0)
            {
                cboxServList.SelectedIndex = 0;
            }
            cboxLinkType.SelectedIndex = 0;
        }