Inheritance: IPackageDirectoryStructure
Exemplo n.º 1
0
        public async Task OpenHtmlPage(CancellationToken cancellationToken)
        {
            var p = packageDirectoryStructure.Package;

            PrepareInputFiles(cancellationToken);

            cancellationToken.ThrowIfCancellationRequested();

            // check if size > MaxGmeSize and split into parts if required
            var parts = Split(p);

            if (parts.Count > 1)
            {
                foreach (var i in parts)
                {
                    var structure = new PackageDirectoryStructure(Path.GetDirectoryName(this.packageDirectoryStructure.GmeFile), i);
                    var pb        = new PackageBuilder(structure, this.converter, OidSvgWriter);
                    await pb.OpenHtmlPage(cancellationToken);
                }
                return;
            }

            // write yaml
            WriteYaml();

            // write html
            WriteHtml(cancellationToken);

            // open html
            Process.Start(packageDirectoryStructure.HtmlFile);
        }
Exemplo n.º 2
0
        public async Task Build(CancellationToken cancellationToken)
        {
            var p = packageDirectoryStructure.Package;

            PrepareInputFiles(cancellationToken);

            cancellationToken.ThrowIfCancellationRequested();

            // check if size > MaxGmeSize and split into parts if required
            var parts = Split(p);

            if (parts.Count > 1)
            {
                foreach (var i in parts)
                {
                    var structure = new PackageDirectoryStructure(Path.GetDirectoryName(this.packageDirectoryStructure.GmeFile), i);
                    var pb        = new PackageBuilder(structure, this.converter, OidSvgWriter);
                    await pb.Build(cancellationToken);
                }
                return;
            }

            // write yaml
            WriteYaml();

            // write html
            WriteHtml(cancellationToken);

            cancellationToken.ThrowIfCancellationRequested();

            // create gme
            await Assemble(cancellationToken);

            log.InfoFormat("{0} was sucessfully built.", packageDirectoryStructure.GmeFile);
        }
Exemplo n.º 3
0
        public void PackageBuilderTest()
        {
            var penDirectory = TestFile("penDirectory");
            PathUtil.EnsureNotExists(penDirectory);
            PathUtil.EnsureDirectoryExists(penDirectory);
            var converter = new MediaFileConverter(TestFile("media-cache"));
            var albumReader = new AlbumReader();

            var package = Package.CreateFromInputPaths(new[] { TestFile("audio") });
            package.Albums.First().Tracks = Enumerable.Range(0, 20).Select(_ => package.Albums.First().Tracks.First()).ToArray();
            package.ProductId = 800;
                
            var structure = new PackageDirectoryStructure(penDirectory, package);
            var pb = new PackageBuilder(structure, converter);

            pb.Build(CancellationToken.None).Wait();

            Console.WriteLine(structure.GmeFile);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            log4net.Config.BasicConfigurator.Configure();

            var pen = TipToiPen.GetAll().FirstOrDefault();
            if (pen == null)
            {
                pen = TipToiPen.Simulated;
                log.InfoFormat("Pen is not attached. Output will be written to {0}", pen.RootDirectory);
            }

            var package = Package.CreateFromInputPaths(args);
    
            var cacheDirectory = Path.Combine(About.LocalApplicationDataDirectory, "cache");
            var converter = new MediaFileConverter(cacheDirectory);

            var structure = new PackageDirectoryStructure(pen.RootDirectory, package);
            var packageBuilder = new PackageBuilder(structure, converter, Settings.Read().CreateOidSvgWriter());
            packageBuilder.Build(CancellationToken.None).Wait();
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            log4net.Config.BasicConfigurator.Configure();

            var pen = TipToiPen.GetAll().FirstOrDefault();

            if (pen == null)
            {
                pen = TipToiPen.Simulated;
                log.InfoFormat("Pen is not attached. Output will be written to {0}", pen.RootDirectory);
            }

            var package = Package.CreateFromInputPaths(args);

            var cacheDirectory = Path.Combine(About.LocalApplicationDataDirectory, "cache");
            var converter      = new MediaFileConverter(cacheDirectory);

            var structure      = new PackageDirectoryStructure(pen.RootDirectory, package);
            var packageBuilder = new PackageBuilder(structure, converter, Settings.Read().CreateOidSvgWriter());

            packageBuilder.Build(CancellationToken.None).Wait();
        }
Exemplo n.º 6
0
        public async Task Build(CancellationToken cancellationToken)
        {
            var p = packageDirectoryStructure.Package;

            PrepareInputFiles(cancellationToken);

            cancellationToken.ThrowIfCancellationRequested();

            // check if size > MaxGmeSize and split into parts if required
            var parts = Split(p);
            if (parts.Count > 1)
            {
                foreach (var i in parts)
                {
                    var structure = new PackageDirectoryStructure(Path.GetDirectoryName(this.packageDirectoryStructure.GmeFile), i);
                    var pb = new PackageBuilder(structure, this.converter, OidSvgWriter);
                    await pb.Build(cancellationToken);
                }
                return;
            }

            // write yaml
            WriteYaml();

            // write html
            WriteHtml(cancellationToken);

            // open html
            Process.Start(packageDirectoryStructure.HtmlFile);

            cancellationToken.ThrowIfCancellationRequested();

            // create gme
            await Assemble(cancellationToken);

            log.InfoFormat("{0} was sucessfully built.", packageDirectoryStructure.GmeFile);
        }
Exemplo n.º 7
0
        public async Task Build(string[] mp3FilesOrDirectories)
        {
            if (!mp3FilesOrDirectories.Any())
            {
                throw new ArgumentOutOfRangeException(nameof(mp3FilesOrDirectories), String.Empty, "You must specify at least one audio file.");
            }

            var pen = TipToiPen.GetAll().FirstOrDefault();

            if (pen == null)
            {
                pen = TipToiPen.Simulated;
                log.InfoFormat("Pen is not attached. Output will be written to {0}", pen.RootDirectory);
            }

            var package = Package.CreateFromInputPaths(mp3FilesOrDirectories);

            var cacheDirectory = Path.Combine(About.Get().LocalApplicationDataDirectory, "cache");
            var converter      = new MediaFileConverter(cacheDirectory);

            var structure      = new PackageDirectoryStructure(pen.RootDirectory, package);
            var packageBuilder = new PackageBuilder(structure, converter, Settings.Read().CreateOidSvgWriter());
            await packageBuilder.Build(CancellationToken.None);
        }
Exemplo n.º 8
0
 PackageBuilder GetPackageBuilder()
 {
     var s = new PackageDirectoryStructure(GetRootDirectory(), this.document.package);
     return new PackageBuilder(s, Context.GetDefaultMediaFileConverter());
 }
Exemplo n.º 9
0
 PackageBuilder GetPackageBuilder()
 {
     var s = new PackageDirectoryStructure(GetRootDirectory(), this.document.package);
     return new PackageBuilder(s, Context.GetDefaultMediaFileConverter(), Settings.Read().CreateOidSvgWriter());
 }