Пример #1
0
        public void UpdateCustomRepoServerInfo(IContentManager modList, SixRepoServer repoServer, string url,
                                               SixRepo repo)
        {
            if (modList == null)
            {
                throw new ArgumentNullException(nameof(modList));
            }
            if (repoServer == null)
            {
                throw new ArgumentNullException(nameof(repoServer));
            }
            if (url == null)
            {
                throw new ArgumentNullException(nameof(url));
            }
            if (repo == null)
            {
                throw new ArgumentNullException(nameof(repo));
            }

            UpdateSharedRepoInfo(url, repo);

            var rMods        = repoServer.RequiredMods;
            var optionalMods =
                repoServer.AllowedMods.Where(x => !SixRepoServer.SYS.Contains(x))
                .DistinctBy(x => x.ToLower())
                .ToList();
            var requiredMods =
                rMods.Where(x => !SixRepoServer.SYS.Contains(x)).DistinctBy(x => x.ToLower()).ToArray();

            Name           = GetNameFromServerOrRepo(repoServer, repo);
            Mods           = requiredMods.ToList();
            SkipServerMods = rMods.None(SixRepoServer.SYS.Contains);
            RequiredMods   =
                requiredMods.Where(x => !optionalMods.Contains(x, StringComparer.CurrentCultureIgnoreCase)).ToList();
            OptionalMods = optionalMods;
            DisabledItems.AddWhenMissing(optionalMods.Where(x =>
                                                            !requiredMods.Contains(x, StringComparer.CurrentCultureIgnoreCase) &&
                                                            !AdditionalMods.Contains(x, StringComparer.CurrentCultureIgnoreCase)),
                                         StringComparison.CurrentCultureIgnoreCase);

            AdditionalMods.AddWhenMissing(optionalMods, StringComparison.CurrentCultureIgnoreCase);

            Image      = String.IsNullOrWhiteSpace(repoServer.Image) ? repo.Config.Image : repoServer.Image;
            ImageLarge =
                String.IsNullOrWhiteSpace(repoServer.ImageLarge)
                    ? repo.Config.ImageLarge
                    : repoServer.ImageLarge;

            CustomRepoUuid = repoServer.Uuid;
            CustomRepoApps = repoServer.Apps.Where(x => repo.Config.Apps.ContainsKey(x))
                             .Select(x => repo.Config.Apps[x]).ToArray();
            IsOpen         = repoServer.IsOpen;
            ForceModUpdate = repoServer.ForceModUpdate;

            HandleModsetMods(modList);
            UpdateState();
        }
Пример #2
0
 static string GetNameFromServerOrRepo(SixRepoServer repoServer, SixRepo repo) => String.IsNullOrWhiteSpace(repoServer.Name) ? GetNameFromRepo(repo) : repoServer.Name;