private string _lastTrackFullName; //local files handling private void UpdateTrackInfo(IPlaybackResponse playbackState) { if (playbackState == null) { return; } PlayingTrackControl.Update(playbackState); string gameName = _gameProcess.CurrentProcess?.WindowName ?? ""; UserSettingsBlock.Update(_userContext.LastAccount, gameName); if (_lastTrackFullName == playbackState.FullName) { return; } BackgroundCover.Update(playbackState.CoverUrl); _configWriter.RewriteKeyBinding(playbackState); _lastTrackFullName = playbackState.FullName; if (UserSettingsBlock.AutosendCheck.IsToggled && _gameProcess.IsValid) { _keySender.SendSystemInput(UserSettingsBlock.CurrentVirtualKey); } }
private static void onPlaybackStateUpdate(IPlaybackResponse resp) { if (resp == null) { Console.Clear(); Console.WriteLine("Nothing is playing!"); return; } Console.Clear(); Console.WriteLine($"{resp.FullName} ({resp.ProgressMinutes}:{resp.ProgressSeconds:00})"); Console.WriteLine("Current account: " + steamContext.LastAccount); Console.WriteLine("Current key: " + currentKey); if (resp.Id != lastTrackId) { if (process.IsValid) { keySender.SendSystemInput(currentKeyVirtual); } lastTrackId = resp.Id; configWriter.RewriteKeyBinding(resp); } }