/// <summary> /// Shutdown the session by killing any remaining processes. /// </summary> /// <returns></returns> public void Shutdown() { // Kill any remaining client processes if (ClientApps != null) { List <IAppInstance> RunningApps = ClientApps.Where(App => App.HasExited == false).ToList(); if (RunningApps.Count > 0) { Log.Info("Shutting down {0} clients", RunningApps.Count); RunningApps.ForEach(App => App.Kill()); } } if (ServerApp != null) { if (ServerApp.HasExited == false) { Log.Info("Shutting down server"); ServerApp.Kill(); } } // kill anything that's left RunningRoles.Where(R => R.AppInstance.HasExited == false).ToList().ForEach(R => R.AppInstance.Kill()); // Wait for it all to end RunningRoles.ToList().ForEach(R => R.AppInstance.WaitForExit()); Thread.Sleep(3000); }
public IEnumerable <SimpleScreen> PostScreenList([FromHeader] string AppCode, [FromHeader] string CompanyCode, [FromHeader] string DeviceSyncDate) { List <SimpleScreen> ListOfScreens = new List <SimpleScreen>(); CreatorEntities db = new CreatorEntities(); Clients client = db.Clients.Single(c => c.Code == CompanyCode); ClientApps clientapp = client.ClientApps.Single(ca => ca.Apps.AppCode == AppCode); ListOfScreens = clientapp.ClientScreens.Where(app => app.ClientApps.Apps.AppCode == AppCode) .Select(itm => new SimpleScreen { ID = itm.ID, Design = itm.Design, FontFamily = itm.InstalledFonts.Name, FontRed = itm.Colours.FontRed.ToString(), FontGreen = itm.Colours.FontGreen.ToString(), FontBlue = itm.Colours.FontBlue.ToString(), LineRed = itm.Colours.LineRed.ToString(), LineGreen = itm.Colours.LineGreen.ToString(), LineBlue = itm.Colours.LineBlue.ToString(), BackgroundRed = itm.Colours.BackgroundRed.ToString(), BackgroudGreen = itm.Colours.BackgroundGreen.ToString(), BackgroundBlue = itm.Colours.BackgroundBlue.ToString(), Description = itm.Description }) .ToList(); return(ListOfScreens); }
public void OnAuthorization(AuthorizationFilterContext context) { if (!context.HttpContext.User.Identity.IsAuthenticated) { context.Result = new UnauthorizedResult(); } else { string[] clientApps = default(string[]); string[] roles = default(string[]); if (!string.IsNullOrEmpty(ClientApps) && !string.IsNullOrWhiteSpace(ClientApps)) { clientApps = ClientApps.Trim().Split().ToArray(); string clientAppClaim = context.HttpContext.User.Claims.Where(c => c.Type.Equals("clientApp")).FirstOrDefault().Value; if (!clientApps.Contains(clientAppClaim)) { context.Result = new CustomHttpErrorResult(HttpStatusCode.Forbidden); } } } }