Beispiel #1
0
        private void AddNode(LineFS lineFs, string ip, string port, string hostName, NodeSource nodeSource, NetworkMessageInfo source, string sourceType = null)
        {
            if (_file.Start > _file.End)
            {
                throw new DateTimeExt.InvalidDateRangeException();
            }

            var node = new Node
            {
                Ip          = ip,
                Port        = port,
                Host        = hostName,
                iLine       = lineFs.iLine,
                Source      = nodeSource,
                SourceStart = _file.Start,
                SourceEnd   = _file.End
            };
            // Check if the Node already exists
            var found =
                Network.Nodes.Any(
                    n => n.Ip == node.Ip && n.Host == node.Host);

            if (found)
            {
                return;
            }

            if (sourceType == null)
            {
                var results = NetworkMapService.GetNetworkMapFiles(lineFs.Text, source);

                switch (results.Count)
                {
                case 0:
                    node.SourceType = Keywords.NO_FILE;
                    break;

                case 1:
                    node.SourceType = results[0].File.SourceType;
                    break;

                default:
                    node.SourceType = "Multiple Files";
                    break;
                }
            }
            else
            {
                node.SourceType = sourceType;
            }

            // Here we would need to find the target file to determine Source Type
            Network.Nodes.Add(node);
        }
 /// <summary>
 /// Using the NetworkMapService to return a list of files that match
 /// </summary>
 /// <returns></returns>
 public List <NetworkMapFile> GetNetworkMapFiles()
 {
     return(NetworkMapService.GetNetworkMapFiles(MainViewModel.Current.CurrentLineArgs));
 }