Пример #1
0
        public Migo(ILoggerFactory loggerFactory, MigoEndpoint endpoint)
        {
            _logger = loggerFactory.CreateLogger <Migo>();
            var rwLogger = loggerFactory.CreateLogger <MigoReaderWriter>();

            var(ip, port) = endpoint;
            var endPoint = new IPEndPoint(ip, port);

            _readerWriter = new MigoReaderWriter(endPoint, rwLogger);
        }
Пример #2
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var source = (string)value;
            var parts  = source.Split(':');

            if (parts.Length != 2)
            {
                throw new ArgumentException("Can't convert");
            }

            var ip     = IPAddress.Parse(parts[0]);
            var port   = ushort.Parse(parts[1]);
            var result = new MigoEndpoint(ip, port);

            return(result);
        }