// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await context.Response.WriteAsync("Hello World!"); }); }); JsonConfig.Regist <TestConfig>(); var tc = JsonConfig.Get <TestConfig>(); tc.Changed += (sender, e) => { //DebriteLine("Changed"); Console.WriteLine($"changed...{e.NewJson}"); Console.WriteLine($"{tc.Datas.FirstOrDefault()?.ID}"); }; }
public UnitTest1() { //JsonConfig.Init(); JsonConfig.Regist <TestConfig>(); var tc = JsonConfig.Get <TestConfig>(); tc.Changed += (sender, e) => { //DebriteLine("Changed"); Debug.WriteLine($"changed...{e.NewJson}"); }; }
public void TestMethod1() { var tc = JsonConfig.Get <TestConfig>(); var datas = tc.Datas; tc.Datas = new List <TestConfig.Test>() { new TestConfig.Test() { ID = 0, Name = "Xling", CreateOn = DateTime.Now } }; JsonConfig.Save(tc); }
void Run() { #region init ILoggerFactory fac = new NLoggerFactory(); logger = fac.GetLogger(this.GetType()); ExitCatcher catcher = new ExitCatcher(); catcher.Subscribe(() => { logger.Info("Daemon back to limbo\n"); }); logger.Info("Daemon wakes up"); IConfig config = new JsonConfig(fac); config.Load(Properties.Settings.Default.LOCALES); #endregion #region registeration logger.Info("Daemon assembles"); Container container = new Container(); container.Register<ILoggerFactory, NLoggerFactory>(); container.Register<IEar>(() => {return new ConsoleEar(fac, config.Get<float>("minaccuracy"));}); container.Register<IMouth, SimpleMouth>(); container.Register<INerve>(() => { return new DebugNerve(fac, config.Get<string>("server")); }); container.Register<ICortex, SimpleCortex>(); container.Register<ISimulacre, Simulacre>(); #endregion #region startup logger.Info("Daemon summons Charlie\n"); Personae charlie = new Personae { Name = "Charlie", Grammar = "charlieGrammar.xml", Voice = "Microsoft Hortense Desktop" }; container.GetInstance<ISimulacre>().Summon(charlie); #endregion }