private void refreshAppInfo() { if (session.appInfo != null) { return; } if (PortHostService.getInstance() != null) { ThreadProxy.getInstance().execute(new Runnable(() => { PortHostService.getInstance().refreshSessionInfo(); })); } }
public static List <NatSession> getAllSession() { if (FirewallVpnService.lastVpnStartTimeFormat == null) { return(null); } try { var file = new File(VPNConstants.CONFIG_DIR + FirewallVpnService.lastVpnStartTimeFormat); ACache aCache = ACache.get(file); string[] list = file.List(); var baseNetSessions = new List <NatSession>(); if (list != null) { foreach (var fileName in list) { baseNetSessions.Add(aCache.getAsObject(fileName) as NatSession); } } var portHostService = PortHostService.getInstance(); if (portHostService != null) { var aliveConnInfo = portHostService.getAndRefreshSessionInfo(); if (aliveConnInfo != null) { baseNetSessions.AddRange(aliveConnInfo); } } baseNetSessions.Sort(new NatSession.NatSesionComparator()); return(baseNetSessions); } catch (Exception) { return(null); } }