Пример #1
0
 private void SaveIntoDatabase() //non qua, è un metodo generale, non riferito esclusivamente a echomanager
 {
     try
     {
         database.SaveChanges();
     }
     catch (System.Data.UpdateException ue)
     {
         database.DeleteObject(ue.StateEntries[0].Entity);
         return;
     }
 }
Пример #2
0
        private Song CreateFromOldId3Standard(String filename)
        {
            ReadingResult result = ReadingResult.Failure;

            try
            {
                result = id3v1.Read(filename);
            }
            catch
            {
                return(null);
            }

            if (result != Tagger.ReadingResult.Success)
            {
                return(null);
            }

            this.sizeId3v1 = id3v1.Size;

            Genre genre;

            this.LookForGenre(out genre);

            String songTitle = string.IsNullOrEmpty(id3v1.Title) ? GuessSongName(filename) : id3v1.Title;
            Song   song      = database.Song.FindByName(songTitle);

            song.Filename = filename;
            song.Genre    = genre;

            this.LookForArtist(song);
            //this.LookForGenre(song);
            this.LookForAlbum(song);

            try
            {
                database.SaveChanges();
            }
            catch (System.Data.UpdateException ue)
            {
                //IMedia imedia = ((Song)ue.StateEntries[0].Entity);
                database.DeleteObject(ue.StateEntries[0].Entity);

                return(null);
            }

            return(song);
        }