|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace QuickPlay
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Application (global) configuration data class
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Serializable]
|
|
|
|
|
sealed class AppConfiguration
|
|
|
|
|
{
|
|
|
|
|
public readonly string playerConfigUrl;
|
|
|
|
|
|
|
|
|
|
public static AppConfiguration loadSavedConfiguration()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void saveConfiguration()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Make sure that the configuration is same
|
|
|
|
|
var newConfig = AppConfiguration.loadSavedConfiguration();
|
|
|
|
|
if (this != newConfig) throw new InvalidDataException("Saved configuration is different from the supplied one.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Configuration of the player.
|
|
|
|
|
///
|
|
|
|
|
/// Contains details about connection, configured songs &c.
|
|
|
|
|
/// </summary>
|
|
|
|
|
class PlayerConfiguration
|
|
|
|
|
{
|
|
|
|
|
public static PlayerConfiguration FromFile(StreamReader reader)
|
|
|
|
|
{
|
|
|
|
|
return null; // FIXME: Implement
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface IPlayerConfigurationProvider
|
|
|
|
|
{
|
|
|
|
|
PlayerConfiguration GetConfiguration();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sealed class NetworkConfigurationProvider : IPlayerConfigurationProvider
|
|
|
|
|
{
|
|
|
|
|
PlayerConfiguration IPlayerConfigurationProvider.GetConfiguration()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sealed class FileConfigurationProvider : IPlayerConfigurationProvider
|
|
|
|
|
{
|
|
|
|
|
StreamReader reader;
|
|
|
|
|
public FileConfigurationProvider(StreamReader reader)
|
|
|
|
|
{
|
|
|
|
|
this.reader = reader;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public FileConfigurationProvider(string filename)
|
|
|
|
|
{
|
|
|
|
|
this.reader = new StreamReader(filename);
|
|
|
|
|
}
|
|
|
|
|
public PlayerConfiguration GetConfiguration()
|
|
|
|
|
{
|
|
|
|
|
return PlayerConfiguration.FromFile(reader);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sealed class DummyConfigurationProvider : IPlayerConfigurationProvider
|
|
|
|
|
{
|
|
|
|
|
public PlayerConfiguration GetConfiguration() => null;
|
|
|
|
|
}
|
|
|
|
|
}
|