Exemple #1
0
            public async Task <Result> Handle(Command request, CancellationToken cancellationToken)
            {
                var extactor   = ExtractorFactory.GetExtraactor(request.Url);
                var chordsheet = await extactor.GetChordSheetText(request.Url);

                if (!string.IsNullOrEmpty(request.NewKey))
                {
                    var transposer = new Transposer();
                    chordsheet = await transposer.ChangeKey(chordsheet, request.NewKey, request.OriginalKey);
                }

                using (DocX document = DocX.Create(request.DestinationFilename))
                {
                    document.MarginTop    = 36f;
                    document.MarginBottom = 36f;
                    document.MarginLeft   = 36f;
                    document.MarginRight  = 36f;

                    // Add a new Paragraph to the document.
                    var p = document.InsertParagraph();

                    // Append some text.
                    p.Append(chordsheet).Font("Courier New");

                    // Save the document.
                    document.Save();
                }

                return(new Result {
                    OutputFilename = request.DestinationFilename
                });
            }
            public async Task <Result> Handle(Command request, CancellationToken cancellationToken)
            {
                var docx       = DocX.Load(request.SourceFilename);
                var paragraphs = docx.Paragraphs.Select(x => x.Text);

                var chordsheet = string.Join(Environment.NewLine, paragraphs);

                if (!string.IsNullOrEmpty(request.NewKey))
                {
                    var transposer = new Transposer();
                    chordsheet = await transposer.ChangeKey(chordsheet, request.NewKey, request.OriginalKey);
                }

                using (var document = DocX.Create(request.DestinationFilename))
                {
                    document.MarginTop    = 36f;
                    document.MarginBottom = 36f;
                    document.MarginLeft   = 36f;
                    document.MarginRight  = 36f;

                    // Add a new Paragraph to the document.
                    var p = document.InsertParagraph();

                    // Append some text.
                    p.Append(chordsheet).Font("Courier New");

                    // Save the document.
                    document.Save();
                }

                return(new Result {
                    OutputFilename = request.DestinationFilename
                });
            }
            public async Task <string> Handle(Query request, CancellationToken cancellationToken)
            {
                var extactor   = ExtractorFactory.GetExtraactor(request.Url);
                var chordsheet = await extactor.GetChordSheetText(request.Url);

                var transposer = new Transposer();

                return(await transposer.ChangeKey(chordsheet, request.NewKey));
            }
Exemple #4
0
            public async Task <string> Handle(Query request, CancellationToken cancellationToken)
            {
                var extractor = new DocxExtractor();

                var text = await extractor.GetChordSheetText(request.FilePath);

                var transposer = new Transposer();

                return(await transposer.ChangeKey(text, request.NewKey));
            }