/// <summary>
 /// </summary>
 /// <param name="networkMapId">Network Map record identifier</param>
 /// <param name="target"></param>
 /// <param name="noNetworkMessages">When True only File Values are used in the Target</param>
 /// <returns></returns>
 public CriteriaMatchModel GetCriteriaMatches(int networkMapId, LineArgs target, bool noNetworkMessages)
 {
     return(NetworkMapService.GetCriteriaMatches(networkMapId,
                                                 MainViewModel.Current.CurrentLineArgs,
                                                 target,
                                                 noNetworkMessages));
 }
        public void Add(NetworkMap item)
        {
            var model = NetworkMapService.Add();

            model.Item = item;
            Add(model);
        }
 public List <SimpleProperty> GetPropertyValues(string path, int iLine)
 {
     return(NetworkMapService.GetPropertyValues(new LineArgs
     {
         Path = path,
         iLine = iLine
     }));
 }
 public void Save(NetworkMapModel model)
 {
     NetworkMapService.Save(model);
     if (View != null)
     {
         View.UpdateView(model);
     }
 }
        public bool Edit(int id)
        {
            var model  = NetworkMapService.Edit(id);
            var window = new AddEditNetworkMap(this);

            window.Render(model);
            return(window.ShowDialog() == DialogResult.OK);
        }
        public void Delete(int id)
        {
            var model = NetworkMapService.Delete(id);

            if (View != null)
            {
                View.UpdateView(model);
            }
        }
Beispiel #7
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);
        }
Beispiel #8
0
        protected override void RunItem(NetworkMessageInfo message)
        {
            var test = NetworkMapService.GetNetworkMessagesBySourceLine(message.SourceItem);

            var targetPath           = string.Empty;
            var targetNetworkMessage = string.Empty;
            var targetDateTime       = new DateTime();
            var targetiLine          = 0;

            if (test.Targets.Count == 1)
            {
                targetPath           = test.Targets[0].Item.Source.FilePath;
                targetNetworkMessage = test.Targets[0].Item.Source.NetworkMessageName;
                targetDateTime       = test.Targets[0].Item.Source.DateTime;
                targetiLine          = test.Targets[0].Item.Source.iLine;
            }

            var item = new NetworkReportItem
            {
                SourceNode           = message.Source.Node,
                SourcePath           = SourcePath,
                SourceNetworkMessage = message.Source.NetworkMessageName,
                SourceiLine          = message.Source.iLine,
                SourceDateTime       = message.Source.DateTime,
                TargetNode           = test.Targets.Count == 1 ? test.Targets[0].Item.Source.Node : "",
                TargetPath           = targetPath,
                TargetNetworkMessage = targetNetworkMessage,
                TargetiLine          = targetiLine,
                TargetDateTime       = targetDateTime,
                TargetMatches        = test.Targets.Count()
            };

            Report.Results.Add(item);

            lock (Report.Summary)
            {
                var summary = Report.Summary.SingleOrDefault(n => n.SourceNode == item.SourceNode &&
                                                             n.TargetNode == item.TargetNode);

                if (summary != null)
                {
                    summary.MessageCount++;
                }
                else
                {
                    Report.Summary.Add(new NetworkReportSummary
                    {
                        SourceNode   = item.SourceNode,
                        TargetNode   = item.TargetNode,
                        MessageCount = 1
                    });
                }
            }
        }
        /// <summary>
        /// Using the current selected LineFS, this method will get the Network Messages that Match
        /// </summary>
        public void GetCurrentLineNetworkMessages(Action <NetworkTargets> callback)
        {
            ThreadPool.QueueUserWorkItem(delegate
            {
                lock (this)
                {
                    var lineArgs      = MainViewModel.Current.CurrentLineArgs;
                    var sourceFile    = XmlDal.CacheModel.GetFile(lineArgs.Path);
                    var sourceMessage = sourceFile.GetNetworkMessage(lineArgs.iLine);
                    if (sourceMessage == null)
                    {
                        Log.WriteError("sourceMessage should never be null!", typeof(NetworkMapingViewModel).FullName, MethodBase.GetCurrentMethod().Name);
                        return;
                    }

                    lock (this)
                        lock (sourceMessage.InternalTargets)
                        {
                            if (sourceMessage.IsCached_Targets)
                            {
                                // The TargetsCached is True so we can simple call the method without showing a Status Message - Sara
                                callback(NetworkMapService.GetNetworkMessagesBySourceLine(lineArgs));
                                return;
                            }

                            try
                            {
                                View.StatusUpdate(StatusModel.StartBackground);
                                View.StatusUpdate(StatusModel.StartStopWatch);
                                View.StatusUpdate(StatusModel.Update(STATUS_TITLE,
                                                                     "Building Current LineFS Network Messages..."));

                                callback(NetworkMapService.GetNetworkMessagesBySourceLine(lineArgs));
                            }
                            finally
                            {
                                View.StatusUpdate(StatusModel.EndBackground);
                                View.StatusUpdate(StatusModel.Completed);
                            }
                        }
                }
            });
        }
 public void Copy(int networkMapId)
 {
     NetworkMapService.Copy(networkMapId);
 }
 public List <CriteriaMatch> GetRecommendedMatches(LineArgs target)
 {
     return(NetworkMapService.GetRecommendedMatches(MainViewModel.Current.CurrentLineArgs, target));
 }
 public List <SimpleProperty> GetCurrentLineValues()
 {
     return(NetworkMapService.GetCurrentLineValues(MainViewModel.Current.CurrentLineArgs));
 }
 /// <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));
 }
 public bool Add()
 {
     return(Add(NetworkMapService.Add()));
 }
 public override NetworkMapCacheData GetModel()
 {
     return(NetworkMapService.GetModel());
 }
Beispiel #16
0
 public void GetNetworkMessages(Action <NetworkTargets> callback)
 {
     NetworkMapService.GetNetworkMessagesBySourceLine(MainViewModel.Current.CurrentLineArgs, callback);
 }