Exemplo n.º 1
0
        private void LaunchNet7Proxy()
        {
            IPAddress[] addresses = Dns.GetHostAddresses(Setting.Hostname);
            if (addresses.Length == 0)
            {
                throw new InvalidOperationException(String.Format("Could not resolve hostname '{0}'.", Setting.Hostname));
            }

            ProcessStartInfo info = new ProcessStartInfo();

            info.WorkingDirectory = Path.Combine(Directory.GetCurrentDirectory(), "bin");
            info.FileName         = Path.Combine(info.WorkingDirectory, "Net7Proxy.exe");
            info.Arguments        = String.Format
                                    (
                "/ADDRESS:{0} /CLIENT:{1}",
                addresses[0].ToString(),
                LauncherUtility.GetShortPathName(Setting.ClientPath)
                                    );

            if (Setting.UseClientDetours)
            {
                info.Arguments += " /L";
            }

            if (Setting.UseLocalCert)
            {
                info.Arguments += " /LC";
                info.Arguments += String.Format
                                  (
                    " /SSL:{0}",
                    Setting.AuthenticationPort.ToString()
                                  );
            }

            try
            {
                Process.Start(info);
            }
            catch (Exception e)
            {
                Program.LogException(e);
                throw new ApplicationException(String.Format("Could not launch Net7Proxy.\nWorking Directory: {0}\nFileName: {1}\nArguments: {2}\nDetails: {3}", info.WorkingDirectory, info.FileName, info.Arguments, e.Message), e);
            }
        }
Exemplo n.º 2
0
        private void LaunchClient()
        {
            IPAddress[] addresses = Dns.GetHostAddresses(Setting.Hostname);
            if (addresses.Length == 0)
            {
                throw new InvalidOperationException(String.Format("Could not resolve hostname '{0}'.", Setting.Hostname));
            }

            ProcessStartInfo info = new ProcessStartInfo();

            if (Setting.UseClientDetours)
            {
                info.WorkingDirectory = Path.Combine(Directory.GetCurrentDirectory(), "bin");
                info.FileName         = Path.Combine(info.WorkingDirectory, "Detours.exe");
                info.Arguments        = String.Format
                                        (
                    "/ADDR:{0} /CLIENT:{1}",
                    addresses[0].ToString(),
                    LauncherUtility.GetShortPathName(Setting.ClientPath)
                                        );
            }
            else
            {
                info.WorkingDirectory = Path.GetDirectoryName(Setting.ClientPath);
                info.FileName         = Setting.ClientPath;
                info.Arguments        = String.Format
                                        (
                    "-SERVER_ADDR {0} -PROTOCOL {1}",
                    addresses[0].ToString(),
                    "TCP"
                                        );
            }
            try
            {
                Process.Start(info);
            }
            catch (Exception e)
            {
                throw new ApplicationException(String.Format("Could not launch client.\nWorking Directory: {0}\nFileName: {1}\nArguments: {2}\nDetails: {3}", info.WorkingDirectory, info.FileName, info.Arguments, e.Message), e);
            }
        }