Exemplo n.º 1
0
        static void Main(string[] args)
        {
            int min, max, total = 0;
            var player = new Player();
            var songs  = CreateSongs(out min, out max, ref total);

            player.Songs = songs;
            Console.WriteLine($"Total duratio: {total}, max duration: {max}, min duration: {min}");
            while (true)
            {
                switch (ReadLine())
                {
                case "Up":
                {
                    player.VolumeUp();
                }
                break;

                case "Down":
                {
                    player.VolumeDown();
                }
                break;

                case "P":
                {
                    player.Play();
                }
                break;
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            int    min, max, total = 0;
            Player player = new Player(new ClassicSkin());
            Random rand   = new Random();

            Console.WriteLine($"{0}");
            //var songs = CreateSongs(out min, out max, ref total);


            List <Song> songs = new List <Song>();

            for (int i = 0; i < 8; i++)
            {
                var song = CreateSong($"song {i}", Convert.ToBoolean(rand.Next(2)));
                songs.Add(song);
            }
            player.Add(songs);

            List <Song> songsGenre = new List <Song>();

            for (int i = 0; i < 8; i++)
            {
                var songG = CreateSongGenre($"song {i}", rand.Next(4));

                songsGenre.Add(songG);
            }
            player.Add(songsGenre);

            while (true)
            {
                switch (ReadLine())
                {
                case "up":
                {
                    player.VolumeUp();
                }
                break;

                case "down":
                {
                    player.VolumeDown();
                }
                break;

                case "p":
                {
                    player.Play(true);
                }
                break;

                case "l":
                {
                    player.Lock();
                }
                break;

                case "ul":
                {
                    player.Unlock();
                }
                break;

                case "s":
                {
                    player.Stop();
                }
                break;

                case "start":
                {
                    player.Start();
                }
                break;

                case "shuf":
                {
                    player.Shuffle(songs);
                }
                break;

                case "sort":
                {
                    player.SortByTitle(songs);
                }
                break;

                case "GS":
                {
                    player.FilterByGenre(songsGenre, Song.Genres.Pop);
                }
                break;

                case "CHS":
                {
                    player.ChangeSkin();
                }
                break;
                }
            }
            //player.Playing=true;
            Console.ReadLine();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            int min, max, total = 0;
            var player = new Player();
            var songs  = CreateSongs(out min, out max, ref total);

            player.Songs = songs;
            Console.WriteLine($"TotalDuration: {total}, max duration: {max}, min duration: {min}");

            while (true)
            {
                switch (ReadLine())
                {
                case "Up":
                {
                    player.VolumeUp();
                }
                break;

                case "Down":
                {
                    player.VolumeDown();
                }
                break;

                case "P":
                {
                    player.Play();
                }
                break;

                case "step1":
                {
                    player.VolumeChange1();
                }
                break;

                case "step2":
                {
                    player.VolumeChange2();
                }
                break;

                case "Lock":
                {
                    player.Lock();
                }
                break;

                case "Unlock":
                {
                    player.Unlock();
                }
                break;

                case "Stop":
                {
                    player.Stop();
                }
                break;

                case "Start":
                {
                    player.Start();
                }
                break;

                case "CreateDS":
                {
                    CreateDefaultSong();
                }
                break;
                }
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var defaultSkin = new ColorSkin();

            using (var player = new Player(defaultSkin))
            {
                player.PlayerStartedEvent += (bool isPlaying) =>
                {
                    Visualise(player, player.PlayingPlaylist);
                };

                player.PlayerStoppedEvent += (bool isPlaying) =>
                {
                    List <Song> clearList = new List <Song>();
                    Visualise(player, clearList);
                };

                player.PlayerLockedEvent += (bool isLocked) =>
                {
                    Visualise(player, player.PlayingPlaylist);
                };

                player.PlayerUnlockedEvent += (bool isLocked) =>
                {
                    Visualise(player, player.PlayingPlaylist);
                };

                player.VolumeChangedEvent += (float inputAmount) =>
                {
                    Visualise(player, player.PlayingPlaylist);
                };

                player.SongStartedEvent += (Song song) =>
                {
                    Visualise(player, player.PlayingPlaylist);
                };

                player.SongStoppedEvent += (Song song) =>
                {
                    Visualise(player, player.PlayingPlaylist);
                };

                player.PlaybackAbortedEvent += (bool isAborted) =>
                {
                    Visualise(player, player.PlayingPlaylist);
                };

                while (true)
                {
                    switch (ReadLine())
                    {
                    case "u":
                    {
                        player.VolumeUp();
                    }
                    break;

                    case "d":
                    {
                        player.VolumeDown();
                    }
                    break;

                    case "Loop":
                    {
                        if (player.IsPlaying == false)
                        {
                            player.Start();
                        }
                        player.Play(true);
                    }
                    break;

                    case "-Loop":
                    {
                        player.IsOnLoop = false;
                    }
                    break;

                    case "P":
                    {
                        if (player.IsPlaying == false)
                        {
                            player.Start();
                        }
                        player.Play();
                    }
                    break;

                    case "V":
                    {
                        player.currentSkin.Render("Specify volume: ");
                        float inputAmount = Convert.ToSingle(Console.ReadLine().Replace('.', ','));
                        player.VolumeChange(inputAmount);
                    }
                    break;

                    case "Start":
                    {
                        player.Start();
                    }
                    break;

                    case "s":
                    {
                        player.Stop(player.currentPlaybackDevice);
                    }
                    break;

                    case "a":
                    {
                        player.Abort();
                    }
                    break;

                    case "Lock":
                    {
                        player.Lock();
                    }
                    break;

                    case "Unlock":
                    {
                        player.Unlock();
                    }
                    break;

                    case "Load":
                    {
                        player.currentSkin.Render("Please enter the path to desired directory");
                        string path = Console.ReadLine();
                        player.Load(path);
                    }
                    break;

                    case "Clear":
                    {
                        player.playlist.Songs.ClearAll();
                    }
                    break;

                    case "Shuffle":
                    {
                        player.playlist.Songs = player.Shuffle();
                    }
                    break;

                    case "SortT":
                    {
                        player.playlist.Songs = player.SortByTitle();
                    }
                    break;

                    case "+":
                    {
                        var input = Console.ReadLine();

                        for (int i = 0; i < player.playlist.Songs.Count; i++)
                        {
                            if (player.playlist.Songs[i].Title == input)
                            {
                                player.playlist.Songs[i].Like();
                            }
                        }
                    }
                    break;

                    case "-":
                    {
                        player.currentSkin.Render("Please specify the the title of a song in current playlist that you wish to like");
                        var input = Console.ReadLine();

                        for (int i = 0; i < player.playlist.Songs.Count; i++)
                        {
                            if (player.playlist.Songs[i].Title == input)
                            {
                                player.playlist.Songs[i].Dislike();
                            }
                        }
                    }
                    break;

                    case "SortG":
                    {
                        player.currentSkin.Render("Please specify genre");
                        string   input    = Console.ReadLine();
                        int      inputInt = 0;
                        string[] Genre    = { "PsyTrance", "Electronic", "Hardcore", "DnB", "Drumstep" };

                        for (int i = 0; i < 5; i++)
                        {
                            if (input == Genre[i])
                            {
                                inputInt = i;
                            }
                        }

                        player.playlist.Songs = player.FilterByGenre(inputInt);
                    }
                    break;

                    case "s 0":
                    {
                        var tempSkin = new ColorSkin();
                        player.currentSkin = tempSkin;
                        player.currentSkin.NewScreen();
                    }
                    break;

                    case "s 1":
                    {
                        var tempSkin = new ColorSkin(ConsoleColor.Blue);
                        player.currentSkin = tempSkin;
                        player.currentSkin.NewScreen();
                    }
                    break;

                    case "SaveP":
                    {
                        player.SaveCurrentPlaylist();
                    }
                    break;

                    case "LoadP":
                    {
                        player.LoadPlaylist();
                    }
                    break;

                    case "Exit":
                    {
                        player.Dispose();
                    }
                    break;
                    }
                }
            }
        }