private static void FileSystemWatcher_Created(object sender, FileSystemEventArgs e)
        {
            if (checkForValidFile(e.FullPath))
            {
                DataManagement.FileData nFile = getAllFileInfo(e);

                Data.Files.Add(nFile);
            }
        }
        private static DataManagement.FileData getAllFileInfo(string FullPath, string Name)
        {
            DataManagement.FileData file = new DataManagement.FileData()
            {
                //name is set based on file name
                Name = Name.Remove(Name.LastIndexOf('.')),
                Path = FullPath,
            };

            TagLib.File f;
            try
            {
                f = TagLib.File.Create(FullPath);
            }
            catch
            {
                return(file);
            }

            //only set, when TagLib could load file
            var performers = f.Tag.Performers;

            if (performers.Length > 0)
            {
                file.Author = performers[0];
            }

            //only set if genres are existing
            var genres = f.Tag.Genres;

            if (genres.Length > 0)
            {
                file.Genre = genres[0];
            }

            var album = f.Tag.Album;

            if (album != null)
            {
                file.Album = album;
            }

            var length = f.Properties.Duration;

            if (length != null)
            {
                file.Length = length;
            }

            f.Dispose();
            return(file);
        }
 /// <summary>
 /// applies a filter to all properties of file (except path)
 /// </summary>
 /// <param name="file">File to search for a hit in, case does not matter</param>
 /// <param name="filterLower">Filter, must be provided in lower case</param>
 /// <returns>true, if the filter got a hit in any property</returns>
 private static bool checkForLowerMatch(DataManagement.FileData file, string filterLower)
 {
     //filter for all known attributes (ignore case)
     if (file.Name.ToLower().Contains(filterLower) || file.Author.ToLower().Contains(filterLower) ||
         file.Album.ToLower().Contains(filterLower) ||
         file.Genre.ToLower().Contains(filterLower))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }