Пример #1
0
        public async Task Write_WithTestData()
        {
            var memStream = new MemoryStream();
            var writer    = new PlaylistContainerWriter(memStream);
            var progress  = Substitute.For <IProgress <(double?, string)> >();

            await writer.Write(PlaylistContainerTestData.Data, progress);

            await writer.Flush();

            memStream.Should().Equal(Resource.AsStream("test.container"));
        }
Пример #2
0
        //[Test]
        public async Task WriteTestData()
        {
            Console.WriteLine(Environment.CurrentDirectory);
            var progress = Substitute.For <IProgress <(double?, string)> >();
            var fullPath = Path.GetFullPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "test.container"));

            Console.WriteLine($"Writing test container to {fullPath}");
            using (var writer = new PlaylistContainerWriter(fullPath))
            {
                await writer.Write(PlaylistContainerTestData.Data, progress);

                await writer.Flush();
            }
        }
Пример #3
0
        private async void Export(PlaylistMetaData metaData)
        {
            Progress.Start();
            try
            {
                Progress.Report((null, "Selecting export location..."));
                var(result, path) = Dialogs.ShowSaveContainer();
                if (!result)
                {
                    Progress.Error("Exporting canceled.");
                    return;
                }

                var container = await Database.ExportPlaylist(metaData.ID, Progress);

                await PlaylistContainerWriter.Write(path, container, Progress);

                Progress.Stop();
            }
            catch (Exception e)
            {
                Progress.Error(e);
            }
        }