From 5b73f1750ff113e9e8e1fec5b56a82d03020f77e Mon Sep 17 00:00:00 2001 From: Me on Windows Date: Sat, 27 Mar 2021 22:56:31 +0000 Subject: [PATCH] Import basic interface files --- QuickPlay/Configuration.cs | 59 ++++++++++++++++++++++++++++++++++++++ QuickPlay/Interfaces.cs | 44 ++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 QuickPlay/Configuration.cs create mode 100644 QuickPlay/Interfaces.cs diff --git a/QuickPlay/Configuration.cs b/QuickPlay/Configuration.cs new file mode 100644 index 0000000..723e4b4 --- /dev/null +++ b/QuickPlay/Configuration.cs @@ -0,0 +1,59 @@ +using System; +using System.IO; + +namespace QuickPlayer +{ + /// + /// Application (global) configuration data class + /// + class AppConfiguration + { + + } + + /// + /// Configuration of the player. + /// + /// Contains details about connection, configured songs &c. + /// + class PlayerConfiguration + { + public static PlayerConfiguration FromFile(StreamReader reader) + { + return null; // FIXME: Implement + } + } + + interface IPlayerConfigurationProvider + { + PlayerConfiguration GetConfiguration(); + } + + sealed class NetworkConfigurationProvider : IPlayerConfigurationProvider + { + + } + + sealed class FileConfigurationProvider : IPlayerConfigurationProvider + { + public readonly 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; + } +} \ No newline at end of file diff --git a/QuickPlay/Interfaces.cs b/QuickPlay/Interfaces.cs new file mode 100644 index 0000000..dd4c473 --- /dev/null +++ b/QuickPlay/Interfaces.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; + +// MPD client abstractions and simplifications +namespace QuickPlayer +{ + /// + /// Simplified abstraction of possible players. Only methods needed are included. + /// + /// That means that the interface may be extended in the future, which is sad. + /// + interface IPlayer + { + void Play(string identifier); + float CurrentProgress { get; } + bool IsReady { get; } + void SetReasonableOptions(); //TODO + } + /// + /// A simple dataclass to hold auxiliary data of the Playable objects. + /// + // This is not really an interface, but since it is a dataclass, I treat it + // more as a part of interface, so it belongs to this file. + class PlayableMetadata + { + public readonly TimeSpan usualPlayingTime; + } + + interface IPlayable + { + void Play(); + string Identifier { get; } + PlayableMetadata Metadata { get; } + } + interface ILayout + { + // TODO + } + interface ILayoutStrategy + { + ILayout LayOut(ICollection playables); + } + +} \ No newline at end of file