Пример #1
0
        /// <summary>
        /// Applies Profile Settings to ModList
        /// </summary>
        #region Appply Mod Settings
        /// <summary>
        /// Change Load Order and enables mods depending on active profile
        /// </summary>
        public void ApplyModSettings(Dos2ModsSettings activeSettings)
        {
            //Dos2ModsSettings activeSettings = ParentViewModel.Profiles.FirstOrDefault(x => x.IsActive);
            foreach (var mod in ModsList)
            {
                mod.IsEnabled = activeSettings.ActiveMods.Contains(mod.UUID);
                //find index of mod by UUID
                mod.LoadOrder = activeSettings.ModLoadOrder.FindIndex(x => x == mod.UUID);
            }
            var uncategorized = ModsList.Where(x => x.LoadOrder < 0).ToList();

            foreach (var item in uncategorized)
            {
                // give highest load order index
                int maxLoadOrder = ModsList.Max(x => x.LoadOrder);
                item.LoadOrder = maxLoadOrder + 1;
            }

            SortCollectionByProperty("LoadOrder");
        }