public static void Launch(LauncherOptions options, ushort proxyPort)
        {
            LoginConfiguration.SetServerAddress("127.0.0.1", proxyPort);
            if (!string.IsNullOrEmpty(options.UserName))
            {
                UltimaConfiguration.SetUserName(options.UserName);
            }
            if (!string.IsNullOrEmpty(options.Password))
            {
                UltimaConfiguration.SetPassword(options.EncryptPassword());
            }

            string ultimaExecutablePath = options.Classic.ClientExePath;

            if (!File.Exists(ultimaExecutablePath))
            {
                Program.Console.Error($"File {ultimaExecutablePath} doesn't exist.");
                Program.Console.Info(
                    "Infusion requires that you use a client without encryption. If your Ultima Online server allows using Third Dawn (3.x) clients, " +
                    "you can download a client without encryption: https://ulozto.cz/!9w2rZmJfmcvA/client306m-patches-zip. \n\n" +
                    @"The zip file contains NoCryptClient.exe. Copy it to your Ultima Online installation folder (typically c:\Program Files\Ultima Online 2D)." +
                    "\n\n" +
                    "You can read more about how to setup Infusion properly: https://github.com/uoinfusion/Infusion/wiki/Getting-started." + "\n");

                return;
            }

            Program.Console.Info($"Staring {ultimaExecutablePath}");

            var info = new ProcessStartInfo(ultimaExecutablePath);

            var ultimaClientProcess = Process.Start(info);

            if (ultimaClientProcess == null)
            {
                Program.Console.Error($"Cannot start {ultimaExecutablePath}.");
                return;
            }

            Program.SetClientWindowHandle(ultimaClientProcess);
        }
        public Task Launch(IConsole console, InfusionProxy proxy, LauncherOptions options)
        {
            var proxyPort = options.GetDefaultProxyPort();

            var proxyTask = proxy.Start(new ProxyStartConfig()
            {
                ServerAddress      = options.ServerEndpoint,
                ServerEndPoint     = options.ResolveServerEndpoint().Result,
                LocalProxyPort     = proxyPort,
                ProtocolVersion    = options.ProtocolVersion,
                Encryption         = options.Official.Encryption,
                LoginEncryptionKey = LoginEncryptionKey.FromVersion(options.Official.EncryptionVersion)
            });

            var ultimaExecutableInfo = new FileInfo(options.Official.ClientExePath);

            if (!ultimaExecutableInfo.Exists)
            {
                console.Error($"File {ultimaExecutableInfo.FullName} doesn't exist.");
                return(proxyTask);
            }

            var workingDirectory = ultimaExecutableInfo.DirectoryName;

            var loginConfiguration = new LoginConfiguration(workingDirectory);

            console.Info($"Configuring server address: {loginConfiguration.ConfigFile}");
            loginConfiguration.SetServerAddress("127.0.0.1", proxyPort);

            var ultimaConfiguration = new UltimaConfiguration(workingDirectory);

            console.Info($"Configuring user name and password: {ultimaConfiguration.ConfigFile}");
            if (!string.IsNullOrEmpty(options.UserName))
            {
                ultimaConfiguration.SetUserName(options.UserName);
            }
            if (!string.IsNullOrEmpty(options.Password))
            {
                ultimaConfiguration.SetPassword(options.EncryptPassword());
            }

            console.Info($"Staring {ultimaExecutableInfo.FullName} from {workingDirectory}");

            var info = new ProcessStartInfo(ultimaExecutableInfo.FullName)
            {
                WorkingDirectory = workingDirectory
            };

            var ultimaClientProcess = Process.Start(info);

            if (ultimaClientProcess == null)
            {
                console.Error($"Cannot start {ultimaExecutableInfo.FullName}.");
                return(proxyTask);
            }

            ClientProcessWatcher.Watch(ultimaClientProcess);
            proxy.SetClientWindowHandle(ultimaClientProcess);

            return(proxyTask);
        }