This repository has been archived on 2020-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
aurora-sharp-desktop/Aurora/Backend/Models/BaseSong.cs
watsonb8 a4276a0d5d Hooked up view with play button
Set up data structures for holding and playing music
2019-05-22 10:30:41 -04:00

88 lines
1.9 KiB
C#

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; }
/// <summary>
/// The title of the song.
/// </summary>
/// <value></value>
public string Title { get; set; }
/// <summary>
/// The artist of the song.
/// </summary>
/// <value></value>
public string Artist { get; set; }
/// <summary>
/// The album from which the song belongs.
/// </summary>
/// <value></value>
public string Album { get; set; }
/// <summary>
/// The duration of the song.
/// </summary>
/// <value></value>
public string Duration { get; set; }
/// <summary>
/// Extra data associated with a song.
/// </summary>
/// <value></value>
public object Metadata { get; set; }
#endregion Properties
public virtual void Load()
{
_loaded = true;
}
public virtual void Unload()
{
_loaded = false;
}
/// <summary>
/// Gets or sets the data stream that holds the song.
/// </summary>
/// <value>The data stream.</value>
public Stream DataStream
{
get
{
//if (!_loaded)
//{
// throw new InvalidOperationException("Must be loaded first");
//}
return _stream;
}
protected set
{
if (value != _stream)
{
_stream = value;
}
}
}
}
}