Example #1
0
 public void AddItem(ProfileItem toAdd)
 {
     if (!Items.Any(p => p.ModID == toAdd.ModID))
     {
         Items.Add(toAdd);
     }
 }
Example #2
0
 internal void Init(_7thWrapperLib.ModInfo info, Func <string, System.Drawing.Bitmap> imageReader, Func <string, System.IO.Stream> audioReader, ProfileItem profile, IEnumerable <fLibrary.Constraint> constraints, string iroPath)
 {
     _iroPath     = iroPath;
     _info        = info;
     _imageReader = imageReader;
     _audioReader = audioReader;
     _constraints = constraints.ToList();
     _values      = profile.Settings.ToDictionary(s => s.ID, s => s.Value, StringComparer.InvariantCultureIgnoreCase);
     lbOptions.Items.AddRange(info.Options.ToArray());
     lbOptions.SelectedIndex = 0;
 }
        internal void Init(ModInfo info, Func <string, string> imageReader, Func <string, Stream> audioReader, Iros._7th.Workshop.ProfileItem activeModInfo, List <Constraint> modConstraints, string pathToModFolderOrIro)
        {
            _iroPath     = pathToModFolderOrIro;
            _info        = info;
            _imageReader = imageReader;
            _audioReader = audioReader;
            _constraints = modConstraints;
            _values      = activeModInfo.Settings.ToDictionary(s => s.ID, s => s.Value, StringComparer.InvariantCultureIgnoreCase);

            if (info.Options.Any(c => c.Name.StartsWith("===")))
            {
                // use tree view style to display options
                TreeViewVisibility   = Visibility.Visible;
                OptionListVisibility = Visibility.Collapsed;

                List <ConfigOptionViewModel> treeOptions = new List <ConfigOptionViewModel>();

                for (int i = 0; i < info.Options.Count; i++)
                {
                    if (info.Options[i].Name.StartsWith("==="))
                    {
                        ConfigOptionViewModel parent = new ConfigOptionViewModel(info.Options[i]);
                        for (int j = i + 1; j < info.Options.Count; j++)
                        {
                            if (info.Options[j].Name.StartsWith("==="))
                            {
                                i = j - 1; // subtract 1 since the next for loop will increment by one
                                break;
                            }

                            ConfigOptionViewModel child = new ConfigOptionViewModel(info.Options[j]);
                            parent.Children.Add(child);
                        }

                        treeOptions.Add(parent);
                    }
                }

                ModOptions = treeOptions;
            }
            else
            {
                ModOptions.AddRange(info.Options.Select(o => new ConfigOptionViewModel(o)).ToList());
            }

            WindowTitle = $"{ResourceHelper.Get(StringKey.ConfigureMod)} - {Sys.Library.GetItem(activeModInfo.ModID)?.CachedDetails.Name}";

            SelectedOption = ModOptions.Count > 0 ? ModOptions[0] : null;
        }