示例#1
0
        public void ApplyFilter(string search, bool isJP, ToolTipEx tooltip)
        {
            this.LastSearchWord = search;
            if (search == "" || this.PatchButton.Visible)
            {
                this.PatchLabelName.Hide();
                for (int i = 0; i < Buttons.Length; i++)
                {
                    this.Buttons[i].Hide();
                }
                return;
            }
            if (Patchs == null)
            {
                Patchs = PatchForm.ScanPatch();
            }

            int foundCount = 0;

            for (int i = 0; i < this.Patchs.Length; i++)
            {
                PatchForm.PatchSt patch = this.Patchs[i];
                if (!U.StrStrEx(patch.SearchData, search, isJP))
                {//フィルターで消す.
                    continue;
                }
                Button b = Buttons[foundCount];
                b.Text = patch.Name;
                string info = U.at(patch.Param, "INFO");
                tooltip.SetToolTipOverraide(b, U.nl2br(info));
                b.Show();

                foundCount++;
                if (foundCount == 1)
                {//ボタンがあるならラベルも出す.
                    this.PatchLabelName.Show();
                }

                if (foundCount >= Buttons.Length)
                {
                    return;
                }
            }

            for (int n = foundCount; n < Buttons.Length; n++)
            {
                Button b = Buttons[n];
                b.Hide();
            }
        }