예제 #1
0
 static void Main(string[] args)
 {
     if (args.Length > 0)
     {
         if (args[0] == "create")
         {
             CreateConnection createConn = new CreateConnection();
             createConn.CreateVPN(args[1], args[2]);
         }
         else if (args[0] == "connect")
         {
             CreateConnection createConn = new CreateConnection();
             createConn.ConnectVPN(args[1], args[2], args[3]);
         }
         else if (args[0] == "fixReg")
         {
             CreateConnection createConn = new CreateConnection();
             createConn.FixReg();
         }
         else
         {
             Console.WriteLine("WRONG COMMAND!");
             Console.WriteLine("create <name> <destination>                    create a new vpn");
             Console.WriteLine("connect <name> <username> <pwd>      connect to a vpn");
             Console.WriteLine("fixReg                                                           fix registry");
         }
     }
     else
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new VPNCreateForm());
     }
 }
예제 #2
0
 private void btn_ConnectVpn_Click(object sender, EventArgs e)
 {
     try
     {
         CreateConnection createConn = new CreateConnection();
         createConn.ConnectVPN(txt_VpnName.Text, txt_UserName.Text, txt_Pwd.Text);
         MessageBox.Show("Connect to VPN Success!");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #3
0
 private void btn_fixReg_Click(object sender, EventArgs e)
 {
     try
     {
         CreateConnection createConn = new CreateConnection();
         createConn.FixReg();
         MessageBox.Show("Fix registry success!");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #4
0
        private void btn_CreateVpn_Click(object sender, EventArgs e)
        {
            CreateConnection createConn = new CreateConnection();

            try
            {
                createConn.CreateVPN(txt_VpnName.Text, txt_ServerIP.Text);
                MessageBox.Show("Create VPN Success!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }