Exemplo n.º 1
0
        public void LoadGUITags(string[] tags)
        {
            List <string> tmp = new List <string>();

            if (tags == null)
            {
                var tagsS = ModObject.CombineTags(mod.GetModClasses());

                foreach (var tag in tagsS)
                {
                    tmp.Add(ModClass.ClassToNameMapping[tag]);
                }

                foreach (var tag in mod.GetIniTags())
                {
                    if (!tmp.Contains(tag))
                    {
                        tmp.Add(tag);
                    }
                }

                tags = tmp.ToArray();
            }

            foreach (var c in borderPanel1.Controls)
            {
                if (c is CheckBox)
                {
                    var cb = (CheckBox)c;
                    if (tags.Contains(cb.Text))
                    {
                        cb.Checked = true;
                    }
                }
                else if (c is ComboBox)
                {
                    var cb = (ComboBox)c;
                    int i  = 0;
                    foreach (var item in cb.Items)
                    {
                        if (i == 0)
                        {
                            i++;
                            continue;
                        }
                        if (tags.Contains((string)item))
                        {
                            cb.SelectedIndex = i;
                            break;
                        }
                        i++;
                    }
                }
            }
        }