/*public void Dispose() * { * * }*/ public void Run() { Console.WriteLine("Entered Engine::Run"); mDispatcher = Dispatcher.CurrentDispatcher; Console.WriteLine("Initializing program list..."); programs = new ProgramList(); if (!UwpFunc.IsWindows7OrLower) { Console.WriteLine("Initializing app manager..."); appMgr = new AppManager(); } Console.WriteLine("Initializing firewall..."); firewall = new Firewall(); Console.WriteLine("Loading program list..."); programs.LoadList(); Console.WriteLine("Loading firewall rules..."); firewall.LoadRules(true); Console.WriteLine("Loading connection log..."); if (App.GetConfigInt("Startup", "LoadLog", 1) != 0) { firewall.LoadLogAsync(); } firewall.WatchConnections(); Console.WriteLine("Setting up IPC host..."); App.host = new PipeHost(); App.host.Listen(); mStarted.Set(); Console.WriteLine("Starting engine timer..."); mTimer.Tick += new EventHandler(OnTimer_Tick); mTimer.Interval = new TimeSpan(0, 0, 0, 0, 10 * 1000); // every 10 seconds mTimer.Start(); Dispatcher.Run(); mTimer.Stop(); firewall.WatchConnections(false); Console.WriteLine("Saving program list..."); programs.StoreList(); Console.WriteLine("Shuttin down IPC host..."); App.host.Close(); //mFinished.Set(); }
private ProgramList.ID GetIDforEntry(string path, int processId) { ProgramList.Types type = ProgramList.Types.Global; string name = null; if (path.Equals("System", StringComparison.OrdinalIgnoreCase)) { type = ProgramList.Types.System; } else { path = MiscFunc.parsePath(path); if (path.Length == 0) // fallback { path = ProgramList.GetProcessPathById(processId); if (path == null) { return(null); } } //if (Path.GetFileName(path).Equals("svchost.exe", StringComparison.OrdinalIgnoreCase)) List <ServiceHelper.ServiceInfo> Services = ServiceHelper.GetServicesByPID(processId); if (Services != null) { type = ProgramList.Types.Service; if (Services.Count > 1) { // ToDo: handle teh case Services.length > 1 !!!! Console.WriteLine("Non unique service " + Services.Count); } name = Services[0].ServiceName; } else { name = App.engine.appMgr != null?App.engine.appMgr.GetAppPackage(path) : null; if (name != null) { type = ProgramList.Types.App; } else { type = ProgramList.Types.Program; } } } ProgramList.ID id = new ProgramList.ID(type, path, name); id.MakeDisplayName(); return(id); }