private void PackagesSource_Filter(object sender, FilterEventArgs e)
        {
            var             keyword = SearchInstalledBox.Text.Trim();
            StatusParagraph status  = e.Item as StatusParagraph;

            if (string.IsNullOrEmpty(keyword))
            {
                e.Accepted = status.State == InstallState.Installed;
                return;
            }

            if (status != null)
            {
                bool contain = status.Package.Contains(keyword);
                if (!PackageNameOnlyCheckBox.IsChecked.Value)
                {
                    contain = contain || (status.Description?.Contains(keyword) ?? false);
                }
                e.Accepted = (status.State == InstallState.Installed) && contain;
            }
        }
Example #2
0
        public static List <StatusParagraph> ParseStatus(string statusFile)
        {
            var result = new List <StatusParagraph>();

            foreach (var paragraph in ParseParagraph(statusFile))
            {
                var status = new StatusParagraph();
                foreach (var item in paragraph)
                {
                    switch (item.Key)
                    {
                    case "Package": status.Package = item.Value; break;

                    case "Feature": status.Feature = item.Value; break;

                    case "Version": status.Version = item.Value; break;

                    case "Architecture": status.Architecture = item.Value; break;

                    case "Multi-Arch": status.MultiArch = item.Value; break;

                    case "Depends": status.Depends = CommaSplit(item.Value); break;

                    case "Description": status.Description = item.Value; break;

                    case "Status":
                        var strs = item.Value.Split(' ');
                        status.Want  = (Want)Enum.Parse(typeof(Want), strs[0], true);
                        status.State = InstallStateParser[strs[2]];
                        break;
                    }
                }
                result.Add(status);
            }
            return(result);
        }