Exemplo n.º 1
0
        public void LoadApps()
        {
            Apps.Clear();
            _pACs = IntPtr.Zero;
            //Full List of Apps
            _AppList = PI_NetworkIsolationEnumAppContainers();
            //List of Apps that have LoopUtil enabled.
            _AppListConfig = PI_NetworkIsolationGetAppContainerConfig();
            foreach (var PI_app in _AppList)
            {
                AppContainer app = new AppContainer(PI_app.appContainerName, PI_app.displayName, PI_app.workingDirectory, PI_app.appContainerSid);

                var app_capabilities = LoopbackEnabler.getCapabilites(PI_app.capabilities);
                if (app_capabilities.Count > 0)
                {
                    //var sid = new SecurityIdentifier(app_capabilities[0], 0);

                    IntPtr arrayValue = IntPtr.Zero;
                    //var b = LoopUtil.ConvertStringSidToSid(app_capabilities[0].Sid, out arrayValue);
                    //string mysid;
                    //var b = LoopUtil.ConvertSidToStringSid(app_capabilities[0].Sid, out mysid);
                }
                app.LoopUtil = CheckLoopback(PI_app.appContainerSid);
                Apps.Add(app);
            }
        }
Exemplo n.º 2
0
        public static void Main()
        {
            if (!Mutex.TryOpenExisting(MutexName, out Mutex mutex))
            {
                mutex = new Mutex(false, MutexName);

                var loopbackEnabler = new LoopbackEnabler();
                loopbackEnabler.EnableForApp(Package.Current.DisplayName);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                string baseAddress = "http://localhost:9000/";

                using (WebApp.Start <Startup>(url: baseAddress))
                {
                    Application.Run(new SystemTrayApplicationContext());
                }
                mutex.Close();
            }
        }
Exemplo n.º 3
0
        public static void Main()
        {
            if (!Mutex.TryOpenExisting(MutexName, out Mutex mutex))
            {
                mutex = new Mutex(false, MutexName);

                var loopbackEnabler = new LoopbackEnabler();
                loopbackEnabler.EnableForApp(Package.Current.DisplayName);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                var containerBuilder = new ContainerBuilder();

                containerBuilder.RegisterType <UpdateService>().SingleInstance();
                containerBuilder.RegisterType <NotificationService>().SingleInstance();
                containerBuilder.RegisterType <TerminalsManager>().SingleInstance();
                containerBuilder.RegisterType <ToggleWindowService>().SingleInstance();
                containerBuilder.RegisterType <HotKeyManager>().SingleInstance();
                containerBuilder.RegisterType <SystemTrayApplicationContext>().SingleInstance();
                containerBuilder.RegisterType <AppCommunicationService>().SingleInstance();
                containerBuilder.RegisterInstance(Dispatcher.CurrentDispatcher).SingleInstance();

                var container = containerBuilder.Build();

                var appCommunicationService = container.Resolve <AppCommunicationService>();
                appCommunicationService.StartAppServiceConnection();
                Task.Run(() => CheckForNewVersion(container.Resolve <UpdateService>(), container.Resolve <NotificationService>()));

                Application.Run(container.Resolve <SystemTrayApplicationContext>());

                mutex.Close();
            }
            else
            {
                var eventWaitHandle = EventWaitHandle.OpenExisting(AppCommunicationService.EventWaitHandleName, System.Security.AccessControl.EventWaitHandleRights.Modify);
                eventWaitHandle.Set();
            }
        }