using System;
using System.IO;
namespace Aurora.Backend.Models
{
public abstract class BaseSong
{
private bool _loaded;
private Stream _stream;
public BaseSong()
{
_loaded = false;
Id = Guid.NewGuid().ToString();
}
#region Properties
public string Id { get; private set; }
///
/// The title of the song.
///
///
public string Title { get; set; }
///
/// The artist of the song.
///
///
public string Artist { get; set; }
///
/// The album from which the song belongs.
///
///
public string Album { get; set; }
///
/// The duration of the song.
///
///
public string Duration { get; set; }
///
/// Extra data associated with a song.
///
///
public object Metadata { get; set; }
#endregion Properties
public virtual void Load()
{
_loaded = true;
}
public virtual void Unload()
{
_loaded = false;
}
///
/// Gets or sets the data stream that holds the song.
///
/// The data stream.
public Stream DataStream
{
get
{
//if (!_loaded)
//{
// throw new InvalidOperationException("Must be loaded first");
//}
return _stream;
}
protected set
{
if (value != _stream)
{
_stream = value;
}
}
}
}
}