public override IEnumerable<LocalizedText> Get() { var texts = new Dictionary<string, PrioritizedText>(); if (Sources != null) { foreach (var source in Sources) { foreach (var text in source.Source.Get()) { var key = text.UniqueKey; PrioritizedText current; if (!texts.TryGetValue(key, out current) || (source.Priority > current.Priority && text.Quality >= current.Text.Quality) ) //Prefer texts with better quality { //Use this text if it's new or has higher priority than the current texts[key] = new PrioritizedText { Text = text, Priority = source.Priority }; } } } } return texts.Values.Select(x=>x.Text); }
public override IEnumerable <LocalizedText> Get() { var texts = new Dictionary <string, PrioritizedText>(); if (Sources != null) { foreach (var source in Sources) { foreach (var text in source.Source.Get()) { var key = text.UniqueKey; PrioritizedText current; if (!texts.TryGetValue(key, out current) || (source.Priority > current.Priority && text.Quality >= current.Text.Quality)) //Prefer texts with better quality { //Use this text if it's new or has higher priority than the current texts[key] = new PrioritizedText { Text = text, Priority = source.Priority }; } } } } return(texts.Values.Select(x => x.Text)); }