Esempio n. 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());
     }
 }
        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());
            }
        }