Exemple #1
0
        private DiffResult[] DiffCore(string textA, string textB, DiffOption option)
        {
            this.linesA = SplitLine(textA, option);
            this.linesB = SplitLine(textB, option);

            if (this.linesB.Length < this.linesA.Length)
            {
                this.isSwap = true;

                string[] tmps = this.linesA;
                this.linesA = this.linesB;
                this.linesB = tmps;
            }
            this.dataA = MakeHash(this.linesA);
            this.dataB = MakeHash(this.linesB);

            this.isSame = delegate(int posA, int posB)
            {
                return((this.dataA[posA] == this.dataB[posB]) && (this.linesA[posA] == this.linesB[posB]));
            };

            return(DetectDiff());
        }
Exemple #2
0
        /// <summary>複数行の文字列を行単位で比較します</summary>
        /// <param name="textA">元テキスト</param>
        /// <param name="textB">変更テキスト</param>
        /// <returns>比較結果</returns>
        public static DiffResult[] Diff(string textA, string textB)
        {
            DiffOption option = new DiffOption();

            return(Diff(textA, textB, option));
        }
Exemple #3
0
 private void SplitChar(string textA, string textB, DiffOption option)
 {
     this.dataA = SplitChar(textA, option);
     this.dataB = SplitChar(textB, option);
 }