public virtual void Start(ILogger logger) { Logger = logger; OsuMemoryDataProvider.DataProvider.Initalize(); _memoryReader = OsuMemoryDataProvider.DataProvider.Instance; _settings.SettingUpdated += OnSettingsSettingUpdated; bool isFallback = _settings.Get <bool>(_names.OsuFallback); bool memoryScannerIsEnabled = _settings.Get <bool>(_names.EnableMemoryScanner); MemoryPoolingIsEnabled = _settings.Get <bool>(_names.EnableMemoryPooling); if (!memoryScannerIsEnabled) { return; } if (isFallback) { _settings.Add(_names.EnableMemoryScanner.Name, false); return; } lock (_lockingObject) _timer = new Timer(TimerCallback, null, 250, Int32.MaxValue); _memoryListener = new MemoryListener(Helpers.GetFullSongsLocation(_settings)); _memoryListener.NewOsuEvent += (s, args) => NewOsuEvent?.Invoke(this, args); _memoryListener.SetHighFrequencyDataHandlers(_highFrequencyDataHandlers); _memoryListener.SetSettingsHandle(_settings); Started = true; }
public void CreateTokens(MapSearchResult map) { Dictionary <string, object> dict; var OsuFileLocationToken = _tokenSetter("OsuFileLocation", null); if (map.FoundBeatmaps) { dict = map.BeatmapsFound[0].GetTokens(); var osuLocation = _settings.Get <string>(_names.MainOsuDirectory); var customSongsLocation = _settings.Get <string>(_names.SongsFolderLocation); if (string.IsNullOrWhiteSpace(osuLocation)) { OsuFileLocationToken.Value = null; } else { string baseDirectory = customSongsLocation == _names.SongsFolderLocation.Default <string>() ? Path.Combine(osuLocation, "Songs") : customSongsLocation; OsuFileLocationToken.Value = Path.Combine(baseDirectory, map.BeatmapsFound[0].Dir, map.BeatmapsFound[0].OsuFileName); } } else { dict = ((Beatmap)null).GetTokens(true); OsuFileLocationToken.Value = null; } foreach (var token in dict) { _tokenSetter(token.Key, token.Value); } }
public MemoryDataFinderSettings(ISettingsHandler settings) { InitializeComponent(); _settings = settings; checkBox_enableSmoothPp.Checked = _settings.Get <bool>(Helpers.EnablePpSmoothing); bool isFallback = _settings.Get <bool>(_names.OsuFallback); if (isFallback) { checkBox_EnableMemoryFinder.Enabled = false; } else { checkBox_EnableMemoryFinder.Checked = _settings.Get <bool>(_names.EnableMemoryScanner); checkBox_EnableMemoryPooling.Checked = _settings.Get <bool>(_names.EnableMemoryPooling); checkBox_clearTokensAfterPlay.Checked = _settings.Get <bool>(Helpers.ClearLiveTokensAfterResultScreenExit); } init = false; }
private bool ShouldRun() { bool shouldForceFirstRun; var lastVersionStr = _settings.Get <string>(SettingNames.Instance.LastRunVersion); if (lastVersionStr == SettingNames.Instance.LastRunVersion.Default <string>()) { shouldForceFirstRun = true; } else { try { var lastVersion = Helpers.Helpers.GetDateFromVersionString(lastVersionStr); var versionToResetOn = Helpers.Helpers.GetDateFromVersionString("v180209.13"); shouldForceFirstRun = lastVersion < versionToResetOn; } catch (Exception e) { if (e is FormatException || e is ArgumentNullException) { shouldForceFirstRun = true; } else { throw; } } } return(_firstRunControlProviders.Count != 0 && (shouldForceFirstRun || _settings.Get <bool>(SettingNames.Instance.FirstRun))); }
public Tokens GetMapReplacements(MapSearchResult map) { Tokens dict; if (map.FoundBeatmaps) { dict = map.BeatmapsFound[0].GetTokens(); var osuLocation = _settings.Get <string>(_names.MainOsuDirectory); var customSongsLocation = _settings.Get <string>(_names.SongsFolderLocation); if (string.IsNullOrWhiteSpace(osuLocation)) { dict.Add("OsuFileLocation", new Token(null)); } else { string baseDirectory = customSongsLocation == _names.SongsFolderLocation.Default <string>() ? Path.Combine(osuLocation, "Songs") : customSongsLocation; dict.Add("OsuFileLocation", new Token(Path.Combine(baseDirectory, map.BeatmapsFound[0].Dir, map.BeatmapsFound[0].OsuFileName))); } } else { dict = ((Beatmap)null).GetTokens(true); dict.Add("OsuFileLocation", new Token(null)); } return(dict); }
public OsuPost(ILogger logger, ISettingsHandler settings) { _settings = settings; api = new OsuPostApi(logger); api.EndpointUrl = _settings.Get <string>(_names.osuPostEndpoint); SwitchApiStatus(_settings.Get <bool>(_names.osuPostEnabled)); _settings.SettingUpdated += SettingUpdated; }
public osuPostSettings(ISettingsHandler settings) { _settings = settings; InitializeComponent(); textBox_userId.Text = _settings.Get <string>(_names.osuPostLogin); textBox_userPassword.Text = _settings.Get <string>(_names.osuPostPassword); textBox_endpointUrl.Text = _settings.Get <string>(_names.osuPostEndpoint); panel_settings.Enabled = _settings.Get <bool>(_names.osuPostEnabled); init = false; }
private void SettingUpdated(object sender, SettingUpdated settingUpdated) { if (settingUpdated.Name == _names.osuPostEnabled.Name) { SwitchApiStatus(_settings.Get <bool>(_names.osuPostEnabled)); } else if (settingUpdated.Name == _names.osuPostEndpoint.Name) { api.EndpointUrl = _settings.Get <string>(_names.osuPostEndpoint); } }
public static string GetFullSongsLocation(ISettingsHandler settings) { var dir = settings.Get <string>(_names.SongsFolderLocation); if (dir == _names.SongsFolderLocation.Default <string>()) { dir = settings.Get <string>(_names.MainOsuDirectory); dir = Path.Combine(dir, "Songs\\"); } return(dir); }
public ModParserSettings(ISettingsHandler settings) { _settings = settings; _settings.SettingUpdated += SettingUpdated; this.Enabled = _settings.Get <bool>(_names.EnableMemoryScanner); InitializeComponent(); textBox_Mods.Text = _settings.Get <string>(_names.NoModsDisplayText); radioButton_longMods.Checked = _settings.Get <bool>(_names.UseLongMods); radioButton_shortMods.Checked = !radioButton_longMods.Checked; init = false; }
public void Start(ILogger logger) { Started = true; _logger = logger; if (_settings.Get <bool>(PluginSettings.EnableIngameOverlay)) { CopyFreeType(); _workerThread = new Thread(WatchForProcessStart); _workerThread.Start(); } }
private void UpdateNoModText() { string noneText = _settings?.Get <string>(_names.NoModsDisplayText) ?? "None"; if (LongNoModText != noneText) { LongNoModText = noneText; } if (ShortNoModText != noneText) { ShortNoModText = noneText; } }
public void SetSettingsHandle(ISettingsHandler settings) { _settings = settings; _settings.SettingUpdated += SettingUpdated; _memoryDataProcessor.ToggleSmoothing(_settings.Get <bool>(Helpers.EnablePpSmoothing)); _memoryDataProcessor.SetSettingsHandle(_settings); }
public WebSocketDataGetter(ISettingsHandler settings) { _settings = settings; if (!_settings.Get <bool>(Enabled)) { return; } webSocketServer = new WebSocketServer(IPAddress.Loopback, _settings.Get <int>(WebSocketPort)); webSocketServer.ReuseAddress = true; webSocketServer.AddWebSocketService("/StreamCompanion/LiveData/Stream", () => new StreamDataProvider(_liveDataContainer)); webSocketServer.AddWebSocketService("/StreamCompanion/MapData/Stream", () => new StreamDataProvider(_mapDataContainer)); webSocketServer.Start(); }
private void Load() { lock (_lockingObject) { var legacyConfig = new LegacyParserConfigConverter(); var oldPatterns = legacyConfig.Convert(_settings); if (oldPatterns.Count > 0) { foreach (var p in oldPatterns) { _patterns.Add(p); } MessageBox.Show("There was a big change in how patterns are stored and they needed to be converted." + Environment.NewLine + "Go to your pattern settings and make sure that everything is still correct(Especialy save events)", "osu!StreamCompanion - Update message", MessageBoxButtons.OK); } else { string rawPatterns = _settings.Get <string>(_names.ActualPatterns); var deserializedPatterns = JsonConvert.DeserializeObject <List <OutputPattern> >(rawPatterns); if (deserializedPatterns != null) { foreach (var p in deserializedPatterns) { _patterns.Add(p); } } } } }
public IngameOverlay(ILogger logger, ISettingsHandler settings, Delegates.Exit exiter) { _logger = logger; _settings = settings; try { SetNewMap(new MapSearchResult(new MapSearchArgs("dummy"))); } catch (Exception) { MessageBox.Show( $"IngameOverlay plugin version is not valid for this version of StreamCompanion. {Environment.NewLine} Either update or remove it from plugins folder", "osu!StreamCompanion Error", MessageBoxButtons.OK, MessageBoxIcon.Error); exiter("plugin version is invalid for current StreamCompanion version."); } if (_settings.Get <bool>(PluginSettings.EnableIngameOverlay)) { CopyFreeType(); Task.Run(() => WatchForProcessStart(cancellationToken.Token), cancellationToken.Token); } }
private void SettingUpdated(object sender, SettingUpdated e) { if (e.Name == Helpers.ClearLiveTokensAfterResultScreenExit.Name) { _clearLiveTokensAfterResultScreenExit = _settings.Get <bool>(Helpers.ClearLiveTokensAfterResultScreenExit); } }
public TextSaver(ISettingsHandler settings) { var saveDirectory = settings.Get <string>(SaveDirectoryConfigEntry); if (saveDirectory != SaveDirectoryConfigEntry.Default <string>() && !string.IsNullOrWhiteSpace(saveDirectory)) { _saveDirectory = saveDirectory; var driveList = DriveInfo.GetDrives().ToList(); var saveDirectoryInfo = new DirectoryInfo(_saveDirectory); foreach (var drive in driveList) { if ((drive.DriveType == DriveType.Network || drive.DriveType == DriveType.Removable) && saveDirectoryInfo.Root.FullName == drive.RootDirectory.FullName) { MessageBox.Show("Please note that saving patterns on network shares might cause unexpected behaviours(like SC updating with 30s+ delay) - especially if connection is slow, and is not really supported.", "osu!StreamCompanion - network or removable media information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } try { if (!Directory.Exists(SaveDirectory)) { Directory.CreateDirectory(SaveDirectory); } } catch (UnauthorizedAccessException ex) { throw new NonLoggableException(ex, "Could not create folder due to insuffisient premissions" + Environment.NewLine + "Please move this exectuable into a non-system folder"); } }
public OsuMemoryEventSourceBase(ILogger logger, ISettingsHandler settings, ISqliteControler sqliteControler, IModParser modParser, List <IHighFrequencyDataHandler> highFrequencyDataHandlers) { _settings = settings; _sqLiteController = sqliteControler; _modParser = modParser; _highFrequencyDataHandlers = highFrequencyDataHandlers; Logger = logger; TokenSetter = Tokens.CreateTokenSetter(Name); _memoryReader = OsuMemoryReader.Instance; _settings.SettingUpdated += OnSettingsSettingUpdated; bool isFallback = _settings.Get <bool>(_names.OsuFallback); bool memoryScannerIsEnabled = _settings.Get <bool>(_names.EnableMemoryScanner); MemoryPoolingIsEnabled = _settings.Get <bool>(_names.EnableMemoryPooling); _poolingMsDelay = _settings.Get <int>(_names.MemoryPoolingFrequency); if (!memoryScannerIsEnabled) { return; } if (isFallback) { _settings.Add(_names.EnableMemoryScanner.Name, false); return; } lock (_lockingObject) _timer = new Timer(TimerCallback, null, 250, Int32.MaxValue); _memoryListener = new MemoryListener(); _memoryListener.NewOsuEvent += async(s, args) => { while (NewOsuEvent == null) { await Task.Delay(5); } NewOsuEvent.Invoke(this, args); }; _memoryListener.SetHighFrequencyDataHandlers(_highFrequencyDataHandlers); _memoryListener.SetSettingsHandle(_settings); Started = true; }
public WebSocketDataGetter(ISettingsHandler settings) { _settings = settings; if (!_settings.Get <bool>(Enabled)) { return; } webSocketServer = new WebSocketServer(IPAddress.Parse(_settings.Get <string>(WebSocketAddress)), _settings.Get <int>(WebSocketPort)); webSocketServer.ReuseAddress = true; webSocketServer.WaitTime = TimeSpan.FromSeconds(30); webSocketServer.AddWebSocketService("/StreamCompanion/LiveData/Stream", () => new StreamDataProvider(_liveDataContainer)); webSocketServer.AddWebSocketService("/StreamCompanion/MapData/Stream", () => new StreamDataProvider(_mapDataContainer)); webSocketServer.Start(); }
private void SettingUpdated(object sender, SettingUpdated settingUpdated) { if (settingUpdated.Name == Helpers.EnablePpSmoothing.Name) { var enableSmoothing = _settings.Get <bool>(Helpers.EnablePpSmoothing); _memoryDataProcessor.ToggleSmoothing(enableSmoothing); } }
public WebSocketSettings(ISettingsHandler settings) { _settings = settings; InitializeComponent(); checkBox_EnableWebSocketOutput.Checked = settings.Get <bool>(WebSocketDataGetter.Enabled); checkBox_EnableWebSocketOutput.CheckedChanged += CheckBoxEnableWebSocketOutputOnCheckedChanged; }
public IngameOverlaySettings(ISettingsHandler settings) { _settings = settings; InitializeComponent(); checkBox_ingameOverlay.Checked = _settings.Get <bool>(PluginSettings.EnableIngameOverlay); checkBox_ingameOverlay.CheckedChanged += CheckBoxIngameOverlayOnCheckedChanged; }
public void Start(ILogger logger) { Started = true; if (!_settings.Get <bool>(_names.StartHidden)) { ShowWindow(); } }
public LiveVisualizerSettings(ISettingsHandler settings) { _settings = settings; InitializeComponent(); using (InstalledFontCollection fontsCollection = new InstalledFontCollection()) { var fontNames = fontsCollection.Families.Select(f => f.Name).ToList(); comboBox_font.DataSource = fontNames; var desiredFont = _settings.Get <string>(ConfigEntrys.Font); var font = fontNames.Contains(desiredFont) ? desiredFont : "Arial"; comboBox_font.SelectedItem = font; } checkBox_enable.Checked = _settings.Get <bool>(ConfigEntrys.Enable); panel1.Enabled = checkBox_enable.Checked; checkBox_autosizeChart.Checked = _settings.Get <bool>(ConfigEntrys.AutoSizeAxisY); panel_manualChart.Enabled = !checkBox_autosizeChart.Checked; color_chartPrimary.Color = ColorHelpers.GetColor(_settings, ConfigEntrys.ChartColor); color_chartProgress.Color = ColorHelpers.GetColor(_settings, ConfigEntrys.ChartProgressColor); color_horizontalLegend.Color = ColorHelpers.GetColor(_settings, ConfigEntrys.AxisYSeparatorColor); textBox_chartCutoffs.Text = _settings.Get <string>(ConfigEntrys.ManualAxisCutoffs); checkBox_showAxisYSeparator.Checked = _settings.Get <bool>(ConfigEntrys.ShowAxisYSeparator); numericUpDown_windowHeight.Value = (decimal)_settings.Get <double>(ConfigEntrys.WindowHeight); numericUpDown_windowWidth.Value = (decimal)_settings.Get <double>(ConfigEntrys.WindowWidth); checkBox_enableWindowRezising.Checked = _settings.Get <bool>(ConfigEntrys.EnableResizing); color_chartPrimary.ColorChanged += Color_chartPrimary_ColorChanged; color_chartProgress.ColorChanged += ColorChartProgressOnColorChanged; color_horizontalLegend.ColorChanged += ColorHorizontalLegendOnColorChanged; checkBox_enable.CheckedChanged += CheckBoxEnableOnCheckedChanged; checkBox_autosizeChart.CheckedChanged += checkBox_autosizeChart_CheckedChanged; comboBox_font.SelectedValueChanged += ComboBoxFontOnSelectedValueChanged; textBox_chartCutoffs.TextChanged += textBox_chartCutoffs_TextChanged; checkBox_showAxisYSeparator.CheckedChanged += checkBox_showAxisYSeparator_CheckedChanged; numericUpDown_windowHeight.ValueChanged += NumericUpDownWindowHeightOnValueChanged; numericUpDown_windowWidth.ValueChanged += NumericUpDownWindowWidthOnValueChanged; checkBox_enableWindowRezising.CheckedChanged += CheckBoxEnableWindowRezisingOnCheckedChanged; }
public TcpSocketSettings(ISettingsHandler settings) { _settings = settings; InitializeComponent(); checkBox_EnableTcpOutput.Checked = _settings.Get <bool>(_names.tcpSocketEnabled); checkBox_EnableTcpOutput.CheckedChanged += checkBox_EnableTcpOutput_CheckedChanged; }
private void HookMouse() { if (_settings.Get <bool>(_names.EnableMouseHook) && _mouseListener == null) { _mouseListener = new MouseListener(); _mouseListener.OnLeftMouseDown += _mouseListener_OnLeftMouseDown; _mouseListener.OnRightMouseDown += MouseListener_OnRightMouseDown; _mouseListener.Hook(); _logger.Log(">Mouse hooked!", LogLevel.Debug); } }
public void Start(ILogger logger) { Started = true; api = new OsuPostApi(logger); api.EndpointUrl = _settings.Get <string>(_names.osuPostEndpoint); SwitchApiStatus(_settings.Get <bool>(_names.osuPostEnabled)); _settings.SettingUpdated += SettingUpdated; }
public ParserSettings(ISettingsHandler settings, Action resetPatterns) { _settings = settings; _resetPatterns = resetPatterns; InitializeComponent(); this.patternList.SelectedItemChanged += SelectedItemChanged; this.checkBox_disableDiskSaving.Checked = _settings.Get <bool>(_names.DisableDiskPatternWrite); this.patternEdit.DeletePattern += DeletePattern; this.patternEdit.AddPattern += AddPattern; checkBox_disableDiskSaving.CheckedChanged += CheckBox_disableDiskSaving_CheckedChanged; }
public MainWindow(ISettingsHandler settings, IMainWindowModel mainWindowHandle, IEnumerable <ISettingsProvider> settingsProviders, Delegates.Exit exitAction) { _settings = settings; _mainWindowHandle = mainWindowHandle; _exitAction = exitAction; _settingsList = settingsProviders.ToList(); if (!_settings.Get <bool>(_names.StartHidden)) { ShowWindow(); } }