Exemplo n.º 1
0
 /// <summary>
 /// Creates a new Track instance filled with the values found in the specified record.
 /// </summary>
 /// <param name="row">The record containing the track information</param>
 public Track(Record row)
 {
     Title = GetStringValue(row, MetadataField.Title);
     Album = GetStringValue(row, MetadataField.Album);
     Artist = GetStringValue(row, MetadataField.Artist);
     AlbumArtist = GetStringValue(row, MetadataField.AlbumArtist);
     PlayCount = GetIntValue(row, MetadataField.PlayCount, 0);
     Rating = GetIntValue(row, MetadataField.Rating);
 }
Exemplo n.º 2
0
        private int GetIntValue(Record row, MetadataField fieldType, int defaultValue)
        {
            int? val = GetIntValue(row, fieldType);
            if (val.HasValue)
                return val.Value;

            return defaultValue;
        }
Exemplo n.º 3
0
 private string GetStringValue(Record row, MetadataField fieldType)
 {
     StringField field = (StringField) row.GetFieldByType(fieldType);
     if (field != null)
         return field.Value;
     return null;
 }
Exemplo n.º 4
0
 private int? GetIntValue(Record row, MetadataField fieldType)
 {
     IntegerField field = (IntegerField) row.GetFieldByType(fieldType);
     if (field != null)
         return field.Value;
     return null;
 }