public IEnumerable <StringSectionMatch> ComapreStringSections(FlattenedDatasheet datasheet1, FlattenedDatasheet datasheet2)
        {
            List <StringSectionMatch> matches = new List <StringSectionMatch>(datasheet1.FlattenedSections.Count * datasheet2.FlattenedSections.Count);

            Parallel.ForEach(datasheet1.FlattenedSections, x =>
            {
                Parallel.ForEach(datasheet2.FlattenedSections, y =>
                {
                    foreach (var section1 in x.StringSections)
                    {
                        foreach (var section2 in y.StringSections)
                        {
                            if (section1.Id != section2.Id)
                            {
                                if (section1.StringHash == section2.StringHash && section1.StringLength == section2.StringLength)
                                {
                                    matches.Add(new StringSectionMatch
                                    {
                                        Section1 = section1,
                                        Section2 = section2
                                    });
                                }
                            }
                        }
                    }
                });
            });
            return(matches);
        }
Esempio n. 2
0
        public FlattenedDatasheet FlattenDatasheet(Datasheet.Dal.Ef.Datasheet datasheet)
        {
            FlattenedDatasheet flatDatasheet = new FlattenedDatasheet
            {
                DataSheetId       = datasheet.DatasheetId,
                FlattenedSections = new List <FlattenedSection>(datasheet.Sections.Count)
            };

            foreach (var section in datasheet.Sections)
            {
                flatDatasheet.FlattenedSections.Add(this.FlattenSection(section));
            }

            return(flatDatasheet);
        }