Example #1
0
 public override void UpdateProperties(IEnumerable <ConnectorProperty> properties)
 {
     _properties = CascadiaTxnServerInstanceProperties.Parse(properties);
     PortRegistry.AddOrUpdate(
         _instanceId,
         guid => _properties.LocalPort,
         (guid, i) => _properties.LocalPort);
     StartInstance();
 }
Example #2
0
        public static CascadiaTxnServerInstanceProperties Parse(IEnumerable <ConnectorProperty> properties)
        {
            var instanceProperties = new CascadiaTxnServerInstanceProperties();

            foreach (var property in properties)
            {
                switch (property.Key)
                {
                case nameof(Resources.Interface):
                {
                    instanceProperties.LocalIp =
                        Cascadia.Net.Util.GetIpAddressByString(((ConnectorStringProperty)property).Value);
                    break;
                }

                case nameof(Resources.LocalPort):
                {
                    instanceProperties.LocalPort = ((ConnectorIntegerProperty)property).Value;
                    break;
                }

                case nameof(Resources.AllowedExternalAddresses):
                {
                    instanceProperties.AllowedExternalAddresses =
                        ((ConnectorStringProperty)property).Value.Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(a => a.Trim()).ToList();
                    break;
                }

                case nameof(Resources.Echo):
                {
                    instanceProperties.Echo = ((ConnectorBooleanProperty)property).Value;
                    break;
                }

                case nameof(Resources.EnableKeepAlives):
                {
                    instanceProperties.EnableKeepAlives = ((ConnectorBooleanProperty)property).Value;
                    break;
                }
                }
            }

            return(instanceProperties);
        }