Exemple #1
0
        public void TroveUriInstallModPack(string uri)
        {
            log.InfoFormat("Installing mod pack: [{0}] from Trove URI argument", uri);
            TroveModPack          pack   = new TroveModPack(uri);
            TroveModPackViewModel packVm = null;

            if (string.IsNullOrEmpty(pack.PackId))
            {
                // Install Ad Hoc mod pack
                packVm = new TroveModPackViewModel(pack);
                ModPacks.Add(packVm);
            }
            else
            {
                // Find Trovesaurus mod pack
                packVm = ModPacks.FirstOrDefault(p => p.DataObject.PackId == pack.PackId);
                if (packVm == null)
                {
                    log.ErrorFormat("Could not find Trovesaurus mod pack ID {0}", pack.PackId);
                    return;
                }
            }
            ModPacksView.MoveCurrentTo(packVm);
            LoadModPack(packVm);
        }
Exemple #2
0
 private void RemoveModPack(TroveModPackViewModel currentItem)
 {
     log.InfoFormat("Removing mod pack: {0}", currentItem.DataObject.Name);
     foreach (var mod in MyMods.Where(m => m.ModPack == currentItem))
     {
         mod.ModPack             = null;
         mod.DataObject.PackName = null;
     }
     ModPacks.Remove(currentItem);
 }
Exemple #3
0
        private void SaveModPack(string modPackName)
        {
            bool newPack = false;

            if (string.IsNullOrEmpty(modPackName))
            {
                log.Warn("No mod pack name specified to save");
                return;
            }
            log.InfoFormat("Saving enabled standalone mods as mod pack {0}", modPackName);

            TroveModPackViewModel pack = ModPacks.FirstOrDefault(p => p.DataObject.Name == modPackName && p.DataObject.Source == TroveModPack.LocalSource);

            if (pack == null)
            {
                pack = new TroveModPackViewModel(new TroveModPack());
                pack.DataObject.Name = modPackName;
                newPack = true;
            }
            else
            {
                pack.DataObject.Mods.Clear();
            }

            foreach (var mod in MyMods.Where(m => m.DataObject.Enabled && m.ModPack == null))
            {
                if (string.IsNullOrEmpty(mod.DataObject.Id))
                {
                    log.WarnFormat("Only mods downloaded from Trovesaurus can be included in mod packs, skipping mod: {0}", mod.DisplayName);
                    continue;
                }
                mod.ModPack             = pack;
                mod.DataObject.PackName = modPackName;
                pack.DataObject.Mods.Add(mod.DataObject);
            }

            if (pack.DataObject.Mods.Count > 0)
            {
                if (newPack)
                {
                    ModPacks.Add(pack);
                }
                ModPacksView.MoveCurrentTo(pack);
            }
            else
            {
                log.ErrorFormat("No enabled standalone mods from Trovesaurus were added to mod pack {0}", modPackName);
            }
        }
Exemple #4
0
 private void LoadModPack(TroveModPackViewModel currentItem)
 {
     log.InfoFormat("Loading mod pack: {0}", currentItem.DataObject.Name);
     foreach (var mod in currentItem.DataObject.Mods)
     {
         var modVm = MyMods.FirstOrDefault(m => m.DataObject.Id == mod.Id);
         if (modVm == null)
         {
             modVm = MainWindowViewModel.Instance.GetMoreMods.TrovesaurusMods.FirstOrDefault(m => m.DataObject.Id == mod.Id);
             if (modVm == null)
             {
                 modVm = new TroveModViewModel(mod);
             }
             modVm.InstallCommand.Execute(null);
         }
         modVm.ModPack             = currentItem;
         modVm.DataObject.PackName = currentItem.DisplayName;
     }
 }
Exemple #5
0
 private void CopyModPackLink(TroveModPackViewModel currentItem)
 {
     currentItem.DataObject.CopyModPackUri();
 }