Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using NAudio.Wave;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- namespace MuiscPlayer
- {
- public class ZeneClass1
- {
- public string FileName { get; set; }
- public string FilePath { get; set; }
- public ZeneClass1(string fileName, string filePath)
- {
- FileName = fileName;
- FilePath = filePath;
- }
- public override string ToString()
- {
- return FileName; // megjelenítse a zene címét
- }
- public static void LoadSongsFromFolder(string folderPath, List<ZeneClass1> songs)
- {
- try
- {
- List<string> mp3Files = Directory.GetFiles(folderPath, "*.mp3", SearchOption.TopDirectoryOnly).ToList();
- foreach (string file in mp3Files)
- {
- string fileName = Path.GetFileName(file);
- songs.Add(new ZeneClass1(fileName, file));
- }
- }
- catch (Exception)
- {
- throw new Exception("Üres mappa!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment