|
|
@ -104,6 +104,11 @@ namespace QuickPlay
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#pragma warning restore CS0659
|
|
|
|
#pragma warning restore CS0659
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public enum PlayerType
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MPD,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Configuration of the player.
|
|
|
|
/// Configuration of the player.
|
|
|
|
///
|
|
|
|
///
|
|
|
@ -111,8 +116,10 @@ namespace QuickPlay
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public class PlayerConfiguration
|
|
|
|
public class PlayerConfiguration
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Dictionary<string, IPlayable> songs;
|
|
|
|
public Dictionary<string, IPlayable> songs;
|
|
|
|
string playerName;
|
|
|
|
public string playerName;
|
|
|
|
|
|
|
|
public PlayerType playerType;
|
|
|
|
|
|
|
|
public string playerConnectionDetails; // This is opaque to this class, the player will make sense of it.
|
|
|
|
|
|
|
|
|
|
|
|
public static PlayerConfiguration FromFile(StreamReader reader)
|
|
|
|
public static PlayerConfiguration FromFile(StreamReader reader)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -125,6 +132,8 @@ namespace QuickPlay
|
|
|
|
if (elem.Key == "general")
|
|
|
|
if (elem.Key == "general")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
result.playerName = elem.Value["name"];
|
|
|
|
result.playerName = elem.Value["name"];
|
|
|
|
|
|
|
|
result.playerType = PlayerType.MPD; //FIXME: not always.
|
|
|
|
|
|
|
|
result.playerConnectionDetails = elem.Value["connection"];
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var song = new Song(elem.Key, elem.Value);
|
|
|
|
var song = new Song(elem.Key, elem.Value);
|
|
|
@ -136,7 +145,16 @@ namespace QuickPlay
|
|
|
|
|
|
|
|
|
|
|
|
public IPlayer GetPlayer()
|
|
|
|
public IPlayer GetPlayer()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
IPlayer result;
|
|
|
|
|
|
|
|
switch (playerType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case PlayerType.MPD:
|
|
|
|
|
|
|
|
result = new MpdPlayer(this);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
throw new InvalidOperationException("Cannot happen: Player had no type.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|