コード例 #1
0
ファイル: MainForm.cs プロジェクト: pedoc/v2rayN
        private void lvServers_DoubleClick(object sender, EventArgs e)
        {
            int index = GetLvSelectedIndex();

            if (index < 0)
            {
                return;
            }

            if (config.vmess[index].configType == (int)EConfigType.Vmess)
            {
                AddServerForm fm = new AddServerForm
                {
                    EditIndex = index
                };
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    //刷新
                    RefreshServers();
                    LoadV2ray();
                }
            }
            else if (config.vmess[index].configType == (int)EConfigType.Shadowsocks)
            {
                AddServer3Form fm = new AddServer3Form
                {
                    EditIndex = index
                };
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    RefreshServers();
                    LoadV2ray();
                }
            }
            else if (config.vmess[index].configType == (int)EConfigType.Socks)
            {
                AddServer4Form fm = new AddServer4Form
                {
                    EditIndex = index
                };
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    RefreshServers();
                    LoadV2ray();
                }
            }
            else
            {
                AddServer2Form fm2 = new AddServer2Form
                {
                    EditIndex = index
                };
                if (fm2.ShowDialog() == DialogResult.OK)
                {
                    //刷新
                    RefreshServers();
                    LoadV2ray();
                }
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: qbjstone/v2rayN
        private void ShowServerForm(EConfigType configType, int index)
        {
            BaseServerForm fm;

            if (configType == EConfigType.Custom)
            {
                fm = new AddServer2Form();
            }
            else
            {
                fm = new AddServerForm();
            }
            fm.vmessItem   = index >= 0 ? lstVmess[index] : null;
            fm.groupId     = groupId;
            fm.eConfigType = configType;
            if (fm.ShowDialog() == DialogResult.OK)
            {
                RefreshServers();
                _ = LoadV2ray();
            }
        }
コード例 #3
0
        private void ShowServerForm(int configType, int index)
        {
            BaseServerForm fm;

            switch (configType)
            {
            case (int)EConfigType.Vmess:
                fm = new AddServerForm();
                break;

            case (int)EConfigType.Shadowsocks:
                fm = new AddServer3Form();
                break;

            case (int)EConfigType.Socks:
                fm = new AddServer4Form();
                break;

            case (int)EConfigType.VLESS:
                fm = new AddServer5Form();
                break;

            case (int)EConfigType.Trojan:
                fm = new AddServer6Form();
                break;

            default:
                fm = new AddServer2Form();
                break;
            }
            fm.EditIndex = index;
            if (fm.ShowDialog() == DialogResult.OK)
            {
                //刷新
                RefreshServers();
                LoadV2ray();
            }
        }