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 = EncryptionSetup.Autodetect, LoginEncryptionKey = null, }); var ultimaExecutableInfo = new FileInfo(options.Orion.ClientExePath); if (!ultimaExecutableInfo.Exists) { console.Error($"File {ultimaExecutableInfo.FullName} doesn't exist."); return(proxyTask); } var ultimaExecutablePath = ultimaExecutableInfo.FullName; var account = BitConverter.ToString(System.Text.Encoding.UTF8.GetBytes(options.UserName)).Replace("-", ""); var password = BitConverter.ToString(System.Text.Encoding.UTF8.GetBytes(options.Password)).Replace("-", ""); var info = new ProcessStartInfo(ultimaExecutablePath); info.WorkingDirectory = ultimaExecutableInfo.DirectoryName; var insensitiveArguments = $"-autologin:0 -savepassword:0 \"-login 127.0.0.1,{proxyPort}\""; var sensitiveArguments = $" -account:{account},{password}"; info.Arguments = insensitiveArguments + sensitiveArguments; var argumentsInfo = insensitiveArguments + $" -account:{account},<password censored>"; console.Info($"Staring {ultimaExecutablePath} {argumentsInfo}"); var ultimaClientProcess = Process.Start(info); if (ultimaClientProcess == null) { console.Error($"Cannot start {ultimaExecutablePath}."); return(proxyTask); } ClientProcessWatcher.Watch(ultimaClientProcess); proxy.SetClientWindowHandle(ultimaClientProcess); return(proxyTask); }
public Task Launch(IConsole console, InfusionProxy proxy, LauncherOptions options) { var proxyPort = options.GetDefaultProxyPort(); var task = proxy.Start(new ProxyStartConfig() { ServerAddress = options.ServerEndpoint, ServerEndPoint = options.ResolveServerEndpoint().Result, LocalProxyPort = proxyPort, ProtocolVersion = options.ProtocolVersion, Encryption = options.ClassicUO.EncryptionSetup, LoginEncryptionKey = options.ClassicUO.GetEncryptionKey() }); var ultimaExecutableInfo = new FileInfo(options.ClassicUO.ClientExePath); if (!ultimaExecutableInfo.Exists) { console.Error($"File {ultimaExecutableInfo.FullName} doesn't exist."); return(task); } var account = options.UserName; var password = options.Password; var info = new ProcessStartInfo(ultimaExecutableInfo.FullName); info.WorkingDirectory = Path.GetDirectoryName(ultimaExecutableInfo.DirectoryName); var insensitiveArguments = $"-ip 127.0.0.1 -port {proxyPort} -username {account}"; var sensitiveArguments = $" -password {password}"; info.Arguments = insensitiveArguments + sensitiveArguments; var argumentsInfo = insensitiveArguments + " -password <censored>"; console.Info($"Staring {ultimaExecutableInfo.FullName} {argumentsInfo}"); var ultimaClientProcess = Process.Start(info); if (ultimaClientProcess != null) { ClientProcessWatcher.Watch(ultimaClientProcess); proxy.SetClientWindowHandle(ultimaClientProcess); } else { console.Error($"Cannot start {ultimaExecutableInfo.FullName}."); } return(task); }
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); }