예제 #1
0
        public IResult Compare(ABIW_Document answer, ABIW_Document submission)
        {
            int count1 = answer.Document.Range().Paragraphs.Count;
            int count2 = submission.Document.Range().Paragraphs.Count;

            if (count1 == count2)
            {
                for (int i = 1; i <= count1; i++)
                {
                    ABIW_Paragraph answerPara = new ABIW_Paragraph(answer.Document.Range().Paragraphs[i]);
                    ABIW_Paragraph submisPara = new ABIW_Paragraph(submission.Document.Range().Paragraphs[i]);

                    if (answerPara.Compare(submisPara).Result == ComparisonResultIndicate.equal)
                    {
                        continue;
                    }
                    else
                    {
                        return(new ComparisonResult(ComparisonResultIndicate.not_equal));
                    }
                }
                return(new ComparisonResult(ComparisonResultIndicate.equal));
            }
            else
            {
                return(new ComparisonResult(ComparisonResultIndicate.not_equal));
            }
        }
예제 #2
0
 public static bool checkTwoParagraphs(Paragraphs pg1, Paragraphs pg2)
 {
     if (pg1.Count == pg2.Count)
     {
         for (int i = 1; i <= pg1.Count; i++)
         {
             ABIW_Paragraph para1 = new ABIW_Paragraph(pg1[i]);
             ABIW_Paragraph para2 = new ABIW_Paragraph(pg2[i]);
             if (para1.Compare(para2).Result == ComparisonResultIndicate.equal)
             {
                 if (CompareTextRange(para1.Paragraph.Range, para2.Paragraph.Range))
                 {
                     continue;
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #3
0
        public bool checkTwoParagraphs(Paragraphs ps1, Paragraphs ps2)
        {
            bool a = true;

            if (ps1.Count == ps2.Count)
            {
                for (int j = 1; j <= ps1.Count; j++)
                {
                    ABIW_Paragraph paragraph1 = new ABIW_Paragraph(ps1[j]);
                    ABIW_Paragraph paragraph2 = new ABIW_Paragraph(ps2[j]);
                    if (paragraph1.Compare(paragraph2).Result == ComparisonResultIndicate.not_equal)
                    {
                        a = false;
                        break;
                    }
                    else
                    {
                        List <Range> customRangesCorrect = classifyRange2(paragraph1.Paragraph.Range);
                        List <Range> customRangesAnswer  = classifyRange2(paragraph2.Paragraph.Range);
                        if (customRangesCorrect.Count() == customRangesAnswer.Count())
                        {
                            for (int k = 0; k < customRangesCorrect.Count(); k++)
                            {
                                ABIW_Font font1 = new ABIW_Font(customRangesCorrect[k].Font);
                                ABIW_Font font2 = new ABIW_Font(customRangesAnswer[k].Font);
                                //ABIW_Borders borders1 = new ABIW_Borders(customRangesCorrect[k].Borders);
                                //ABIW_Borders borders2 = new ABIW_Borders(customRangesAnswer[k].Borders);
                                if (font1.Compare(font2).Result == ComparisonResultIndicate.not_equal
                                    //|| borders1.Compare(borders2).Result == ComparisonResultIndicate.not_equal
                                    )
                                {
                                    a = false;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            a = false;
                        }
                    }
                }
            }
            else
            {
                a = false;
            }
            return(a);
        }