internal LauncherWindow(Action <LaunchProfile> launchCallback, IConsole console, InfusionProxy proxy) { this.console = console; this.proxy = proxy; this.launchCallback = launchCallback; InitializeComponent(); launcherViewModel = new LauncherViewModel(pwd => passwordBox.Password = pwd); var profileInstaller = new ProfilesInstaller(console, ProfileRepository.ProfilesPath); profileInstaller.Install(); var profiles = ProfileRepository.LoadProfiles(); if (profiles != null) { launcherViewModel.Profiles = new ObservableCollection <LaunchProfile>(profiles); } string selectedProfileId = ProfileRepository.LoadSelectedProfileId(); if (profiles != null && !string.IsNullOrEmpty(selectedProfileId)) { launcherViewModel.SelectedProfile = launcherViewModel.Profiles.FirstOrDefault(p => p.Id == selectedProfileId) ?? launcherViewModel.Profiles.FirstOrDefault(); } DataContext = launcherViewModel; }
public void Execute() { var proxy = new InfusionProxy(); proxy.Initialize(commandHandler, new NullSoundPlayer(), new LegacyApi.Injection.NullInjectionWindow()); var resolvedServerAddress = Dns.GetHostEntry(options.ServerAddress) .AddressList.First(a => a.AddressFamily == AddressFamily.InterNetwork); proxy.Start(new ProxyStartConfig() { ServerAddress = options.ServerAddress, ServerEndPoint = new IPEndPoint(resolvedServerAddress, options.Port), LocalProxyPort = (ushort)options.LocalPort, ProtocolVersion = options.ProtocolVersion, LoginEncryptionKey = LoginEncryptionKey.FromVersion(options.ProtocolVersion), Encryption = GetEncryptionSetup(options.Encryption), }); UO.CommandHandler.RegisterCommand(new Command("reload", () => Reload(), false, true, "Reloads an initial script file.")); csharpScriptEngine = new CSharpScriptEngine(console); scriptEngine = new ScriptEngine(csharpScriptEngine, new InjectionScriptEngine(UO.Injection, console)); console.Info($"\nConfigure your client to use 'localhost,{options.LocalPort}' as Ultima Online server address."); if (!string.IsNullOrEmpty(options.ScriptFileName)) { Load(options.ScriptFileName); } Console.ReadLine(); }
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 = 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 task = proxy.Start(new ProxyStartConfig() { ServerAddress = options.ServerEndpoint, ServerEndPoint = options.ResolveServerEndpoint().Result, LocalProxyPort = options.Generic.Port, ProtocolVersion = options.ProtocolVersion, Encryption = options.Generic.Encryption, LoginEncryptionKey = LoginEncryptionKey.FromVersion(options.Generic.EncryptionVersion) }); return(task); }
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(); })); }
public LaunchHeadlessCommand(LaunchHeadlessOptions options) { commandHandler = new CommandHandler(console); infusionProxy = new InfusionProxy(); pipeName = options.PipeName; scriptFileName = options.ScriptFileName; serverAddress = options.ServerAddress; serverPort = options.ServerPort; proxyPort = options.ProxyPort; encrypt = options.Encrypt; clientVersion = options.ClientVersion; accountName = options.AccountName; accountPassword = options.AccountPassword; shardName = options.ShardName; characterName = options.CharacterName; }
private void InitializeInfusion() { proxy = new InfusionProxy(); fileConsole = new FileConsole(proxy.LogConfig, new CircuitBreaker(HandleFileLoggingException)); var wpfConsole = _console.CreateWpfConsole(); infusionConsole = new InfusionConsole(fileConsole, wpfConsole); proxy.Console = infusionConsole; var commandHandler = new CommandHandler(proxy.Console); _console.Initialize(commandHandler); proxy.Initialize(commandHandler, new SoundPlayer(), new Infusion.Injection.Avalonia.InjectionWindowHandler()); CSharpScriptEngine = new Lazy <CSharpScriptEngine>(() => new CSharpScriptEngine(infusionConsole)); ScriptEngine = new Lazy <ScriptEngine>(() => new ScriptEngine(CSharpScriptEngine.Value, new InjectionScriptEngine(UO.Injection, infusionConsole))); _console.ShowNoDebug(); }
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); }