Exemplo n.º 1
0
 private void ResetWindow(AdvancedWindowInformation advancedWindowInformation)
 {
     advancedWindowInformation.ViewChildWindows.Clear();
     foreach (var childProcess in advancedWindowInformation.ChildWindows)
     {
         if (OnlyShowVisibleWindows && !childProcess.IsVisible)
         {
             if (!IsAnyVisible(childProcess.ChildWindows))
             {
                 continue;
             }
         }
         advancedWindowInformation.ViewChildWindows.Add(childProcess);
         ResetWindow(childProcess);
     }
 }
Exemplo n.º 2
0
        private bool MatchSearchPattern(string searchPattern, AdvancedWindowInformation advancedWindowInformation)
        {
            if (OnlyShowVisibleWindows && !advancedWindowInformation.IsVisible)
            {
                if (!IsAnyVisible(advancedWindowInformation.ChildWindows))
                {
                    return(false);
                }
            }

            if (string.IsNullOrWhiteSpace(searchPattern))
            {
                return(true);
            }

            if (searchPattern.StartsWith("process:", StringComparison.OrdinalIgnoreCase) && searchPattern.Length > 8)
            {
                var pid = searchPattern.Substring(searchPattern.IndexOf(":", StringComparison.Ordinal) + 1);
                return(advancedWindowInformation.ProcessId.ToString() == pid);
            }

            if (advancedWindowInformation.Caption.IndexOf(searchPattern, StringComparison.OrdinalIgnoreCase) > -1)
            {
                return(true);
            }

            if (advancedWindowInformation.ClassName.IndexOf(searchPattern, StringComparison.OrdinalIgnoreCase) > -1)
            {
                return(true);
            }

            if (advancedWindowInformation.ProcessId.ToString() == searchPattern)
            {
                return(true);
            }

            return(advancedWindowInformation.ChildWindows.Any(x => MatchSearchPattern(searchPattern, x)));
        }