public BrowserOverlay(IContextAwareLogger logger, ISettings settings, ISaver saver, List <Lazy <IHighFrequencyDataConsumer> > dataConsumers, Delegates.Restart restarter) { _logger = logger; _settings = settings; _saver = saver; _dataConsumers = dataConsumers; _restarter = restarter; _browserOverlayConfiguration = _settings.GetConfiguration <Configuration>(BrowserOverlayConfigurationConfigEntry); _browserOverlayConfiguration.OverlayTabs ??= new List <OverlayTab> { new OverlayTab() }; if (_browserOverlayConfiguration.Enabled && TextOverlayIsEnabled(_settings)) { _browserOverlayConfiguration.Enabled = false; var infoText = $"TextIngameOverlay and BrowserIngameOverlay can't be ran at the same time.{Environment.NewLine} BrowserIngameOverlay was disabled in order to prevent osu! crash."; _logger.Log(infoText, LogLevel.Warning); MessageBox.Show(infoText, "BrowserIngameOverlay Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (_browserOverlayConfiguration.Enabled) { Initialize().HandleExceptions(); } SendConfiguration(); }
public WebOverlay(ISettings settings, ISaver saver, Delegates.Restart restarter) { _settings = settings; _saver = saver; _restarter = restarter; OverlayConfiguration = new OverlayConfiguration(); LoadConfiguration(); SaveConfiguration(); OverlayConfiguration.PropertyChanged += OverlayConfigurationPropertyChanged; }
public WebSocketDataGetter(ISettings settings, ILogger logger, ISaver saver, Delegates.Restart restarter) { _settings = settings; _saver = saver; _restarter = restarter; _logger = logger; _webOverlay = new WebOverlay.WebOverlay(settings, saver); var modules = new List <(string Description, IWebModule Module)> { ("WebSocket stream of output patterns containing live tokens", new WebSocketDataEndpoint("/liveData", true, _liveDataContainer)), ("WebSocket stream of output patterns with do not contain live tokens", new WebSocketDataEndpoint("/mapData", true, _mapDataContainer)), ("WebSocket stream of requested tokens, with can be changed at any point by sending message with serialized JArray, containing case sensitive token names", new WebSocketTokenEndpoint("/tokens", true, Tokens.AllTokens)), ("All tokens in form of json objects, prefer usage of one of the websocket endpoints above", new ActionModule("/json", HttpVerbs.Get, SendAllTokens)), ("Current beatmap background image, use \"width\" and/or \"height\" query parameters to resize image while keeping its aspect ratio. Set \"crop\" query parameter to true to return image with exact size provided", new ActionModule("/backgroundImage", HttpVerbs.Get, SendCurrentBeatmapImage)), ("List of available overlays (folder names)", new ActionModule("/overlayList", HttpVerbs.Get, ListOverlays)), ("All StreamCompanion settings", new ActionModule("/settings", HttpVerbs.Get, GetSettings)), }; _server = new HttpServer(BindAddress(_settings), HttpContentRoot(saver), logger, modules); Task.Run(RunServer); }