2019-05-20 00:21:54 +00:00
|
|
|
|
using System;
|
2019-05-22 14:30:41 +00:00
|
|
|
|
using System.IO;
|
2019-11-04 06:43:26 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2019-05-22 14:30:41 +00:00
|
|
|
|
|
2019-07-05 18:17:09 +00:00
|
|
|
|
namespace Aurora.Models.Media
|
2019-05-19 21:25:42 +00:00
|
|
|
|
{
|
2019-05-24 14:27:19 +00:00
|
|
|
|
public abstract class BaseMedia
|
2019-05-19 21:25:42 +00:00
|
|
|
|
{
|
2019-05-22 14:30:41 +00:00
|
|
|
|
private bool _loaded;
|
|
|
|
|
private Stream _stream;
|
|
|
|
|
|
2019-05-24 14:27:19 +00:00
|
|
|
|
public BaseMedia()
|
2019-05-19 21:25:42 +00:00
|
|
|
|
{
|
2019-05-22 14:30:41 +00:00
|
|
|
|
_loaded = false;
|
2019-05-20 00:21:54 +00:00
|
|
|
|
Id = Guid.NewGuid().ToString();
|
2019-05-19 21:25:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 00:21:54 +00:00
|
|
|
|
#region Properties
|
2019-11-04 04:17:34 +00:00
|
|
|
|
public string Id { get; protected set; }
|
2019-05-20 00:21:54 +00:00
|
|
|
|
|
|
|
|
|
#endregion Properties
|
|
|
|
|
|
2019-11-04 06:43:26 +00:00
|
|
|
|
public virtual Task Load()
|
2019-05-22 14:30:41 +00:00
|
|
|
|
{
|
|
|
|
|
_loaded = true;
|
2019-11-04 06:43:26 +00:00
|
|
|
|
return Task.FromResult(default(object));
|
2019-05-22 14:30:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Unload()
|
|
|
|
|
{
|
|
|
|
|
_loaded = false;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-24 19:59:26 +00:00
|
|
|
|
public abstract MediaTypeEnum MediaType { get; }
|
|
|
|
|
|
2019-05-24 21:17:14 +00:00
|
|
|
|
public abstract BaseMetadata Metadata { get; protected set; }
|
|
|
|
|
|
2019-05-24 19:59:26 +00:00
|
|
|
|
|
2019-05-20 00:21:54 +00:00
|
|
|
|
/// <summary>
|
2019-05-22 14:30:41 +00:00
|
|
|
|
/// Gets or sets the data stream that holds the song.
|
2019-05-20 00:21:54 +00:00
|
|
|
|
/// </summary>
|
2019-05-22 14:30:41 +00:00
|
|
|
|
/// <value>The data stream.</value>
|
|
|
|
|
public Stream DataStream
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _stream;
|
|
|
|
|
}
|
|
|
|
|
protected set
|
|
|
|
|
{
|
|
|
|
|
if (value != _stream)
|
|
|
|
|
{
|
|
|
|
|
_stream = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-05-19 21:25:42 +00:00
|
|
|
|
}
|
2019-05-20 00:21:54 +00:00
|
|
|
|
}
|