Skip to content

Commit

Permalink
Update host arg to be separate host/port. Remove IPEndpoint usage tha…
Browse files Browse the repository at this point in the history
…t didn't work with DNS hostnames.
  • Loading branch information
ethanmoffat committed Nov 18, 2022
1 parent f2db780 commit d444a65
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 9 additions & 5 deletions EndlessClient/GameExecution/GameRunnerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,17 @@ public virtual bool SetupDependencies()
if (string.Equals(arg, "--host") && i < _args.Length - 1)
{
var host = _args[i + 1];
_registry.Resolve<IConfigurationRepository>().Host = host;

if (IPEndPoint.TryParse(host, out var endpoint)) {
_registry.Resolve<IConfigurationRepository>()
.Host = endpoint.Address.ToString();
i++;
}
else if(string.Equals(arg, "--port") && i < _args.Length - 1)
{
var port = _args[i + 1];

_registry.Resolve<IConfigurationRepository>()
.Port = endpoint.Port;
if (int.TryParse(port, out var intPort))
{
_registry.Resolve<IConfigurationRepository>().Port = intPort;
}

i++;
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Here's a working list of things I want to add that would be additional features

**--host <server>** Overrides the server set in the config file with a different value. Convenient for testing against different servers from Visual Studio, since the build process will overwrite the configuration file in the output directory.

**--port <port>** Overrides the port set in the config file with a different value.

**--version <version>** Overrides the version set in the config file or hard-coded into the client. Convenient for connecting to different servers that might require different version numbers.

**--account_delay_ms <value>** Sets the delay when creating an account. Some servers enforce a specific limit. Defaults to 2 seconds if unset.
Expand Down

0 comments on commit d444a65

Please sign in to comment.