コード例 #1
0
 public static List <string> GetKnownIpsForNode(NodeConfig nodeConfig)
 {
     return(nodeConfig.KnownEndPoints
            .Select(knowedNode =>
                    _config.ServerNodes.FirstOrDefault(node => node.Name == knowedNode)?.TcpIpEndPoint)
            .ToList());
 }
コード例 #2
0
        public static void StartProcesForNode(NodeConfig nodeConfig)
        {
            var serverInfoArgs = new List <string>
            {
                nodeConfig.Name,
                nodeConfig.MulticastIpEndPoint,
                nodeConfig.UdpIpEndPoint,
                nodeConfig.TcpIpEndPoint,
                nodeConfig.DataObjectsCount
            };
            var knownIpsForNode = GetKnownIpsForNode(nodeConfig);

            Process.Start(NodeExePath, BuildArgs(serverInfoArgs.Concat(knownIpsForNode).ToList()));
        }
コード例 #3
0
        private NodeConfig GetNode(XmlNode nodesXmlNode)
        {
            if (nodesXmlNode.Attributes != null)
            {
                var nodeConfig = new NodeConfig
                {
                    Name = nodesXmlNode.Attributes.GetNamedItem("Name").Value ?? Guid.NewGuid().ToString(),
                    MulticastIpEndPoint = nodesXmlNode.Attributes.GetNamedItem("MulticastIpEndPoint")?.Value ?? DefaultMulticastIpEndPoint,
                    UdpIpEndPoint       = nodesXmlNode.Attributes.GetNamedItem("UdpIpEndPoint").Value,
                    TcpIpEndPoint       = nodesXmlNode.Attributes.GetNamedItem("TcpIpEndPoint").Value,
                    DataObjectsCount    = nodesXmlNode.Attributes.GetNamedItem("DataObjects")?.Value ?? DefaultObjectsCount,
                    KnownEndPoints      = GetKnownEndPoints(nodesXmlNode)
                };

                return(nodeConfig);
            }
            return(null);
        }