internal static ICollection <Process> GetSpotifyProcesses() { var spotifyProcesses = new List <Process>(); foreach (var process in Process.GetProcesses()) { if (SpotifyStatus.WindowTitleIsSpotify(process.ProcessName)) { spotifyProcesses.Add(process); } } return(spotifyProcesses); }
public async Task <ISpotifyStatus> GetSpotifyStatus() { var(processTitle, isSpotifyAudioPlaying) = await GetSpotifyTitle(); var isWindowTitledSpotify = SpotifyStatus.WindowTitleIsSpotify(processTitle); if (string.IsNullOrWhiteSpace(processTitle)) { return(null); } var spotifyWindowInfo = new SpotifyWindowInfo { WindowTitle = processTitle, IsPlaying = isSpotifyAudioPlaying || !isWindowTitledSpotify }; return(new SpotifyStatus(spotifyWindowInfo)); }
internal void SpotifyStatusWindowTitleIsSpotify_ReturnsWhenItMatches(string value, bool expected) { var actual = SpotifyStatus.WindowTitleIsSpotify(value); Assert.Equal(expected, actual); }