Пример #1
0
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            if (Settings.ExtractComments)
            {
                for (int i = 0; i < commentMarker.Comments.Count; i++)
                {
                    IComment comment = commentMarker.Comments.GetItem(i);
                    var startComment = new Token(comment.Text, Token.TokenType.CommentStart)
                    {
                        Author = comment.Author,
                        Date = comment.Date
                    };
                    _tokens.Add(startComment);

                    Comments.Add("[" + comment.Author + " " + comment.Date + "] " + comment.Text);
                }
            }
            VisitChildren(commentMarker);
            if (Settings.ExtractComments)
            {
                for (var i = 0; i < commentMarker.Comments.Count; i++)
                {
                    _tokens.Add(new Token("commentend", Token.TokenType.CommentEnd));
                }
            }
        }
Пример #2
0
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            if (Settings.ExtractComments)
            {
                for (var i = 0; i < commentMarker.Comments.Count; i++)
                {
                    var comment      = commentMarker.Comments.GetItem(i);
                    var startComment = new Token(comment.Text, Token.TokenType.CommentStart)
                    {
                        Author = comment.Author,
                        Date   = comment.Date
                    };
                    _tokens.Add(startComment);

                    Comments.Add("[" + comment.Author + " " + comment.Date + "] " + comment.Text);
                }
            }

            VisitChildren(commentMarker);

            if (Settings.ExtractComments)
            {
                for (var i = 0; i < commentMarker.Comments.Count; i++)
                {
                    _tokens.Add(new Token("commentend", Token.TokenType.CommentEnd));
                }
            }
        }
Пример #3
0
 //visit functions
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     foreach (var item in commentMarker.AllSubItems)
     {
         item.AcceptVisitor(this);
     }
 }
Пример #4
0
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     foreach (var commentProperty in commentMarker.Comments.Comments)
     {
         commentProperty.Author = _commentAuthor;
     }
 }
 //visit functions
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     foreach (IAbstractMarkupData item in commentMarker.AllSubItems)
     {
         item.AcceptVisitor(this);
     }
 }
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     for (int i = 0; i < commentMarker.Comments.Count; i++)
     {
         _Comments.Add(commentMarker.Comments.GetItem(i).Text);
     }
     VisitChildren(commentMarker);
 }
Пример #7
0
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     foreach (var commentProperty in commentMarker.Comments.Comments)
     {
         Comments.Add(commentProperty);
     }
     VisitChilderen(commentMarker);
 }
Пример #8
0
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            if (FoundElement != null)
            {
                return;
            }

            VisitChildren(commentMarker);
        }
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            var newComment = _itemFactory.CreateCommentMarker(commentMarker.Comments);
            _parentParagraph.Add(newComment);
            _currentContainer = newComment;

            VisitChildElements(commentMarker);

            _currentContainer = newComment.Parent;
        }
Пример #10
0
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            var newComment = _itemFactory.CreateCommentMarker(commentMarker.Comments);

            _parentParagraph.Add(newComment);
            _currentContainer = newComment;

            VisitChildElements(commentMarker);

            _currentContainer = newComment.Parent;
        }
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            var commentMarker2 = _itemFactory.CreateCommentMarker(commentMarker.Comments);

            _currentContainer.Add(commentMarker2);
            _currentContainer = commentMarker2;
            foreach (var current in commentMarker)
            {
                current.AcceptVisitor(this);
            }
            _currentContainer = commentMarker2.Parent;
        }
Пример #12
0
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            for (int i = 0; i < commentMarker.Comments.Count; i++)
            {
                string commentInfo = commentMarker.Comments.GetItem(i).Text + ";" +
                                     commentMarker.Comments.GetItem(i).Date.ToString() + ";" +
                                     commentMarker.Comments.GetItem(i).Author + ";" +
                                     commentMarker.Comments.GetItem(i).Severity.ToString();

                _Comments.Add(commentInfo);
            }
            VisitChildren(commentMarker);
        }
Пример #13
0
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            for (int i = 0; i < commentMarker.Comments.Count; i++)
            {
                string commentInfo = commentMarker.Comments.GetItem(i).Text + ";" +
                    commentMarker.Comments.GetItem(i).Date.ToString() + ";" +
                    commentMarker.Comments.GetItem(i).Author + ";" +
                    commentMarker.Comments.GetItem(i).Severity.ToString();

                _Comments.Add(commentInfo);

            }
            VisitChildren(commentMarker);
        }
Пример #14
0
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            for (var i = 0; i < commentMarker.Comments.Count; i++)
            {
                var comment = new Comment
                {
                    Author   = commentMarker.Comments.GetItem(i).Author,
                    Date     = commentMarker.Comments.GetItem(i).Date,
                    Severity = commentMarker.Comments.GetItem(i).Severity.ToString(),
                    Text     = commentMarker.Comments.GetItem(i).Text,
                    Version  = commentMarker.Comments.GetItem(i).Version
                };

                Comments.Add(comment);
            }

            VisitChildren(commentMarker);
        }
Пример #15
0
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            var id       = Guid.NewGuid().ToString();
            var comments = new List <IComment>();

            foreach (var comment in commentMarker.Comments.Comments)
            {
                comments.Add(comment);
                //The severity level has not been specified
                //Undefined = 0,

                //Informational purpose
                //Low = 1,

                //Warning, likely an important issue
                //Medium = 2,

                //Error, a severe issue
                //High = 3,

                //Sentinel, not used
                //Invalid = 100
            }

            Comments.Add(id, comments);

            var commentOpen = new ElementComment
            {
                Type = Element.TagType.OpeningTag,
                Id   = id
            };

            Elements.Add(commentOpen);

            VisitChilderen(commentMarker);

            var commentClose = new ElementComment
            {
                Type = Element.TagType.ClosingTag,
                Id   = id
            };

            Elements.Add(commentClose);
        }
Пример #16
0
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            for (var i = 0; i < commentMarker.Comments.Count; i++)
            {
                var comment      = commentMarker.Comments.GetItem(i);
                var startComment = new Token {
                    Content = comment.Text, Type = Token.TokenType.CommentStart
                };
                startComment.Author = comment.Author;
                startComment.Date   = comment.Date;
                _tokens.Add(startComment);

                Comments.Add("[" + comment.Author + " " + comment.Date + "] " + comment.Text);
            }

            VisitChildren(commentMarker);

            for (int i = 0; i < commentMarker.Comments.Count; i++)
            {
                _tokens.Add(new Token {
                    Content = "commentend", Type = Token.TokenType.CommentEnd
                });
            }
        }
Пример #17
0
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     VisitChildren(commentMarker);
 }
Пример #18
0
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
 }
 /// <summary>
 ///     All comment markers are marked to be deleted. The children of the comment will be
 ///     copied to the parent so still need processing
 /// </summary>
 /// <param name="commentMarker"></param>
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     nodesToDelete.Add(commentMarker);
     VisitChildren(commentMarker);
 }
        private int PerformReplaceIterator(Location textLocation, int textIndexStart, int textLength, ref int textIndex)
        {
            bool isWarning = false;

            _lockedCharactersCount = 0;
            TextCharacterCountingIterator iterator = new TextCharacterCountingIterator(textLocation);

            do
            {
                // if (iterator.CharacterCount + iterator.CharactersToNextLocation > textIndexStart)
                if (iterator.CharacterCount + iterator.CharactersToNextLocation + _charactersShift > textIndexStart)
                {
                    // text with tags - do not replace, report warning
                    //if (iterator.CharacterCount + iterator.CharactersToNextLocation < textIndexStart + textLength)
                    if (iterator.CharacterCount + iterator.CharactersToNextLocation + _charactersShift < textIndexStart + textLength)
                    {
                        //textIndex = (iterator.CharacterCount + iterator.CharactersToNextLocation) - (textIndexStart + textLength);
                        textIndex = (iterator.CharacterCount + iterator.CharactersToNextLocation + _charactersShift) - (textIndexStart + textLength);
                        isWarning = true;
                    }

                    #region IText
                    IText text = iterator.CurrentLocation.ItemAtLocation as IText;
                    if (text != null && !isWarning)
                    {
                        // real index in IText
                        textIndex = textIndexStart - (iterator.CharacterCount + _charactersShift);

                        // replace the text of IText
                        string replacedText = TextReplace(text.Properties.Text, textIndex, textLength);
                        iterator.CurrentLocation.ItemAtLocation.Parent[iterator.CurrentLocation.ItemAtLocation.IndexInParent] =
                            ItemFactory.CreateText(PropertiesFactory.CreateTextProperties(replacedText));
                        return(0);
                    }
                    #endregion

                    #region Tags
                    if (isWarning)
                    {
                        IPlaceholderTag phTag   = iterator.CurrentLocation.ItemAtLocation as IPlaceholderTag;
                        ITagPair        tagPair = iterator.CurrentLocation.ItemAtLocation as ITagPair;
                        if (phTag != null || tagPair != null)
                        {
                            return(-1);
                        }
                        tagPair = iterator.CurrentLocation.BottomLevel.Parent as ITagPair;
                        if (iterator.CurrentLocation.BottomLevel.IsAtEndOfParent && tagPair != null)
                        {
                            return(-1);
                        }
                    }
                    #endregion

                    #region Comment
                    if (isWarning)
                    {
                        ICommentMarker comment = iterator.CurrentLocation.ItemAtLocation as ICommentMarker;
                        if (comment != null)
                        {
                            return(-3);
                        }
                        comment = iterator.CurrentLocation.BottomLevel.Parent as ICommentMarker;
                        if (iterator.CurrentLocation.BottomLevel.IsAtEndOfParent && comment != null)
                        {
                            return(-3);
                        }
                    }
                    #endregion
                }

                #region LockedContent
                ILockedContent content = iterator.CurrentLocation.ItemAtLocation as ILockedContent;
                if (content != null)
                {
                    if (isWarning)
                    {
                        return(-2);
                    }
                    // real index in ILockedContent
                    textIndex = textIndexStart - (iterator.CharacterCount + _charactersShift);

                    // call the iterator for Locked Content
                    Location lockedLocation = new Location((IAbstractMarkupDataContainer)content.Content, true);
                    int      sts            = PerformReplaceIterator(lockedLocation, textIndex, textLength, ref textIndex);

                    // CODE TO FIX TextCharacterCountingIterator BUG !!! >>
                    // if TextCharacterCountingIterator failed to get CharactersToNextLocation,
                    // we calculate it manually and save as _charactersShift
                    if (iterator.CharactersToNextLocation == 0)
                    {
                        _charactersShift += _lockedCharactersCount;
                    }
                    if (sts != -4)
                    {
                        return(sts);
                    }
                }
                content = iterator.CurrentLocation.BottomLevel.Parent as ILockedContent;
                if (iterator.CurrentLocation.BottomLevel.IsAtEndOfParent && content != null)
                {
                    if (isWarning)
                    {
                        return(-1);
                    }
                }
                #endregion
            } while (iterator.MoveNext());

            _lockedCharactersCount = iterator.CharacterCount;

            return(-4);
        }
Пример #21
0
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     //Nothing to add
 }
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     // start of comments have no character count
 }
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     //Nothing to do
 }
Пример #24
0
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     // ignore; not used for this implementation
 }
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     // Not required for this implementation.
 }
Пример #26
0
 public void VisitCommentMarker(ICommentMarker commentMarker)
 {
     VisitChildren(commentMarker);
 }