예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
        internal void SpotifyStatusWindowTitleIsSpotify_ReturnsWhenItMatches(string value, bool expected)
        {
            var actual = SpotifyStatus.WindowTitleIsSpotify(value);

            Assert.Equal(expected, actual);
        }