Пример #1
0
        //...........................................................

        public TextDiffer(string LHS, string RHS)
            :       base()
        {
            InitializeComponent();

            ScrollBarV.Orientation   = Orientation.Vertical;
            ScrollBarV.ValueChanged += ScrollBarVChanged;

            m_model = diffplex.SideBySideDiffBuilder.Diff(LHS, RHS, true, false);

            // derived or caller must call ConstructViewers to complete construction
        }
Пример #2
0
        void AnalyzeResponseContent(int Index, BehaviourAnalysisResult Result)
        {
            DiffPlex.DiffBuilder.Model.SideBySideDiffModel DiffResult = IronDiffer.GetDiff(this.BaseLineSession.Response.BodyString, this.Logs[Index].Response.BodyString);
            int DiffLevel = IronDiffer.GetLevel(DiffResult, this.BaseLineSession.Response.BodyString, this.Logs[Index].Response.BodyString);

            List <string> InsertedStrings = IronDiffer.GetInsertedStrings(DiffResult);
            List <string> DeletedStrings  = IronDiffer.GetDeletedStrings(DiffResult);


            List <string> KeywordsFound = new List <string>();

            foreach (string Keyword in this.Keywords.Keys)
            {
                if (this.Logs[Index].Response.BodyString.IndexOf(Keyword, 0, StringComparison.OrdinalIgnoreCase) > -1)
                {
                    KeywordsFound.Add(Keyword);
                }
            }

            int NoOfInsertedChars = 0;

            foreach (string InsertedString in InsertedStrings)
            {
                NoOfInsertedChars += InsertedString.Length;
                if (KeywordsFound.Count > 0)
                {
                    foreach (string Keyword in KeywordsFound)
                    {
                        if (this.Keywords[Keyword].IsMatch(InsertedString))
                        {
                            if (!Result.ResponseKeywordsResult.Contains(Keyword))
                            {
                                Result.ResponseKeywordsResult.Add(Keyword);
                            }
                        }
                    }
                }
            }
            if (NoOfInsertedChars > BodyDiffMinInterestingInsertedChars)
            {
                Result.ResponseContentResult = NoOfInsertedChars;
            }
        }