예제 #1
0
        public ApplicationViewModel(ImageApplicationPathTuple tuple, ManageModsViewModel modsViewModel)
        {
            ApplicationTuple    = tuple;
            ManageModsViewModel = modsViewModel;


            IoC.Kernel.Rebind <ApplicationViewModel>().ToConstant(this);
            InstanceTracker = new ApplicationInstanceTracker(tuple.Config.AppLocation);
            ManageModsViewModel.OnGetModifications += OnGetModifications;
            InstanceTracker.OnProcessesChanged     += OnProcessesChanged;

            UpdateReloadedProcesses();
            GetModsForThisApp();
            RefreshProcessesWithLoaderTimer = new Timer(RefreshTimerCallback, null, 500, _xamlProcessRefreshInterval.Get());
            Page = ApplicationSubPage.ApplicationSummary;
        }
예제 #2
0
        /// <summary>
        /// Tries to find all incompatible mods to the current application config's set of mods.
        /// Sanity check after loading mod sets.
        /// </summary>
        /// <param name="incompatibleModIds">List of incompatible mods.</param>
        public static bool TryGetIncompatibleMods(ImageApplicationPathTuple application, IEnumerable <ImageModPathTuple> mods, out List <ImageModPathTuple> incompatibleModIds)
        {
            var enabledModIds = application.Config.EnabledMods;

            incompatibleModIds = new List <ImageModPathTuple>(enabledModIds.Length);

            foreach (var enabledModId in enabledModIds)
            {
                // ReSharper disable once PossibleMultipleEnumeration
                var mod = mods.FirstOrDefault(x => x.ModConfig.ModId == enabledModId);
                if (mod == null)
                {
                    continue;
                }

                if (!mod.ModConfig.SupportedAppId.Contains(application.Config.AppId))
                {
                    incompatibleModIds.Add(mod);
                }
            }

            return(incompatibleModIds.Count > 0);
        }
 /* Setup & Teardown */
 public IncompatibleModArchiveViewmodel(IEnumerable <ImageModPathTuple> modConfigs, ImageApplicationPathTuple applicationConfig)
 {
     Mods = modConfigs;
     ApplicationConfig = applicationConfig;
 }
 public IncompatibleModDialog(IEnumerable <ImageModPathTuple> modConfigs, ImageApplicationPathTuple config)
 {
     InitializeComponent();
     ViewModel = new IncompatibleModArchiveViewmodel(modConfigs, config);
 }
예제 #5
0
 /// <summary>
 /// Deploys Ultimate ASI Loader to a given application profile.
 /// </summary>
 public AsiLoaderDeployer(ImageApplicationPathTuple application)
 {
     Application = application;
 }
예제 #6
0
 public MakeShortcutCommand(ImageApplicationPathTuple config)
 {
     _config = config;
 }
        /// <summary>
        /// Builds the initial set of mods to display in the list.
        /// </summary>
        private List <BooleanGenericTuple <ImageModPathTuple> > GetInitialModSet(ApplicationViewModel model, ImageApplicationPathTuple applicationTuple)
        {
            // Note: Must put items in top to bottom load order.
            var enabledModIds  = applicationTuple.Config.EnabledMods;
            var modsForThisApp = model.ModsForThisApp.ToArray();

            // Get dictionary of mods by Mod ID
            var modDictionary = new Dictionary <string, ImageModPathTuple>();

            foreach (var mod in modsForThisApp)
            {
                modDictionary[mod.ModConfig.ModId] = mod;
            }

            // Add enabled mods.
            var totalModList = new List <BooleanGenericTuple <ImageModPathTuple> >(modsForThisApp.Length);

            foreach (var enabledModId in enabledModIds)
            {
                if (modDictionary.ContainsKey(enabledModId))
                {
                    totalModList.Add(MakeSaveSubscribedGenericTuple(true, modDictionary[enabledModId]));
                }
            }

            // Add disabled mods.
            var enabledModIdSet = applicationTuple.Config.EnabledMods.ToHashSet();
            var disabledMods    = modsForThisApp.Where(x => !enabledModIdSet.Contains(x.ModConfig.ModId));

            totalModList.AddRange(disabledMods.Select(x => MakeSaveSubscribedGenericTuple(false, x)));
            return(totalModList);
        }