Example #1
0
        public void AddMod(string name, string sourceURL)
        {
            Mod    mod  = ModsManager.ModWithName(name);
            var    item = Mods.FirstOrDefault(i => i.Mod.Equals(mod));
            Source source;

            if (SourcesManager.TryBuildModSource(sourceURL, out source))
            {
                if (mod == null)
                {
                    mod = new Mod()
                    {
                        Name = name
                    };
                    item = new ModItemViewModel(mod, this);
                    AddModCommand.Execute(item);
                }
                SelectedMod  = item;
                mod.Language = source.Language;

                var srcItem = Mods.SelectMany(i => i.Sources).FirstOrDefault(s => s.Source.HasValidURL && s.Source.URL == sourceURL);
                if (srcItem == null)
                {
                    AddSourceCommand.Execute(new SourceItemViewModel(source, mod, this));
                }
                SelectedSource = srcItem;
            }
        }
Example #2
0
        public void AddModSource(string sourceURL)
        {
            Source source;

            if (SourcesManager.TryBuildModSource(sourceURL, out source) && SelectedMod != null)
            {
                AddSourceCommand.Execute(new SourceItemViewModel(source, SelectedMod.Mod, this));
            }
        }