public override void Start(object config) { UnetConfig unetConfig = null; if (config is UnetConfig) { unetConfig = (UnetConfig)config; } else if (config is JObject) { unetConfig = ((JObject)config).ToObject <UnetConfig>(); } Program.DEFAULT_CHANNEL_BYTE = unetConfig.ConnectionConfig.AddChannel(QosType.ReliableSequenced); unetManager = new NetLibraryManager(unetConfig.GlobalConfig); hostId = unetManager.AddHost(new HostTopology(unetConfig.ConnectionConfig, unetConfig.MaxConnections), Program.Config.ListenPort, null); }
public override RelayConfig AfterDeserializedConfig(RelayConfig config) { UnetConfig unetConfig = null; if (config.TransportConfig is UnetConfig) { unetConfig = (UnetConfig)config.TransportConfig; } else if (config.TransportConfig is JObject) { unetConfig = ((JObject)config.TransportConfig).ToObject <UnetConfig>(); } unetConfig.ConnectionConfig.Channels.Clear(); for (int i = 0; i < unetConfig.Channels.Count; i++) { unetConfig.ConnectionConfig.AddChannel(unetConfig.Channels[i]); } return(config); }