Пример #1
0
        public TemplateManager(RegisterStore store, IPluginInterface pluginInterface, string templatePath)
        {
            this.TemplatePath    = templatePath;
            this.store           = store;
            this.pluginInterface = pluginInterface;

            enabledTemplates = pluginInterface.Settings.Get("tmpl.enabled", "").Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList();
        }
Пример #2
0
        public async Task <IActionResult> Register([FromForm] RegisterStore register)
        {
            try
            {
                await Mediator.Send(register);

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequestWithMessage(e.Message));
            }
        }
Пример #3
0
        public void RegisterStoreTests()
        {
            using (var registry = new RegisterStore())
            {
                var test11  = new Test11();
                var test112 = new Test11();
                var test12  = new Test12();
                var test21  = new Test21();
                registry.Register <ITest1>(test11);
                registry.Register <ITest1>(test12);
                registry.Register <ITest1>(test112);
                registry.Register <ITest2>(test21);

                Assert.IsTrue(registry.GetRegistered <ITest1>().SequenceEqual(new ITest1[] { test11, test12, test112 }));
                Assert.IsTrue(registry.GetRegistered <ITest2>().SequenceEqual(new ITest2[] { test21 }));
            }
        }
Пример #4
0
        public TemplateManager(RegisterStore store, ILog logger, ISettings settings)
        {
            this.store    = store;
            this.logger   = logger;
            this.settings = settings;

            try
            {
                if (Directory.Exists(TemplateCompiler.CompilerTemp))
                {
                    Directory.Delete(TemplateCompiler.CompilerTemp, true);
                }
                Directory.CreateDirectory(TemplateCompiler.CompilerTemp);
            }
            catch { }

            enabledTemplates = settings.Get("tmpl.enabled", "").Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList();
        }
Пример #5
0
 public static Task RegisterStore(this IFlurlClient http, RegisterStore model)
 {
     return(http.Request("api", "store", "register")
            .PostUrlEncodedAsync(model));
 }
Пример #6
0
 public DummyPluginInterface()
 {
     Logger   = new TestLogger();
     Settings = new TestSettings(new Dictionary <string, string>());
     Registry = new RegisterStore();
 }