示例#1
0
        public void Combine(ICombiner combiner, ImageSourcesConfig other)
        {
            var resultGroups = new List <QualityGroupConfig>();

            var groupsByType      = QualityGroups.ToDictionary(_ => _.Name ?? _.Quality);
            var otherGroupsByType = other.QualityGroups.ToDictionary(_ => _.Name ?? _.Quality);

            foreach ((string name, QualityGroupConfig grp) in otherGroupsByType)
            {
                if (groupsByType.TryGetValue(name, out var group))
                {
                    var combined = combiner.Combine(group, grp);
                    resultGroups.Add(combined);
                }
                else
                {
                    resultGroups.Add(grp);
                }
            }

            QualityGroups = resultGroups.ToArray();
        }
示例#2
0
        public void Combine(ICombiner combiner, ImageSourcesConfig other)
        {
            var resultGroups = new List <QualityGroupConfig>();

            var groupsByType      = QualityGroups.ToDictionary(_ => _.Quality);
            var otherGroupsByType = other.QualityGroups.ToDictionary(_ => _.Quality);

            foreach (var entry in otherGroupsByType)
            {
                var otherGroup = entry.Value;

                if (groupsByType.TryGetValue(entry.Key, out var group))
                {
                    var combined = combiner.Combine(group, otherGroup);
                    resultGroups.Add(combined);
                }
                else
                {
                    resultGroups.Add(otherGroup);
                }
            }

            QualityGroups = resultGroups.ToArray();
        }