示例#1
0
        /// <summary>
        /// Diffs two html strings and marks them up
        /// </summary>
        /// <param name="html"></param>
        /// <returns></returns>
        private void diff()
        {
            //parse the html
            HTMLchunk[] chunks1 = htmlParse(_html1);
            HTMLchunk[] chunks2 = htmlParse(_html2);

            //make a hash array of the chunks
            int[] hash1 = hash(chunks1);
            int[] hash2 = hash(chunks2);

            //diff the hashes
            Menees.DiffUtils.MyersDiff myerdiff = new Menees.DiffUtils.MyersDiff(hash1, hash2);
            //get a collection of changes
            EditScript edits = myerdiff.Execute();

            //record if there are any differences
            _areDifferent = (edits.Count > 0);

            //markup changes
            _diffedSource1 = getMarkedUpSource(chunks1, edits, true);
            _diffedSource2 = getMarkedUpSource(chunks2, edits, false);
            _diffedHtml1   = getMarkedUpHtml(chunks1, edits, true);
            _diffedHtml2   = getMarkedUpHtml(chunks2, edits, false);
            _addedKeywords = getKewords(chunks2, edits);
        }
示例#2
0
        public EditScript Execute(IList A, IList B)
        {
            int[] arHashA = HashStringList(A);
            int[] arHashB = HashStringList(B);

            MyersDiff Diff = new MyersDiff(arHashA, arHashB);

            return(Diff.Execute());
        }
示例#3
0
        /// <summary>
        /// Diffs two html strings and marks them up
        /// </summary>
        /// <param name="html"></param>
        /// <returns></returns>
        private void diff()
        {
            //parse the html
            HTMLchunk[] chunks1 = htmlParse(_html1);
            HTMLchunk[] chunks2 = htmlParse(_html2);

            //make a hash array of the chunks
            int[] hash1 = hash(chunks1);
            int[] hash2 = hash(chunks2);

            //diff the hashes
            Menees.DiffUtils.MyersDiff myerdiff = new Menees.DiffUtils.MyersDiff(hash1, hash2);
            //get a collection of changes
            EditScript edits = myerdiff.Execute();

            //record if there are any differences
            _areDifferent = (edits.Count > 0);

            //markup changes
            _diffedSource1 = getMarkedUpSource(chunks1, edits, true);
            _diffedSource2 = getMarkedUpSource(chunks2, edits, false);
            _diffedHtml1 = getMarkedUpHtml(chunks1, edits, true);
            _diffedHtml2 = getMarkedUpHtml(chunks2, edits, false);
            _addedKeywords = getKewords(chunks2, edits);
        }