Exemplo n.º 1
0
        public static Task Launch(LauncherOptions options)
        {
            return(Task.Run(() =>
            {
                var serverEndPoint = options.ResolveServerEndpoint().Result;
                ushort proxyPort = GetProxyPort();

                var connectedToServerEvent = new AutoResetEvent(false);
                Program.ConnectedToServer += (sender, args) =>
                {
                    connectedToServerEvent.Set();
                };
                var proxyTask = Program.Start(serverEndPoint, proxyPort);
                if (!connectedToServerEvent.WaitOne(TimeSpan.FromSeconds(30)))
                {
                    throw new TimeoutException("Server connection timeout.");
                }

                switch (options.ClientType)
                {
                case UltimaClientType.Classic:
                    ClassicClientLauncher.Launch(options, proxyPort);
                    break;

                case UltimaClientType.Orion:
                    OrionLauncher.Launch(options, proxyPort);
                    break;
                }

                InterProcessCommunication.StartReceiving();
            }));
        }
Exemplo n.º 2
0
        public Task Launch(LauncherOptions options, InfusionProxy proxy)
        {
            return(Task.Run(() =>
            {
                var launcher = GetLauncher(options);
                var serverEndPoint = options.ResolveServerEndpoint().Result;
                ushort proxyPort = options.GetDefaultProxyPort();

                CheckMulFiles(options);

                launcher.Launch(console, proxy, options);

                InterProcessCommunication.StartReceiving();
            }));
        }