Added base classes to encapsulate metadata in media
This commit is contained in:
54
Aurora/Backend/Models/Media/BaseMedia.cs
Normal file
54
Aurora/Backend/Models/Media/BaseMedia.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Aurora.Backend.Models.Media
|
||||
{
|
||||
public abstract class BaseMedia
|
||||
{
|
||||
private bool _loaded;
|
||||
private Stream _stream;
|
||||
|
||||
public BaseMedia()
|
||||
{
|
||||
_loaded = false;
|
||||
Id = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
#region Properties
|
||||
public string Id { get; private set; }
|
||||
|
||||
#endregion Properties
|
||||
|
||||
public virtual void Load()
|
||||
{
|
||||
_loaded = true;
|
||||
}
|
||||
|
||||
public virtual void Unload()
|
||||
{
|
||||
_loaded = false;
|
||||
}
|
||||
|
||||
public abstract MediaTypeEnum MediaType { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the data stream that holds the song.
|
||||
/// </summary>
|
||||
/// <value>The data stream.</value>
|
||||
public Stream DataStream
|
||||
{
|
||||
get
|
||||
{
|
||||
return _stream;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
if (value != _stream)
|
||||
{
|
||||
_stream = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user