|
|
@ -100,23 +100,27 @@ namespace QuickPlay
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public class PlayerConfiguration
|
|
|
|
public class PlayerConfiguration
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<IPlayable> songs;
|
|
|
|
Dictionary<string, IPlayable> songs;
|
|
|
|
|
|
|
|
string playerName;
|
|
|
|
|
|
|
|
|
|
|
|
public static PlayerConfiguration FromFile(StreamReader reader)
|
|
|
|
public static PlayerConfiguration FromFile(StreamReader reader)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var parser = new IniParser(reader);
|
|
|
|
var parser = new IniParser(reader);
|
|
|
|
var ini = parser.Parse();
|
|
|
|
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
|
|
|
|
// Two options: either general options, or song descriptions
|
|
|
|
if (key == "general")
|
|
|
|
if (elem.Key == "general")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
result.playerName = elem.Value["name"];
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Song
|
|
|
|
var song = new Song(elem.Key, elem.Value);
|
|
|
|
|
|
|
|
result.songs[elem.Key] = song;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public IPlayer GetPlayer()
|
|
|
|
public IPlayer GetPlayer()
|
|
|
@ -168,4 +172,21 @@ namespace QuickPlay
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public PlayerConfiguration GetConfiguration() => null;
|
|
|
|
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();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|