Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
0.4.0
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
using System.Collections.Generic;
using Improbable.Worker.CInterop;
namespace Improbable.Gdk.Core
{
/// <summary>
/// Represents an object which can initialize the connection parameters.
/// </summary>
public interface IConnectionParameterInitializer
{
/// <summary>
/// Initializes the connection parameters.
/// </summary>
/// <param name="connectionParameters">The <see cref="ConnectionParameters"/> object to initialize.</param>
void Initialize(ConnectionParameters connectionParameters);
}
public class CommandLineConnectionParameterInitializer : IConnectionParameterInitializer
{
private readonly CommandLineArgs commandLineArgs;
public CommandLineConnectionParameterInitializer()
{
commandLineArgs = CommandLineArgs.FromCommandLine();
}
internal CommandLineConnectionParameterInitializer(Dictionary<string, string> args)
{
commandLineArgs = CommandLineArgs.From(args);
}
public void Initialize(ConnectionParameters connectionParameters)
{
commandLineArgs.TryGetCommandLineValue(RuntimeConfigNames.LinkProtocol,
ref connectionParameters.Network.ConnectionType);
connectionParameters.Network.UseExternalIp = commandLineArgs.Contains(RuntimeConfigNames.UseExternalIp);
}
}
}