Beispiel #1
0
        public PythonScriptHostService(ScriptingSettingsModel scriptingSettings, PythonIOStream pythonIOStream, ILogger <PythonScriptHostService> logger)
        {
            _scriptingSettings = scriptingSettings ?? throw new ArgumentNullException(nameof(scriptingSettings));
            _logger            = logger ?? throw new ArgumentNullException(nameof(logger));

            _scriptEngine = IronPython.Hosting.Python.CreateEngine();
            _scriptEngine.Runtime.IO.SetOutput(pythonIOStream, Encoding.UTF8);

            _scriptsPath = PathHelper.ExpandPath(scriptingSettings.ScriptsPath);
        }
Beispiel #2
0
        void ReadMqttSettings(IServiceCollection services)
        {
            var mqttSettings = new MqttSettingsModel();

            Configuration.Bind("MQTT", mqttSettings);
            services.AddSingleton(mqttSettings);

            var scriptingSettings = new ScriptingSettingsModel();

            Configuration.Bind("Scripting", scriptingSettings);
            services.AddSingleton(scriptingSettings);
        }