private static CommandItem CreateItem(Process proc) { CommandItem app = null; if (proc.MainWindowTitle.Length > 1) { app = RunningAppItem.build(proc); } return(app); }
private static bool IsValid(RunningAppItem command) { if (command == null) { return(false); } using (var appx = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Appx")) { var packageRoot = appx.GetValue("PackageRoot"); if (command.Path.IndexOf(packageRoot.ToString()) == 0) { return(false); } } return(true); }
static public RunningAppItem build(Process proc) { RunningAppItem command = null; try { command = new RunningAppItem(proc); } catch (NullReferenceException) { // ignore } if (!IsValid(command)) { command = null; } return(command); }