private static void GetRelatedContent(Game game, ModClientApiJsonV3WithGameId c,
                                              IDictionary <Guid, ModClientApiJsonV3WithGameId> dependencyChain,
                                              IDictionary <Guid, ModClientApiJsonV3WithGameId> onlineContent)
        {
            // A dictionary would not retain order, however we dont need to retain order currently
            if (dependencyChain.ContainsKey(c.Id))
            {
                return;
            }
            dependencyChain.Add(c.Id, c);
            var defaultTags = new List <string>();

            if (c.GameId != game.Id)
            {
                // Make a copy of the DTO, and clone the list, because otherwise the changes might bleed through to other games, or cached re-usages
                c = c.MapTo <ModClientApiJsonV3WithGameId>();
                c.Dependencies = c.Dependencies.ToList();
                var cMods = game.GetCompatibilityMods(c.PackageName, c.Tags ?? defaultTags);
                foreach (var m in cMods)
                {
                    var theM =
                        onlineContent.Values.FirstOrDefault(
                            x => x.PackageName.Equals(m, StringComparison.CurrentCultureIgnoreCase));
                    if ((theM != null) && c.Dependencies.All(x => x.Id != theM.Id))
                    {
                        c.Dependencies.Add(new ContentGuidSpec {
                            Id = theM.Id
                        });
                    }
                }
            }
            GetRelatedContent(game, c.Dependencies.Select(x => onlineContent[x.Id]), dependencyChain, onlineContent);
            dependencyChain.Remove(c.Id);
            dependencyChain.Add(c.Id, c);
        }
 public bool IsMatch(ModClientApiJsonV3WithGameId c)
 => c.Publishers.Any(x => Publishers.Any(p => p.Id == x.Id && p.Type == x.Type)) ||
 PackageNames.ContainsIgnoreCase(c.PackageName) ||
 Ids.Contains(c.Id);
        private static void GetRelatedContent(Game game, ModClientApiJsonV3WithGameId c,
            IDictionary<Guid, ModClientApiJsonV3WithGameId> dependencyChain,
            IDictionary<Guid, ModClientApiJsonV3WithGameId> onlineContent) {
            // A dictionary would not retain order, however we dont need to retain order currently
            if (dependencyChain.ContainsKey(c.Id))
                return;
            dependencyChain.Add(c.Id, c);
            var defaultTags = new List<string>();

            if (c.GameId != game.Id) {
                // Make a copy of the DTO, and clone the list, because otherwise the changes might bleed through to other games, or cached re-usages
                c = c.MapTo<ModClientApiJsonV3WithGameId>();
                c.Dependencies = c.Dependencies.ToList();
                var cMods = game.GetCompatibilityMods(c.PackageName, c.Tags ?? defaultTags);
                foreach (var m in cMods) {
                    var theM =
                        onlineContent.Values.FirstOrDefault(
                            x => x.PackageName.Equals(m, StringComparison.CurrentCultureIgnoreCase));
                    if ((theM != null) && c.Dependencies.All(x => x.Id != theM.Id))
                        c.Dependencies.Add(new ContentGuidSpec {Id = theM.Id});
                }
            }
            GetRelatedContent(game, c.Dependencies.Select(x => onlineContent[x.Id]), dependencyChain, onlineContent);
            dependencyChain.Remove(c.Id);
            dependencyChain.Add(c.Id, c);
        }
 public bool IsMatch(ModClientApiJsonV3WithGameId c)
     => c.Publishers.Any(x => Publishers.Any(p => (p.Id == x.Id) && (p.Type == x.Type)))
        || PackageNames.ContainsIgnoreCase(c.PackageName)
        || Ids.Contains(c.Id);