static void Main(string[] args) { IContainer container = new Container(); ContainerInitiazer.Initialize(container); string map_file = "/home/gvso/Desktop/WEMSimUnity/Unity/Assets/Scripts/Example/Config/example.map.yml"; MapInitializer map_initializer = (MapInitializer)container.Get("map.initializer"); map_initializer.Initialize(map_file); //Map map = (Map) container.Get("map"); //Console.Write(map); List <string> agenda_files = new List <string> (); agenda_files.Add("/home/gvso/Desktop/WEMSimUnity/Unity/Assets/Scripts/Example/Config/Agendas/example.agenda.yml"); agenda_files.Add("/home/gvso/Desktop/WEMSimUnity/Unity/Assets/Scripts/Example/Config/Agendas/example2.agenda.yml"); AgendaInitializer agenda_initializer = (AgendaInitializer)container.Get("agenda.initializer"); agenda_initializer.Initialize(agenda_files); AgendaContainer agenda_container = (AgendaContainer)container.Get("agenda.container"); Console.WriteLine(agenda_container.Get("example.agenda")); /*Console.WriteLine(agenda_container.Get("example2.agenda"));*/ }
public override void Initialize() { _map = gameObject.AddComponent <MapInitializer> (); _map.Initialize(_mapPrefab, TerraMysticaParameters._mapPath); _map.LoadMap(); InitializeCamera(); }
public override void Initialize() { TerraMysticaParameters.Initialize(); Debug.Log("--- Path: " + TerraMysticaParameters._mapPath); _map = gameObject.AddComponent <MapInitializer> (); _map.Initialize(_mapPrefab, TerraMysticaParameters._mapPath); _map.LoadMap(); }
public void Initialize_Test() { // Create the object to test. MapInitializer mapInitializer = new MapInitializer(); // Setup some simple training data. IList <Vector> trainingData = new List <Vector> { new Vector { 1, 3 }, new Vector { 2, 4 }, new Vector { 5, 3 } }; // Determine the min and max based on the training data. double min = trainingData.Min(vector => vector.Min()); double max = trainingData.Max(vector => vector.Max()); // Determine the depth of the map based on the training data. int depth = trainingData.First().Count; // Setup a map to initialize. Map map = new Map(width: 2, height: 2, depth: depth); // Execute the code to test. mapInitializer.Initialize(map, trainingData); // Verify that the map is filled with MapNodes with correct data. for (int x = 0; x < map.Width; x++) { for (int y = 0; y < map.Height; y++) { MapNode mapNode = map[x, y]; Assert.IsNotNull(mapNode, "MapNode"); Assert.AreEqual(x, mapNode.X, "MapNode.X"); Assert.AreEqual(y, mapNode.Y, "MapNode.Y"); Assert.IsNotNull(mapNode.Weights, "MapNode.Weights"); Assert.AreEqual(depth, mapNode.Weights.Count, "MapNode.Weights.Count"); // Verify that the MapNodes weights are within the allowed bounds. for (int z = 0; z < depth; z++) { double weight = mapNode.Weights[z]; Assert.IsTrue(weight >= min, "Min"); Assert.IsTrue(weight <= max, "Max"); } } } }
internal static void Main(string[] args) { MapInitializer.Initialize(); using (IrcBot bot = new IrcBot(IrcConfiguration.GetConfig())) { bot.OpenConnection(); bot.Start(); } }
public void Initialize_ExceptionOnEmptyTrainingData_Test() { MapInitializer mapInitializer = new MapInitializer(); try { mapInitializer.Initialize(map: new Map(0, 0, 0), trainingData: new List <Vector>()); } catch (ArgumentException argumentException) { Assert.AreEqual( string.Format("Unable to initialize a self-organizing map without training data.{0}Parameter name: trainingData", Environment.NewLine), argumentException.Message); throw; } }
public void Initialize_ExceptionOnNullMap_Test() { MapInitializer mapInitializer = new MapInitializer(); try { mapInitializer.Initialize(map: null, trainingData: new List <Vector>()); } catch (ArgumentNullException argumentNullException) { Assert.AreEqual( string.Format("Unable to initialize a null self-organizing map.{0}Parameter name: map", Environment.NewLine), argumentNullException.Message); throw; } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var databaseConnectionString = Configuration.GetConnectionString("React_ASP.Net_Core_Boilerplate_MsSqlProvider"); services.AddCors(); services.AddDbContext <DatabaseContext>(options => options.UseSqlServer(databaseConnectionString)); services.AddMvc() .AddJsonOptions(options => { options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc; }) .AddSessionStateTempDataProvider(); // configure strongly typed settings objects var appSettingsSection = Configuration.GetSection("AppSettings"); services.Configure <AppSettings>(appSettingsSection); // configure jwt authentication services.AddDistributedMemoryCache(); var appSettings = appSettingsSection.Get <AppSettings>(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(appSettings.SessionTimeout); options.Cookie.HttpOnly = true; }); var key = Encoding.ASCII.GetBytes(appSettings.Secret); services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { options.RequireHttpsMetadata = false; options.SaveToken = true; options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(key), ValidateIssuer = false, ValidateAudience = false, ValidateLifetime = true, RequireExpirationTime = true, ClockSkew = TimeSpan.Zero }; }); services.AddAuthorization(options => { }); // configure DI for application services services.AddScoped <IUserRepository, UserRepository>(); services.AddScoped <ILogRepository, LogRepository>(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddScoped <DatabaseInitializer>(); services.AddScoped <RenderView>(); services.AddScoped <IUserService, UserService>(); // Configures the mapper inside the Services MapInitializer.Initialize(); }