Beispiel #1
0
        private static void Main()
        {
            IMediaLibrary mediaLibrary = new MediaLibrary(new Player());

            IPlaylist <IFile> playlist = new Playlist <IFile>("MyPlaylist");

            IFile mediaFile1 = new Photo("png", "Photo01", 1000000, @"D:\Photos", "1920x1080", 1920, 1080);
            IFile mediaFile2 = new Photo("png", "Photo02", 2000000, @"D:\Photos", "1920x1080", 1920, 1080);
            IFile mediaFile3 = new Photo("png", "Photo03", 3000000, @"D:\Photos", "1920x1080", 1920, 1080);

            IFile mediaFile4 = new Music("mp3", "Music01", 5000000, @"D:\Music", 320, 192000000, "3:00", "Rap", "playingtheangel", "MAGNUM OPUS", "Frisson", "2017");
            IFile mediaFile5 = new Music("mp3", "Music02", 6000000, @"D:\Music", 320, 192000000, "4:00", "Heavy Metal", "In Flames", "Come Clarity", "Come Clarity", "2006");
            IFile mediaFile6 = new Music("mp3", "Music03", 7000000, @"D:\Music", 320, 192000000, "5:00", "Dubstep", "Skrillex", "Recess", "F**k That", "2014");

            IFile mediaFile7 = new Video("mp4", "Video01", 15000000, @"D:\Videos", 320, 192000000, "3:00", 1920, 1080, 60);
            IFile mediaFile8 = new Video("mp4", "Video02", 16000000, @"D:\Videos", 320, 192000000, "4:00", 1280, 720, 59);
            IFile mediaFile9 = new Video("mp4", "Video03", 17000000, @"D:\Videos", 320, 192000000, "5:00", 1680, 1050, 30);

            // Photo
            playlist.AddFile(mediaFile1);
            playlist.AddFile(mediaFile2);
            playlist.AddFile(mediaFile3);

            // Music
            playlist.AddFile(mediaFile4);
            playlist.AddFile(mediaFile5);
            playlist.AddFile(mediaFile6);

            // Videos
            playlist.AddFile(mediaFile7);
            playlist.AddFile(mediaFile8);
            playlist.AddFile(mediaFile9);

            mediaLibrary.PlayPlaylist(playlist);

            Console.ReadKey();
        }
Beispiel #2
0
    public static void InsertFile(string dir, GameObject dropObj, GameObject reference)
    {
        // Get reference to playlist object
        Playlist pl = GameObject.Find("PlaylistContent").GetComponent <Playlist> ();

        // Get file object if available
        FileObj file = pl.GetFile(dir);

        // Get playlist object
        PlaylistObj playlist = null;

        if (reference != dropObj)
        {
            playlist = pl.FindPlaylist(reference);
        }
        else if (pl.Playlists.Count == 0 || Settings.Selected.Playlist == null)
        {
            pl.fileToAdd = new FileObj(dir);
        }
        else if (Settings.Selected.Playlist != null)
        {
            playlist = Settings.Selected.Playlist;
        }

        // Add file to selected playlist
        if (playlist != null)
        {
            if (file == null)
            {
                file = new FileObj(dir);
            }

            // Add file and show playlist
            long added = pl.AddFile(file, playlist);

            // Get dialog
            Dialog dialog = GameObject.Find("Dialog").GetComponent <Dialog> ();

            switch (added)
            {
            // Playlist already contains file
            case (long)Database.Constants.DuplicateFound:

                dialog.ShowDialog(
                    "Lied bereits vorhanden",
                    "Das ausgewählte Lied ist in der Playlist \"" + playlist.Name + "\" bereits vorhanden."
                    );
                break;

            // Query failed
            case (long)Database.Constants.QueryFailed:

                dialog.ShowDialog(
                    "Fehler",
                    "Das ausgewählte Lied konnte nicht zur Playlist \"" + playlist.Name + "\" hinzugefügt werden."
                    );
                break;

            default:
                // Toggle files
                pl.togglePlaylist = playlist;
                break;
            }
        }
    }