public override void Close() { try { if (SessionCore.Settings.Debug) { DebugNote.Hide(); DebugNote.AliveTime = 0; DebugNote = null; } } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.Close().DebugClose", Scrap); } try { HUDModule.Close(); PersistenceModule.Close(); TermModule.Close(); GridInventoryModule.RemoveWatcher(Tool); } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.Close()", Scrap); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddAutoMapper(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Version = "v1", Title = "My API", Description = "My ASP.NET Core Web API Demo", TermsOfService = "None", Contact = new Contact { Name = "Benjamin Bagley", Email = "*****@*****.**" } }); }); PersistenceModule.Configure(services); ServicesModule.Configure(services); Mapper.Initialize(x => { x.AddProfile(new WebMappingProfile()); x.AddProfile(new PersistenceMappingProfile()); }); }
public void ConfigureContainer(ContainerBuilder builder) { builder.RegisterModule(new ConfigurationModule(Configuration)); var persistenceModule = new PersistenceModule(); builder.RegisterModule(persistenceModule); }
public override void UpdateOnceBeforeFrame() { try { if (RadarBlock.CubeGrid.Physics == null) { NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME; return; } if (!Networker.Inited) { Networker.Init(907384096); } if (!Controls.InitedRadarControls) { Controls.InitRadarControls(); } NeedsUpdate |= MyEntityUpdateEnum.EACH_10TH_FRAME; GetMaxPower(); Term = RadarBlock.CubeGrid.GetTerminalSystem(); RadarPower = new AutoSet <float>(RadarBlock, "Power", 1000, x => x >= 0 && x <= MaxPower); ShowMarkers = new AutoSet <bool>(RadarBlock, "ShowMarkers", true, null); ShowRoids = new AutoSet <bool>(RadarBlock, "ShowRoids", true, null); ActiveRadar = new AutoSet <bool>(RadarBlock, "Active", false, null); ShowOnlyHostiles = new AutoSet <bool>(RadarBlock, "OnlyHostiles", true, null); ShowFloating = new AutoSet <bool>(RadarBlock, "Floating", false, null); ShowWorkingGridsOnly = new AutoSet <bool>(RadarBlock, "ShowWorkingGridsOnly", false, null); PowerModule.InitResourceSink(); PersistenceModule.Load(); RadarBlock.AppendingCustomInfo += RadarBlock_AppendingCustomInfo; RadarBlock.OnMarkForClose += OnMarkForClose; Debug.Write($"Added radar {RadarBlock.EntityId}"); if (RadarCore.Debug) { TestNote = MyAPIGateway.Utilities.CreateNotification($"{RadarBlock.CustomName}: enabled;", int.MaxValue, "Green"); } if (RadarCore.Debug) { TestNote.Show(); } RadarCore.DebugWrite("Testing", "TESTING", true); //MyRadarGrid = RadarBlock.CubeGrid.Components.Get<RadarableGrid>(); if (MyRadarGrid == null) { throw new Exception($"{RadarBlock.CustomName}.MyRadarGrid is null!"); } } catch { } }
public static void Configure(Container container) { PersistenceModule.Configure(container); container.Register <IValidator <Employee>, EmployeeValidator>(); container.Register <IValidator <User>, UserValidator>(); container.Register <IManager <Employee>, Manager <Employee> >(); container.Register <IManager <User>, Manager <User> >(); container.Register <IEntityOperationValidator <Employee>, EntityOperationEntityOperationValidator <Employee> >(); container.Register <IEntityOperationValidator <User>, EntityOperationEntityOperationValidator <User> >(); //Assembly[] validationSupportAssemblies = new[] { typeof(EntityOperationEntityOperationValidator<>).Assembly }; //container.Register(typeof(IEntityOperationValidator<>), validationSupportAssemblies); //Assembly[] managerAssemblies = new[] { typeof(Manager<Employee>).Assembly }; //container.Register(typeof(IManager<>), managerAssemblies); }
public override void UpdateOnceBeforeFrame() { try { if (!Networker.Inited) { Networker.Init(SessionCore.ModID); } try { if (Tool.CubeGrid.Physics?.Enabled != true) { NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME; return; } } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.OnceBeforeFrame().PhysicsCheck", Scrap); } try { ToolCargo = Tool.GetInventory(); } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.OnceBeforeFrame().GetInventory", Scrap); } try { TermModule.Init(); } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.OnceBeforeFrame().TermModuleInit", Scrap); } try { PersistenceModule.Init(); } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.OnceBeforeFrame().PersistenceModuleInit", Scrap); } try { PersistenceModule.Load(); } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.OnceBeforeFrame().PersistenceModuleLoad", Scrap); } try { GridInventoryModule = ToolGrid.GetComponent <GridInventories>(); if (IsWelder) { GridInventoryModule.AddWatcher(Tool); } } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.OnceBeforeFrame().InventoryModule", Scrap); } try { HUDModule.Init(); } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.OnceBeforeFrame().HudModule", Scrap); } if (IsWelder && MyAPIGateway.Session.LocalHumanPlayer?.IdentityId == Tool.OwnerId) { MissingHUD = MyAPIGateway.Utilities.CreateNotification("", int.MaxValue, "Red"); } CheckInitControls(); NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.EACH_100TH_FRAME; Tool.AppendingCustomInfo += Tool_AppendingCustomInfo; DebugNote = MyAPIGateway.Utilities.CreateNotification($"{Tool.CustomName}", int.MaxValue, (IsWelder ? "Blue" : "Red")); Owner = MyAPIGateway.Players.GetPlayer(Tool.OwnerId); if (SessionCore.Settings.Debug) { DebugNote.Show(); } } catch (Exception Scrap) { SessionCore.LogError($"{Tool.CustomName}.OnceBeforeFrame()", Scrap); } }