예제 #1
0
 public ArrayList GetAlbums()
 {
     lock (_albumlock) {
       ArrayList albums = new ArrayList();
       foreach (string setid in OrderedSetsList.Split(',')) {
         Album a = GetAlbum(setid);
         if (a != null) albums.Add(a);
       }
       // Now check for those albums which are not present in the ordered list.
       IDbConnection dbcon = (IDbConnection) new SqliteConnection(DB_PATH);
       dbcon.Open();
       IDbCommand dbcmd = dbcon.CreateCommand();
       dbcmd.CommandText = "select * from album;";
       IDataReader reader = dbcmd.ExecuteReader();
       while(reader.Read()) {
     string setid = reader.GetString(0);
     string title = reader.GetString(1);
     string desc = reader.GetString(2);
     string photoid = reader.GetString(3);
     Album album = new Album(setid, title, desc, photoid);
     bool ispresent = false;
     foreach (Album a in albums) {
       if (album.IsEqual(a)) ispresent = true;
     }
     if (!ispresent) albums.Add(album);
       }
        // clean up
       reader.Close();
       dbcmd.Dispose();
       dbcon.Close();
       return albums;
       }
 }