Example #1
0
        public NodeService(NodeConfig nodeConfig)
        {
            var dataManager = new DataManager(nodeConfig.DataObjectsCount);

            _serverNode       = new ServerNode(nodeConfig.TcpIpEndPoint.Port, nodeConfig.KnownEndPoints, dataManager);
            _discoveryService = new DiscoveryService(nodeConfig.MulticastIpEndPoint, nodeConfig.TcpIpEndPoint, nodeConfig.UdpIpEndPoint, _serverNode);
        }
Example #2
0
        private void LoadConfiguration(string name)
        {
            var path = $"config{name.Last()}.xml";

            using (var reader = new StreamReader(path))
            {
                var serializer = new XmlSerializer(typeof(NodeConfig));
                _nodeConfig = serializer.Deserialize(reader) as NodeConfig;
            }
        }
Example #3
0
        public static NodeConfig GetNodeConfigFromArgs(string[] args)
        {
            var nodeConfig = new NodeConfig
            {
                Name = args[0],
                MulticastIpEndPoint = GetIpEndPointFromString(args[1]),
                UdpIpEndPoint       = GetIpEndPointFromString(args[2]),
                TcpIpEndPoint       = GetIpEndPointFromString(args[3]),
                DataObjectsCount    = Convert.ToInt32(args[4])
            };

            for (var i = 5; i < args.Length; i++)
            {
                nodeConfig.KnownEndPoints.Add(GetIpEndPointFromString(args[i]));
            }
            return(nodeConfig);
        }