|
|
|
@ -100,23 +100,27 @@ namespace QuickPlay
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class PlayerConfiguration
|
|
|
|
|
{
|
|
|
|
|
List<IPlayable> songs;
|
|
|
|
|
Dictionary<string, IPlayable> songs;
|
|
|
|
|
string playerName;
|
|
|
|
|
|
|
|
|
|
public static PlayerConfiguration FromFile(StreamReader reader)
|
|
|
|
|
{
|
|
|
|
|
var parser = new IniParser(reader);
|
|
|
|
|
var ini = parser.Parse();
|
|
|
|
|
foreach (string key in ini.Keys)
|
|
|
|
|
var result = new PlayerConfiguration();
|
|
|
|
|
foreach (var elem in ini)
|
|
|
|
|
{
|
|
|
|
|
// Two options: either general options, or song descriptions
|
|
|
|
|
if (key == "general")
|
|
|
|
|
if (elem.Key == "general")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
result.playerName = elem.Value["name"];
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
// Song
|
|
|
|
|
var song = new Song(elem.Key, elem.Value);
|
|
|
|
|
result.songs[elem.Key] = song;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IPlayer GetPlayer()
|
|
|
|
@ -168,4 +172,21 @@ namespace QuickPlay
|
|
|
|
|
{
|
|
|
|
|
public PlayerConfiguration GetConfiguration() => null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Song: IPlayable
|
|
|
|
|
{
|
|
|
|
|
public string Identifier { get; private set; }
|
|
|
|
|
public PlayableMetadata Metadata { get; private set; }
|
|
|
|
|
public Song(string id, Dictionary<string, string> data) {
|
|
|
|
|
Identifier = id;
|
|
|
|
|
Metadata = new PlayableMetadata
|
|
|
|
|
{
|
|
|
|
|
usualPlayingTime = TimeSpan.Parse(data["time"])
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
public void Play()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|