Ejemplo n.º 1
0
 public int Compare(Song one, Song two)
 {
     if (one.Title.ToLower () == two.Title.ToLower ())
     {
     if (one.Filename == two.Filename)
     return 0;
     } else {
     if (one.Filename == two.Filename)
     return 0;
     }
     return one.Filename.CompareTo (two.Filename);
 }
Ejemplo n.º 2
0
 public int Compare(Song one, Song two)
 {
     return new SimpleSongComparer ().Compare(one, two);
 }
Ejemplo n.º 3
0
 public abstract bool RemoveSong(Song song);
Ejemplo n.º 4
0
 public abstract bool AddSong(Song song);
Ejemplo n.º 5
0
 public bool RemoveSong(Song song)
 {
     SqliteCommand cmd = new SqliteCommand ();
     cmd.Connection = conn;
     cmd.CommandText = String.Format ("REMOVE FROM songs WHERE id = {0}", song.GetHashCode ());
     int res = cmd.ExecuteNonQuery ();
     if (res > 0)
     return true;
     return false;
 }
Ejemplo n.º 6
0
        public bool AddSong(Song song)
        {
            string artists = ArrayToSqlString (song.Artists);
            string performers = ArrayToSqlString (song.Performers);

            SqliteCommand cmd = new SqliteCommand ();
            cmd.Connection = conn;
            cmd.CommandText = String.Format ("INSERT INTO songs (id, filename, title, artists, performers, album, tracknumber, year, duration, mtime, gain) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}')",
                        song.GetHashCode (),
                        song.Filename,
                        song.Title,
                        artists,
                        performers,
                        song.Album,
                        song.TrackNumber,
                        song.Year,
                        song.Duration,
                        song.MTime,
                        song.Gain);
            int res = cmd.ExecuteNonQuery ();
            if (res > 0)
            return true;
            return false;
        }