Example #1
0
        private DiffResult ProcessDiff()
        {
            for (int i = 0; i < N.Count(); i++)
            {
                var line = N.GetByIndex(i);
                if (!IsInTable(line))
                {
                    line.NC = DiffCounter.One;
                    table.Add(line.Line, line);
                }
                else
                {
                    line = (ITextLine)table[line.Line];
                    if (line == null)
                    {
                        continue;
                    }

                    if (line.NC == DiffCounter.One)
                    {
                        line.NC = DiffCounter.Two;
                    }
                    else
                    {
                        line.NC = DiffCounter.Many;
                    }
                }
                NA.Insert(i, line);
            }

            for (int i = 0; i < O.Count(); i++)
            {
                var line = O.GetByIndex(i);
                if (!IsInTable(line))
                {
                    line.OC = DiffCounter.One;
                    table.Add(line.Line, line);
                }
                else
                {
                    line = (ITextLine)table[line.Line];
                    if (line == null)
                    {
                        continue;
                    }

                    if (line.OC == DiffCounter.Zero)
                    {
                        line.OC = DiffCounter.One;
                    }
                    else if (line.OC == DiffCounter.One)
                    {
                        line.OC = DiffCounter.Two;
                    }
                    else
                    {
                        line.OC = DiffCounter.Many;
                    }
                }
                line.OLNO = i;

                OA.Insert(i, line);
            }

            return(GenerateDiffResult());
        }