private void TranslateCommandHandler(object parameter) { IMetadataService metadata = Services.GetService <IMetadataService>(); metadata.AttachDatabase(string.IsNullOrWhiteSpace(MyServer.Address) ? MyServer.Name : MyServer.Address, MyDatabase); IScriptingService scripting = Services.GetService <IScriptingService>(); string sql = scripting.PrepareScript(ScriptCode, out IList <ParseError> errors); string errorMessage = string.Empty; foreach (ParseError error in errors) { errorMessage += error.Message + Environment.NewLine; } MainWindowViewModel mainWindow = Services.GetService <MainWindowViewModel>(); ScriptEditorViewModel scriptEditor = Services.GetService <ScriptEditorViewModel>(); if (errors.Count > 0) { scriptEditor.Name = "Errors"; scriptEditor.ScriptCode = errorMessage; } else { scriptEditor.Name = $"{Name} (SQL)"; scriptEditor.ScriptCode = sql; } ScriptEditorView scriptView = new ScriptEditorView() { DataContext = scriptEditor }; mainWindow.AddNewTab(scriptEditor.Name, scriptView); }
private void SaveScriptSourceCode() { IScriptingService scripting = Services.GetService <IScriptingService>(); TSqlFragment syntaxTree = scripting.ParseScript(ScriptCode, out IList <ParseError> errors); if (errors.Count > 0) { ShowParseErrors(errors); throw new InvalidOperationException("Saving script failed: incorrect syntax."); } ScriptingController controller = Services.GetService <ScriptingController>(); string catalogName = controller.GetScriptsCatalogName(MyServer, MyDatabase, ScriptType); if (controller.ScriptFileExists(catalogName, Name)) { controller.SaveScriptFile(catalogName, Name, ScriptCode); } else { if (controller.GetScriptTreeNodeByName(MyServer, MyDatabase, ScriptType, Name) != null) { throw new InvalidOperationException($"Script node \"{Name}\" already exists!"); } controller.SaveScriptFile(catalogName, Name, ScriptCode); } MainWindowViewModel mainWindow = Services.GetService <MainWindowViewModel>(); TreeNodeViewModel treeNode = mainWindow.GetTreeNodeByPayload(mainWindow.MainTreeRegion.TreeNodes, this); if (treeNode == null) { controller.CreateScriptTreeNode(this); } }
public TelegramBotService( ISettingsService settingsService, IPersonalAgentService personalAgentService, ISystemInformationService systemInformationService, ILogService logService, IScriptingService scriptingService) { if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _personalAgentService = personalAgentService ?? throw new ArgumentNullException(nameof(personalAgentService)); _log = logService.CreatePublisher(nameof(TelegramBotService)); settingsService.CreateSettingsMonitor <TelegramBotServiceSettings>(s => Settings = s.NewSettings); systemInformationService.Set("TelegramBotService/IsConnected", () => _isConnected); scriptingService.RegisterScriptProxy(s => new TelegramBotScriptProxy(this)); }
public QueryEditorViewModel(IShell shell, WebServerSettings settigns, string fileFullPath, IMetadataService metadata, IScriptingService scripting) { if (shell == null) { throw new ArgumentNullException(nameof(shell)); } if (settigns == null) { throw new ArgumentNullException(nameof(settigns)); } if (scripting == null) { throw new ArgumentNullException(nameof(scripting)); } if (string.IsNullOrWhiteSpace(fileFullPath)) { throw new ArgumentNullException(nameof(fileFullPath)); } Shell = shell; Settings = settigns; Metadata = metadata; Scripting = scripting; FileFullPath = fileFullPath; ExecuteCommand = new RelayCommand(Execute); TranslateCommand = new RelayCommand(Translate); }
public ComponentRegistryService( ISystemInformationService systemInformationService, IApiDispatcherService apiService, ISettingsService settingsService, IScriptingService scriptingService, ILogService logService) { if (systemInformationService == null) { throw new ArgumentNullException(nameof(systemInformationService)); } if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _log = logService.CreatePublisher(nameof(ComponentRegistryService)); _apiService = apiService ?? throw new ArgumentNullException(nameof(apiService)); _settingsService = settingsService ?? throw new ArgumentNullException(nameof(settingsService)); apiService.StatusRequested += HandleApiStatusRequest; systemInformationService.Set("Components/Count", () => _components.Count); scriptingService.RegisterScriptProxy(s => new ComponentRegistryScriptProxy(this, s)); }
public AreaRegistryService( IComponentRegistryService componentService, IAutomationRegistryService automationService, ISystemInformationService systemInformationService, IApiDispatcherService apiService, ISettingsService settingsService, IScriptingService scriptingService) { if (systemInformationService == null) { throw new ArgumentNullException(nameof(systemInformationService)); } if (apiService == null) { throw new ArgumentNullException(nameof(apiService)); } if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _componentService = componentService ?? throw new ArgumentNullException(nameof(componentService)); _automationService = automationService ?? throw new ArgumentNullException(nameof(automationService)); _settingsService = settingsService ?? throw new ArgumentNullException(nameof(settingsService)); apiService.ConfigurationRequested += HandleApiConfigurationRequest; systemInformationService.Set("Areas/Count", () => _areas.Count); scriptingService.RegisterScriptProxy(s => new AreaRegistryScriptProxy(this)); }
/// <summary> /// Initializes a new instance of the <see cref="ScriptingToolViewModel"/> class. /// </summary> /// <param name="fileDiscoveryService">The file discovery service.</param> /// <param name="scriptingService">The scripting service.</param> public ScriptingToolViewModel(IFileDiscoveryService fileDiscoveryService, IScriptingService scriptingService) { this.fileDiscoveryService = fileDiscoveryService; this.scriptingService = scriptingService; this.FoundScripts = new BindingList <ScriptViewModel>(); }
public Simulator(ILogger <Simulator> log, ITcmsService tcms, IScriptingService scriptRepository) { this.log = log; Scripting = scriptRepository; Tcms = tcms; tick = 0; }
private void ExecuteAdministrativeScript(DatabaseServer server, string scriptUri) { Uri uri = new Uri(scriptUri); StreamResourceInfo resource = Application.GetResourceStream(uri); string sql = string.Empty; using (StreamReader reader = new StreamReader(resource.Stream)) { sql = reader.ReadToEnd(); } if (scriptUri == CREATE_PUBLIC_ENDPOINT_SCRIPT && server.ServiceBrokerPortNumber != 4022) { sql = sql.Replace("LISTENER_PORT = 4022", "LISTENER_PORT = " + server.ServiceBrokerPortNumber.ToString()); } IMetadataService metadata = Services.GetService <IMetadataService>(); metadata.Configure(server, null); IScriptingService scripting = Services.GetService <IScriptingService>(); scripting.ExecuteBatch(sql, out IList <ParseError> errors); if (errors.Count > 0) { throw new InvalidOperationException(ExceptionHelper.GetParseErrorsText(errors)); } }
/// <summary> /// Executes the program with the specified path parameter. /// </summary> /// <param name="pathParam">The path parameter.</param> private static void Execute(string pathParam) { string specifiedPath; if (pathParam == null) { Console.WriteLine(Consts.AssumingCurrentPathMessage); specifiedPath = "."; } else { string[] pathParamSplit = pathParam.Split(Consts.ParamValueSeparator); if (pathParam == null || pathParamSplit.Length != 2) { Console.WriteLine(Consts.UsageMessage); return; } if (!string.Equals(pathParamSplit[0], Consts.PathParamName, StringComparison.InvariantCultureIgnoreCase)) { Console.WriteLine(Consts.UsageMessage); return; } specifiedPath = pathParamSplit[1]; } ConsoleBootrapper consoleBootstrapper = new ConsoleBootrapper(); consoleBootstrapper.Bootstrap(); IDependencyInjectionContainer dependencyInjectionContainer = consoleBootstrapper.DependencyInjectionContainer; PathResolver pathResolver = new PathResolver(); string resolvedPath = pathResolver.ResolvePath(specifiedPath); IFileDiscoveryService filePathDiscoveryService = dependencyInjectionContainer.Resolve <IFileDiscoveryService>(); IEnumerable <FileDiscoveryInfo> scriptFiles = filePathDiscoveryService.DiscoverFiles(resolvedPath); IScriptingService scriptingService = dependencyInjectionContainer.Resolve <IScriptingService>(); foreach (var scriptFile in scriptFiles) { ConsoleKeyInfo consoleKeyInfo = new ConsoleKeyInfo(); while (!Program.ValidKey(consoleKeyInfo)) { Console.Write($"Run script '{ scriptFile.FileName }'? (y/n) "); consoleKeyInfo = Console.ReadKey(); Console.WriteLine(); } if (consoleKeyInfo.Key == ConsoleKey.Y) { scriptingService.ExecuteScriptAsync(scriptFile).Wait(); } } }
public GadgetService(IConfiguration config, IDatabase database, IGadgetActionService gadgetActionService, IServiceProvider services, IScriptingService scriptingService) { _config = config; _database = database; _gadgetActionService = gadgetActionService; _services = services; _scriptingService = scriptingService; }
public MainViewModel() { _appContainer = new AppContainer(); _scriptingService = _appContainer.ScriptingService; _scriptingService.DebugPrint += _scriptingService_DebugPrint; _commandText = string.Empty; _outputText = string.Empty; _runCommand = new DelegateCommand(OnRunCommand); }
public DateTimeService(IScriptingService scriptingService) { if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } scriptingService.RegisterScriptProxy(s => new DateTimeScriptProxy(this)); }
public SystemInformationService(IScriptingService scriptingService) { if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } scriptingService.RegisterScriptProxy(s => new SystemInformationScriptProxy(this)); }
public MessageBrokerService(ILogService logService, IScriptingService scriptingService) { if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _log = logService?.CreatePublisher(nameof(MessageBrokerService)) ?? throw new ArgumentNullException(nameof(logService)); scriptingService.RegisterScriptProxy(s => new MessageBrokerScriptProxy(this, s)); }
public I2CBusService(ILogService logService, IScriptingService scriptingService) { if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _log = logService?.CreatePublisher(nameof(I2CBusService)) ?? throw new ArgumentNullException(nameof(logService)); _busId = GetBusId(); scriptingService.RegisterScriptProxy(s => new I2CBusScriptProxy(this)); }
void Initialize([Inject] IScriptingService service) { _service = service; this.OnEvent <GetMainScriptCommand>().Subscribe(e => GetMainScriptCommandHandler(e)).AddTo(this); this.OnEvent <ExecuteStringOnMainScriptCommand>().Subscribe(e => ExecuteStringOnMainScriptCommandHandler(e)).AddTo(this); this.OnEvent <ExecuteFileToMainScriptCommand>().Subscribe(e => ExecuteFileToMainScriptCommandHandler(e)).AddTo(this); this.OnEvent <ExecuteStringOnMainScriptRawCommand>().Subscribe(e => ExecuteStringOnMainScriptRawCommandHandler(e)).AddTo(this); this.OnEvent <AutocompleteProposalsCommand>().Subscribe(e => AutocompleteProposalsCommandHandler(e)).AddTo(this); }
private void ShowScriptUrlCommand(object node) { if (!(node is TreeNodeViewModel treeNode)) { return; } if (!(treeNode.NodePayload is MetaScript script)) { return; } WebServer webServer = treeNode.GetAncestorPayload <WebServer>(); DatabaseInfo database = treeNode.GetAncestorPayload <DatabaseInfo>(); DatabaseServer server = treeNode.GetAncestorPayload <DatabaseServer>(); string url = GetExecuteScriptUrl(webServer, server, database, script); ScriptingController controller = Services.GetService <ScriptingController>(); string sourceCode = controller.ReadScriptSourceCode(server, database, MetaScriptType.Script, script.Name); IMetadataService metadata = Services.GetService <IMetadataService>(); metadata.AttachDatabase(string.IsNullOrWhiteSpace(server.Address) ? server.Name : server.Address, database); IScriptingService scripting = Services.GetService <IScriptingService>(); TSqlFragment syntaxTree = scripting.ParseScript(sourceCode, out IList <ParseError> errors); if (errors.Count > 0) { ShowParseErrors(errors); return; } DeclareVariableStatementVisitor visitor = new DeclareVariableStatementVisitor(); syntaxTree.Accept(visitor); string jsonDTO = visitor.GenerateJsonParametersObject(); MainWindowViewModel mainWindow = Services.GetService <MainWindowViewModel>(); ScriptEditorViewModel editor = Services.GetService <ScriptEditorViewModel>(); editor.Name = $"{script.Name} (URL)"; editor.ScriptCode = url + Environment.NewLine + jsonDTO; ScriptEditorView scriptView = new ScriptEditorView() { DataContext = editor }; mainWindow.AddNewTab(editor.Name, scriptView); }
void Initialize([Inject] IScriptingService service) { _service = service; this.OnEvent <OpenScriptingConsoleCommand>().Subscribe(e => OpenScriptingConsoleCommandHandler(e)).AddTo(this); this.OnEvent <CloseScriptingConsoleCommand>().Subscribe(e => CloseScriptingConsoleCommandHandler(e)).AddTo(this); this.OnEvent <ToggleScriptingConsoleCommand>().Subscribe(e => ToggleScriptingConsoleCommandHandler(e)).AddTo(this); this.OnEvent <GetMainScriptCommand>().Subscribe(e => GetMainScriptCommandHandler(e)).AddTo(this); this.OnEvent <IsScriptingConsoleVisibleCommand>().Subscribe(e => IsScriptingConsoleVisibleCommandHandler(e)).AddTo(this); this.OnEvent <ExecuteStringOnMainScriptCommand>().Subscribe(e => ExecuteStringOnMainScriptCommandHandler(e)).AddTo(this); }
public CCToolsDeviceService( IDeviceRegistryService deviceRegistryService, II2CBusService i2CBusService, IInterruptMonitorService interruptMonitorService, IScriptingService scriptingService, ILogService log) { if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _deviceRegistryService = deviceRegistryService ?? throw new ArgumentNullException(nameof(deviceRegistryService)); _i2CBusService = i2CBusService ?? throw new ArgumentNullException(nameof(i2CBusService)); _log = log?.CreatePublisher(nameof(CCToolsDeviceService)) ?? throw new ArgumentNullException(nameof(log)); deviceRegistryService.RegisterDeviceFactory(new CCToolsDeviceFactory(this, interruptMonitorService)); }
public NotificationService( IDateTimeService dateTimeService, IApiDispatcherService apiService, ISchedulerService schedulerService, ISettingsService settingsService, IStorageService storageService, IResourceService resourceService, IScriptingService scriptingService, ILogService logService) { if (apiService == null) { throw new ArgumentNullException(nameof(apiService)); } if (schedulerService == null) { throw new ArgumentNullException(nameof(schedulerService)); } if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); _storageService = storageService ?? throw new ArgumentNullException(nameof(storageService)); _resourceService = resourceService ?? throw new ArgumentNullException(nameof(resourceService)); _log = logService.CreatePublisher(nameof(NotificationService)); settingsService.CreateSettingsMonitor <NotificationServiceSettings>(s => Settings = s.NewSettings); apiService.StatusRequested += HandleApiStatusRequest; schedulerService.Register("NotificationCleanup", TimeSpan.FromMinutes(15), () => Cleanup()); scriptingService.RegisterScriptProxy(s => new NotificationScriptProxy(this)); }
public DeviceMessageBrokerService(ILogService logService, IScriptingService scriptingService) { if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _log = logService?.CreatePublisher(nameof(DeviceMessageBrokerService)) ?? throw new ArgumentNullException(nameof(logService)); MqttTrace.TraceMessagePublished += (s, e) => { if (e.Level == MqttTraceLevel.Warning) { _log.Warning(e.Exception, e.Message); } else if (e.Level == MqttTraceLevel.Error) { _log.Error(e.Exception, e.Message); } }; var channelA = new MqttCommunicationAdapter(); _clientCommunicationAdapter = new MqttCommunicationAdapter(); channelA.Partner = _clientCommunicationAdapter; _clientCommunicationAdapter.Partner = channelA; var mqttClientOptions = new MqttClientOptions { ClientId = "HA4IoT.Loopback", KeepAlivePeriod = TimeSpan.FromHours(1) }; _client = new MqttClient(mqttClientOptions, channelA); _client.ApplicationMessageReceived += ProcessIncomingMessage; var mqttServerOptions = new MqttServerOptions(); _server = new MqttServerFactory().CreateMqttServer(mqttServerOptions); _server.ClientConnected += (s, e) => _log.Info($"MQTT client '{e.Identifier}' connected."); scriptingService.RegisterScriptProxy(s => new DeviceMessageBrokerScriptProxy(this, s)); }
public DeviceMessageBrokerService(ILogService logService, IScriptingService scriptingService) { if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _log = logService?.CreatePublisher(nameof(DeviceMessageBrokerService)) ?? throw new ArgumentNullException(nameof(logService)); MqttNetGlobalLogger.LogMessagePublished += (s, e) => { if (e.TraceMessage.Level == MqttNetLogLevel.Warning) { _log.Warning(e.TraceMessage.Exception, e.TraceMessage.ToString()); } else if (e.TraceMessage.Level == MqttNetLogLevel.Error) { _log.Error(e.TraceMessage.Exception, e.TraceMessage.ToString()); } else if (e.TraceMessage.Level == MqttNetLogLevel.Info) { _log.Info(e.TraceMessage.ToString()); } else if (e.TraceMessage.Level == MqttNetLogLevel.Verbose) { _log.Verbose(e.TraceMessage.ToString()); } }; _server = new MqttFactory().CreateMqttServer(); _server.ApplicationMessageReceived += ProcessIncomingMessage; _server.ClientConnected += (s, e) => _log.Info($"MQTT client '{e.Client.ClientId}' connected."); _server.ClientDisconnected += (s, e) => _log.Info($"MQTT client '{e.Client.ClientId}' connected."); _server.ClientSubscribedTopic += (s, e) => _log.Info($"MQTT client '{e.ClientId}' subscribed topic '{e.TopicFilter}'."); _server.ClientUnsubscribedTopic += (s, e) => _log.Info($"MQTT client '{e.ClientId}' unsubscribed topic '{e.TopicFilter}'."); scriptingService.RegisterScriptProxy(s => new DeviceMessageBrokerScriptProxy(this, s)); }
public ScriptingController(IScriptingService scripting) { Scripting = scripting; }
public DaylightService(IDateTimeService dateTimeService, IApiDispatcherService apiService, IScriptingService scriptingService) { if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); apiService.StatusRequested += (s, e) => { e.ApiContext.Result.Merge(JObject.FromObject(this)); }; scriptingService.RegisterScriptProxy(s => new DaylightScriptProxy(this, dateTimeService)); }
public ActionResult ExecuteScript([FromRoute] Guid server, [FromRoute] Guid database, [FromRoute] Guid script) { DatabaseServer srv = Metadata.Servers.Where(srv => srv.Identity == server).FirstOrDefault(); if (srv == null) { return(NotFound()); } DatabaseInfo db = srv.Databases.Where(db => db.Identity == database).FirstOrDefault(); if (db == null) { return(NotFound()); } MetaScript scr = db.Scripts.Where(scr => scr.Identity == script).FirstOrDefault(); if (scr == null) { return(NotFound()); } Dictionary <string, object> parameters = ParseParameters(HttpContext); string responseJson = "[]"; string errorMessage = string.Empty; string sourceCode = ReadScriptSourceCode(srv, db, scr); IMetadataService metadata = Services.GetService <IMetadataService>(); metadata.AttachDatabase(string.IsNullOrWhiteSpace(srv.Address) ? srv.Name : srv.Address, db); metadata.UseCredentials(db.UserName, db.Password); IScriptingService scripting = Services.GetService <IScriptingService>(); string sql = string.Empty; IList <ParseError> parseErrors = null; if (parameters.Count > 0) { sql = scripting.PrepareScript(sourceCode, parameters, out parseErrors); } else { sql = scripting.PrepareScript(sourceCode, out parseErrors); } foreach (ParseError error in parseErrors) { errorMessage += error.Message + Environment.NewLine; } if (parseErrors.Count > 0) { return(StatusCode(StatusCodes.Status500InternalServerError, errorMessage)); } try { responseJson = scripting.ExecuteJson(sql, out IList <ParseError> executeErrors); foreach (ParseError error in executeErrors) { errorMessage += error.Message + Environment.NewLine; } if (executeErrors.Count > 0) { return(StatusCode(StatusCodes.Status500InternalServerError, errorMessage)); } } catch (Exception ex) { errorMessage = ExceptionHelper.GetErrorText(ex); return(StatusCode(StatusCodes.Status500InternalServerError, errorMessage)); } return(Content(responseJson)); }
private void ExecuteCommandHandler(object parameter) { MainWindowViewModel mainWindow = Services.GetService <MainWindowViewModel>(); IMetadataService metadata = Services.GetService <IMetadataService>(); metadata.AttachDatabase(string.IsNullOrWhiteSpace(MyServer.Address) ? MyServer.Name : MyServer.Address, MyDatabase); IScriptingService scripting = Services.GetService <IScriptingService>(); string sql = scripting.PrepareScript(ScriptCode, out IList <ParseError> errors); string errorMessage = string.Empty; foreach (ParseError error in errors) { errorMessage += error.Message + Environment.NewLine; } if (errors.Count > 0) { ScriptEditorViewModel scriptEditor = Services.GetService <ScriptEditorViewModel>(); scriptEditor.Name = "Errors"; scriptEditor.ScriptCode = errorMessage; ScriptEditorView scriptView = new ScriptEditorView() { DataContext = scriptEditor }; mainWindow.AddNewTab(scriptEditor.Name, scriptView); return; } string json = "[]"; try { json = scripting.ExecuteScript(sql, out IList <ParseError> executeErrors); foreach (ParseError error in executeErrors) { errorMessage += error.Message + Environment.NewLine; } if (executeErrors.Count > 0) { ScriptEditorViewModel scriptEditor = Services.GetService <ScriptEditorViewModel>(); scriptEditor.Name = "Errors"; scriptEditor.ScriptCode = errorMessage; ScriptEditorView scriptView = new ScriptEditorView() { DataContext = scriptEditor }; mainWindow.AddNewTab(scriptEditor.Name, scriptView); return; } } catch (Exception ex) { ScriptEditorViewModel scriptEditor = Services.GetService <ScriptEditorViewModel>(); scriptEditor.Name = "Errors"; scriptEditor.ScriptCode = ex.Message; ScriptEditorView scriptView = new ScriptEditorView() { DataContext = scriptEditor }; mainWindow.AddNewTab(scriptEditor.Name, scriptView); return; } JsonSerializerOptions serializerOptions = new JsonSerializerOptions(); serializerOptions.Converters.Add(new DynamicJsonConverter()); dynamic data = JsonSerializer.Deserialize <dynamic>(json, serializerOptions); DataGrid dataView = DynamicGridCreator.CreateDynamicDataGrid(data); mainWindow.AddNewTab($"{Name} (result)", dataView); }
public SchedulerService(IDateTimeService dateTimeService, ILogService logService, IScriptingService scriptingService) { if (scriptingService == null) { throw new ArgumentNullException(nameof(scriptingService)); } _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); _log = logService?.CreatePublisher(nameof(SchedulerService)) ?? throw new ArgumentNullException(nameof(logService)); scriptingService.RegisterScriptProxy(s => new SchedulerScriptProxy(this, s)); ThreadPoolTimer.CreatePeriodicTimer(ExecuteSchedules, TimeSpan.FromMilliseconds(250)); }
public IntegratorModuleController(IModule module) { Module = (IntegratorModule)module; MetadataService = Module.GetService<IMetadataService>(); ScriptingService = Module.GetService<IScriptingService>(); ; }
void Initialize([Inject] IScriptingService service) { // _service = service; // // this.OnEvent<GetMainScriptCommand>().Subscribe(e => GetMainScriptCommandHandler(e)).AddTo(this); // // this.OnEvent<ExecuteStringOnMainScriptCommand>().Subscribe(e => ExecuteStringOnMainScriptCommandHandler(e)).AddTo(this); // // this.OnEvent<ExecuteFileToMainScriptCommand>().Subscribe(e => ExecuteFileToMainScriptCommandHandler(e)).AddTo(this); // // this.OnEvent<ExecuteStringOnMainScriptRawCommand>().Subscribe(e => ExecuteStringOnMainScriptRawCommandHandler(e)).AddTo(this); // // this.OnEvent<AutocompleteProposalsCommand>().Subscribe(e => AutocompleteProposalsCommandHandler(e)).AddTo(this); // // this.OnEvent<CreateCoroutineCommand>().Subscribe(e => CreateCoroutineCommandHandler(e)).AddTo(this); // // this.OnEvent<CallbackCommand>().Subscribe(e => CallbackCommandHandler(e)).AddTo(this); // // this.OnEvent<RegisterCallbackCommand>().Subscribe(e => RegisterCallbackCommandHandler(e)).AddTo(this); // // this.OnEvent<UnregisterCallbackCommand>().Subscribe(e => UnregisterCallbackCommandHandler(e)).AddTo(this); // // this.OnEvent<RegisterCustomYieldCheckCommand>().Subscribe(e => RegisterCustomYieldCheckCommandHandler(e)).AddTo(this); // // this.OnEvent<RegisterEntityToLuaCommand>().Subscribe(e => RegisterEntityToLuaCommandHandler(e)).AddTo(this); // // this.OnEvent<IsEntityRegisteredCommand>().Subscribe(e => IsEntityRegisteredCommandHandler(e)).AddTo(this); // // this.OnEvent<GetLUAEntityIDCommand>().Subscribe(e => GetLUAEntityIDCommandHandler(e)).AddTo(this); // // this.OnEvent<GetComponentCommand>().Subscribe(e => GetComponentCommandHandler(e)).AddTo(this); // // this.OnEvent<SetupCommand>().Subscribe(e => SetupCommandHandler(e)).AddTo(this); // // this.OnEvent<CleanupCommand>().Subscribe(e => CleanupCommandHandler(e)).AddTo(this); // // this.OnEvent<TickCommand>().Subscribe(e => TickCommandHandler(e)).AddTo(this); // // this.OnEvent<StartLogCommand>().Subscribe(e => StartLogCommandHandler(e)).AddTo(this); // // this.OnEvent<WriteLogCommand>().Subscribe(e => WriteLogCommandHandler(e)).AddTo(this); // // this.OnEvent<ActivateLuaReplayScriptCommand>().Subscribe(e => ActivateLuaReplayScriptCommandHandler(e)).AddTo(this); // // this.OnEvent<LuaScriptActivatedCommand>().Subscribe(e => LuaScriptActivatedCommandHandler(e)).AddTo(this); // // this.OnEvent<SaveCurrentLuaReplayCommand>().Subscribe(e => SaveCurrentLuaReplayCommandHandler(e)).AddTo(this); // // this.OnEvent<GetCurrentLuaReplayCommand>().Subscribe(e => GetCurrentLuaReplayCommandHandler(e)).AddTo(this); // // this.OnEvent<GetLuaReplayStringBuilderCommand>().Subscribe(e => GetLuaReplayStringBuilderCommandHandler(e)).AddTo(this); // // this.OnEvent<SetLuaReplayStringBuilderCommand>().Subscribe(e => SetLuaReplayStringBuilderCommandHandler(e)).AddTo(this); // // this.OnEvent<SetLuaReplayGetGameTimeFuncCommand>().Subscribe(e => SetLuaReplayGetGameTimeFuncCommandHandler(e)).AddTo(this); // // this.OnEvent<ReplayWrite_RegisterEntityCommand>().Subscribe(e => ReplayWrite_RegisterEntityCommandHandler(e)).AddTo(this); // // this.OnEvent<ReplayWrite_CustomLuaCommand>().Subscribe(e => ReplayWrite_CustomLuaCommandHandler(e)).AddTo(this); // // this.OnEvent<ReplayWrite_SetCurrentEntityCommand>().Subscribe(e => ReplayWrite_SetCurrentEntityCommandHandler(e)).AddTo(this); // }