public ClientPushService(IHubContext <WebClientHub> hubContext, OneDasEngine engine) { _hubContext = hubContext; _oneDasEngine = engine; _connectionToSubscriptionMap = new Dictionary <string, LiveViewSubscription>(); _nextSubscriptionId = 1; _oneDasEngine.OneDasStateChanged += this.OneOneDasStateChanged; _updatePerfInfoTimer = new Timer() { AutoReset = true, Enabled = true, Interval = TimeSpan.FromSeconds(1).TotalMilliseconds }; _updateDataSnapshotTimer = new Timer() { AutoReset = true, Enabled = true, Interval = TimeSpan.FromSeconds(1).TotalMilliseconds }; _updateLiveValueDataTimer = new Timer() { AutoReset = true, Enabled = true, Interval = TimeSpan.FromMilliseconds(200).TotalMilliseconds }; _updatePerfInfoTimer.Elapsed += OnUpdatePerfInfoTimer; _updateDataSnapshotTimer.Elapsed += OnUpdataDataSnapshot; _updateLiveValueDataTimer.Elapsed += OnUpdateLiveValueData; }
public WebClientHub( OneDasEngine engine, OneDasPackageManager packageManager, ClientPushService clientPushService, IExtensionFactory extensionFactory, ILoggerFactory loggerFactory, IOneDasProjectSerializer projectSerializer, IOptions <WebServerOptions> options) { _engine = engine; _packageManager = packageManager; _clientPushService = clientPushService; _extensionFactory = extensionFactory; _webServerLogger = loggerFactory.CreateLogger("WebServer"); _projectSerializer = projectSerializer; _webServerOptions = options.Value; }
public AdvancedBootloader(bool isHosting, WebServerOptions webServerOptions, IConfiguration configuration) { OneDasOptions options; ExtensionLoader extensionLoader; _isHosting = isHosting; _webServerOptions = webServerOptions; _configuration = configuration; if (isHosting) { _webhost = this.CreateWebHost(); _serviceProvider = _webhost.Services; // create directories options = _serviceProvider.GetRequiredService <IOptions <OneDasOptions> >().Value; Directory.CreateDirectory(options.BackupDirectoryPath); Directory.CreateDirectory(options.ConfigurationDirectoryPath); Directory.CreateDirectory(options.DataDirectoryPath); Directory.CreateDirectory(options.NugetDirectoryPath); Directory.CreateDirectory(options.ProjectDirectoryPath); // client push service AdvancedBootloader.ClientPushService = _serviceProvider.GetRequiredService <ClientPushService>(); // extension loader extensionLoader = _serviceProvider.GetRequiredService <ExtensionLoader>(); extensionLoader.ReloadPackages(); // create engine _engine = _serviceProvider.GetRequiredService <OneDasEngine>(); } else { _serviceCollection = new ServiceCollection(); this.ConfigureServices(_serviceCollection); _serviceProvider = _serviceCollection.BuildServiceProvider(); } }
private void TryStartOneDasEngine(OneDasEngine oneDasEngine, string projectFilePath) { if (File.Exists(projectFilePath)) { Task.Run(() => { IOneDasProjectSerializer oneDasProjectSerializer; oneDasProjectSerializer = _serviceProvider.GetRequiredService <IOneDasProjectSerializer>(); try { oneDasEngine.ActivateProject(oneDasProjectSerializer.Load(projectFilePath), 4); oneDasEngine.Start(); } catch (Exception ex) { oneDasEngine.HandleException(ex); } }); } }
public ConsoleHub(OneDasEngine oneDasEngine) { _oneDasEngine = oneDasEngine; }