Пример #1
0
        /// <summary>
        /// Get Changed Documents:
        /// When onlyGetDocumentsWithTextChanges is true, only get documents with text changes;
        /// otherwise get documents with any changes i.e. DocumentState changes:
        /// <see cref="DocumentState.ParseOptions"/>, <see cref="DocumentState.SourceCodeKind"/>, <see cref="TextDocumentState.FilePath"/>
        /// </summary>
        /// <param name="onlyGetDocumentsWithTextChanges"></param>
        /// <returns></returns>
        public IEnumerable <DocumentId> GetChangedDocuments(bool onlyGetDocumentsWithTextChanges)
        {
            foreach (var id in _newProject.DocumentIds)
            {
                var newState = _newProject.GetDocumentState(id);
                var oldState = _oldProject.GetDocumentState(id);

                if (oldState != null)
                {
                    if (onlyGetDocumentsWithTextChanges)
                    {
                        if (newState.HasTextChanged(oldState))
                        {
                            yield return(id);
                        }
                    }
                    else
                    {
                        if (newState != oldState)
                        {
                            yield return(id);
                        }
                    }
                }
            }
        }
Пример #2
0
 public IEnumerable <DocumentId> GetChangedDocuments()
 {
     // if the document states are different then there is a change.
     foreach (var id in _newProject.DocumentIds)
     {
         var newState = _newProject.GetDocumentState(id);
         var oldState = _oldProject.GetDocumentState(id);
         if (oldState != null && newState != oldState)
         {
             yield return(id);
         }
     }
 }