示例#1
0
        private void AddDuplicatesStartedFromLine(DuplicateResultFull result, int i)
        {
            var fileLine1 = GetSortedFileLine(i);

            for (int j = i + 1; j < GetLinesCount(); j++)
            {
                var fileLine2 = GetSortedFileLine(j);
                if (fileLine1.Line != fileLine2.Line)
                {
                    break;
                }

                if (IsPartiallyLinked(i, j))
                {
                    continue;
                }

                var duplicateInfo = GetEqualLines(i, j, _parameters.Language);
                if (duplicateInfo.GetLinesCount() < _parameters.NumberOfLinesLowerLimit)
                {
                    continue;
                }
                SetPartialLinks(duplicateInfo);
                var firstPair = duplicateInfo.GetFirstIndexPair();
                result.Add(duplicateInfo.GetLinesCount(), GetFileLine(firstPair.Index1),
                           GetFileLine(firstPair.Index2));
            }
        }
        private DuplicateResultFull GetGivenResult()
        {
            var duplicateResultFull = new DuplicateResultFull();
            var duplicateResult1    = new DuplicateResult(5);

            duplicateResult1.AddUnit("1.txt", 10);
            duplicateResult1.AddUnit("2.txt", 20);
            duplicateResult1.AddUnit("3.txt", 30);
            duplicateResultFull.Add(duplicateResult1);
            var duplicateResult2 = new DuplicateResult(20);

            duplicateResult2.AddUnit("1.txt", 100);
            duplicateResult2.AddUnit("1.txt", 200);
            duplicateResult2.AddUnit("2.txt", 50);
            duplicateResultFull.Add(duplicateResult2);
            return(duplicateResultFull);
        }
示例#3
0
        static void TestXml()
        {
            var resultFull = new DuplicateResultFull();
            var result1    = new DuplicateResult(5);

            result1.AddUnit("1.txt", 222);
            result1.AddUnit("2.txt", 333);
            var result2 = new DuplicateResult(10);

            resultFull.Add(result1);
            resultFull.Add(result2);
            var xml = resultFull.ToXml();

            Console.WriteLine(xml);

            var newResultFull = new DuplicateResultFull();

            newResultFull.InitFromXml(xml);
            Console.ReadKey();
        }