Ejemplo n.º 1
0
 public MockPlayer(MockPlayerState playerState, MockNowPlaying nowPlaying)
 {
     position       = 0;
     duration       = (int)Math.Round(4.6 * 60) * 1000;
     _playerState   = playerState;
     _nowPlaying    = nowPlaying;
     timer          = new Timer(1000);
     timer.Elapsed += (sender, args) => { position += 1000; };
 }
Ejemplo n.º 2
0
        /// <summary>
        /// The main function of the the tester program.
        /// </summary>
        public static void Main()
        {
            var playerState = new MockPlayerState();
            var nowPlaying  = new MockNowPlaying();
            var player      = new MockPlayer(playerState, nowPlaying);
            var library     = new MockLibrary();

            var libraryApiAdapter    = new LibraryApiAdapter(library);
            var nowPlayingApiAdapter = new NowPlayingApiAdapter(nowPlaying, player);
            var outputApiAdapter     = new MockOutputApiAdapter();
            var playerApiAdapter     = new MockPlayerApiAdapter(playerState, player);
            var queueAdapter         = new QueueAdapter();
            var trackApiAdapter      = new TrackApiAdapter(player);
            var baseStoragePath      = Path.GetTempPath();

            var dependencies = new MusicBeeDependencies(
                libraryApiAdapter,
                nowPlayingApiAdapter,
                outputApiAdapter,
                playerApiAdapter,
                queueAdapter,
                trackApiAdapter,
                null,
                baseStoragePath,
                "1.0.0");

            var remoteBootstrap      = new RemoteBootstrap();
            var musicBeeRemotePlugin = remoteBootstrap.BootStrap(dependencies);

            musicBeeRemotePlugin.Start();

            while (true)
            {
                Console.WriteLine(Resources.Input);
                var line = Console.ReadLine();
                if (line != "q!")
                {
                    continue;
                }

                musicBeeRemotePlugin.Terminate();
                remoteBootstrap.Dispose();
                Console.WriteLine(Resources.Quitting);
                break;
            }
        }