Пример #1
0
        public object Clone()
        {
            var stats = new ConfirmationStatistics
            {
                WordCounts = WordCounts.Clone() as WordCounts
            };

            return(stats);
        }
Пример #2
0
        private ConfirmationStatistics GetTotalConfirmationStatistics(IEnumerable <ProjectFile> projectFiles, Enumerators.Action action)
        {
            var statistics = new ConfirmationStatistics();

            foreach (var projectFile in projectFiles)
            {
                if (projectFile.ConfirmationStatistics?.WordCounts != null)
                {
                    foreach (var wordCount in projectFile.ConfirmationStatistics?.WordCounts?.Processed)
                    {
                        var totalWordCount = statistics.WordCounts.Processed.FirstOrDefault(a =>
                                                                                            a.Category == wordCount.Category);
                        if (totalWordCount != null)
                        {
                            UpdateTotalWordCount(wordCount, totalWordCount);
                        }
                        else
                        {
                            statistics.WordCounts.Processed.Add(wordCount);
                        }
                    }

                    foreach (var wordCount in projectFile.ConfirmationStatistics?.WordCounts?.Excluded)
                    {
                        var totalWordCount = statistics.WordCounts.Excluded.FirstOrDefault(a =>
                                                                                           a.Category == wordCount.Category);
                        if (totalWordCount != null)
                        {
                            UpdateTotalWordCount(wordCount, totalWordCount);
                        }
                        else
                        {
                            statistics.WordCounts.Excluded.Add(wordCount);
                        }
                    }

                    if (action == Enumerators.Action.Import)
                    {
                        foreach (var wordCount in projectFile.ConfirmationStatistics?.WordCounts?.NotProcessed)
                        {
                            var totalWordCount = statistics.WordCounts.NotProcessed.FirstOrDefault(a =>
                                                                                                   a.Category == wordCount.Category);
                            if (totalWordCount != null)
                            {
                                UpdateTotalWordCount(wordCount, totalWordCount);
                            }
                            else
                            {
                                statistics.WordCounts.NotProcessed.Add(wordCount);
                            }
                        }
                    }
                }
            }

            return(statistics);
        }