/// <summary> /// draws the title are order list to screen /// </summary> void drawHeader() { heightPosition = displaySettings.topPageMargin; //this.Text = SongProcessor.generateFileName(currentSong); //draw title graphicsObj.DrawString(SongProcessor.generateFileName(currentSong), titleFormatter.Font, titleFormatter.Brush, displaySettings.leftPageMargin, heightPosition); //draw order heightPosition += displaySettings.TitleFormat.FontSize + displaySettings.paragraphSpacing; orderHeightPosition = heightPosition; graphicsObj.DrawString("Order: ", unSelectedOrderFormattor.Font, unSelectedOrderFormattor.Brush, displaySettings.leftPageMargin, orderHeightPosition); heightPosition += displaySettings.Order1Format.FontSize + displaySettings.paragraphSpacing; }
public void capoDown(bool?preferFlats = null) { SongProcessor.transposeKeyUp(this, preferFlats); int tempcapo = 12 + this.Capo - 1; this.Capo = tempcapo % 12; }
public void TestChordDetection() { Assert.IsTrue(SongProcessor.CheckIfChordsLine("D/F")); Assert.IsTrue(SongProcessor.CheckIfChordsLine(" A/G D/F# Dm7/F")); Assert.IsTrue(SongProcessor.CheckIfChordsLine("H")); Assert.IsFalse(SongProcessor.CheckIfChordsLine("A New Commandment")); }
public void capoDown() { SongProcessor.transposeKeyUp(this); int tempcapo = 12 + this.Capo - 1; this.Capo = tempcapo % 12; }
public void TestStringSplitOnVerseLine() { string lyrics = @"[V] Hello World".Replace("\r\n", "\n"); string expectedOutputLyrics = lyrics; int carotPosition = 1; int carrotPositionAfter = SongProcessor.BreakSongLine(ref lyrics, carotPosition); Assert.AreEqual(lyrics, expectedOutputLyrics); Assert.AreEqual(carotPosition, carrotPositionAfter); }
internal void SplitSongLine() { if (txtLyrics.Selection.Start == 0 || txtLyrics.Selection.Length() > 0) { return; } int splitPosition = txtLyrics.Selection.Start; string lyrics = txtLyrics.Text; int newPosition = SongProcessor.BreakSongLine(ref lyrics, splitPosition); txtLyrics.Text = lyrics; txtLyrics.CaretIndex = newPosition; }
static async Task Main(string[] args) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Console.OutputEncoding = Encoding.GetEncoding(932); //needed to enable moonrunes WriteWelcomeMessage(); WriteSongDescription(); int startId = RequestInt("Enter song ID to start with"); WriteCategoryDescription(); int categoryId = RequestInt("Enter category ID"); var generateMarkers = false; WriteMarkerFileDescription(); ConsoleKey markerYesNo; Console.WriteLine("Do you want to generate \"marker\" files? (y/N) "); do { markerYesNo = Console.ReadKey(true).Key; if (markerYesNo.Equals(ConsoleKey.Enter) || markerYesNo.Equals(ConsoleKey.N)) { generateMarkers = false; Console.Write("N"); Console.WriteLine(); } else if (markerYesNo.Equals(ConsoleKey.Y)) { generateMarkers = true; Console.Write("Y"); Console.WriteLine(); } } while (markerYesNo != ConsoleKey.Y && markerYesNo != ConsoleKey.Enter && markerYesNo != ConsoleKey.N); DirectoryInfo directory = RequestDirectory("Enter folder to process"); SongProcessor songProcessor = new SongProcessor(directory, startId, categoryId, generateMarkers); songProcessor.ProcessDirectory(); await Task.Delay(2000); }
public void fixFormatting() { if (!this.lyrics.Contains("[")) { var importedLyrics = Functions.ImportSong.importLyrics(this.lyrics); this.lyrics = importedLyrics; this.presentation = Functions.ImportSong.importPresentationList(importedLyrics); fixNoteOrdering(); fixLyricsOrdering(); } else if (string.IsNullOrWhiteSpace(this.presentation)) { this.presentation = Functions.ImportSong.importPresentationList(this.lyrics); } SongProcessor.fixFormatting(this); }
public void TestStringSplitOnLyricWithChordsLine() { string lyrics = @"[V] . A Hello World".Replace("\r\n", "\n"); string expectedOutputLyrics = @"[V] . Hello . A World".Replace("\r\n", "\n"); int carotPosition = 21; int carrotPositionAfter = SongProcessor.BreakSongLine(ref lyrics, carotPosition); StringAssert.StartsWith(lyrics, expectedOutputLyrics); Assert.AreEqual(25, carrotPositionAfter); }
public void TestGermanNotesTranspose() { Settings.initialize(); Settings.GlobalApplicationSettings.KeyNotationLanguage = Entities.FileAndFolderSettings.KeyNotationLanguageType.German; Entities.Song song = new Entities.Song() { lyrics = @"[V] .A .B .H .C .C# .D .D# .E .F .F# .G .G#", presentation = "V" }; SongProcessor.transposeKeyUp(song); string expectedOutput = @"[V] .B .H .C .C# .D .D# .E .F .F# .G .G# .A"; expectedOutput = expectedOutput.Replace("\r\n", "\n"); StringAssert.Equals(song.lyrics, expectedOutput); }
public void TestEnglishNotesTranspose() { Settings.initialize(); Entities.Song song = new Entities.Song() { lyrics = @"[V] .A .A# .B .C .C# .D .D# .E .F .F# .G .G#", presentation = "V" }; SongProcessor.transposeKeyUp(song); string expectedOutput = @"[V] .A# .B .C .C# .D .D# .E .F .F# .G .G# .A"; expectedOutput = expectedOutput.Replace("\r\n", "\n"); StringAssert.Equals(song.lyrics, expectedOutput); }
private static string splitLyricsOnPipeCharacter(string lyrics) { //replace the double pipe characters so we dont split on them lyrics = lyrics.Replace("||", "###DOUBLEPIPE###"); //iterate through all the pipe characters and split the lyrics lines on them int pipeIndex = -1; do { pipeIndex = lyrics.IndexOf("|"); if (pipeIndex > 0) { lyrics = lyrics.Remove(pipeIndex, 1).Insert(pipeIndex, " "); //remove the pipe SongProcessor.BreakSongLine(ref lyrics, pipeIndex + 1); //break song line in pipe position } } while (pipeIndex > 0); //restore the double pipes lyrics = lyrics.Replace("###DOUBLEPIPE###", "||"); return(lyrics); }
public void fixNoteOrdering() { SongProcessor.fixNoteOrdering(this); }
public void transposeKeyUp(bool?preferFlats = null) { preferFlats = preferFlats ?? Settings.GlobalApplicationSettings.PreferFlats; SongProcessor.transposeKeyUp(this, preferFlats); this.key = SongProcessor.transposeChord(this.key, preferFlats.Value).TrimEnd(); }
static async Task Main(string[] args) { if (args.Length < 4) { Console.WriteLine("You can also run this program with a syntax below:"); Console.WriteLine("TaikoSongProcessor startid categoryid generatemarker[yn] folder"); } Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Console.OutputEncoding = Encoding.GetEncoding(932); //needed to enable moonrunes WriteWelcomeMessage(); int startId; if (args.Length > 0) { try { startId = int.Parse(args[0]); } catch { WriteSongDescription(); startId = RequestInt("Enter song ID to start with"); } } else { WriteSongDescription(); startId = RequestInt("Enter song ID to start with"); } int categoryId; if (args.Length > 1) { try { categoryId = int.Parse(args[1]); } catch { WriteCategoryDescription(); categoryId = RequestInt("Enter category ID"); } } else { WriteCategoryDescription(); categoryId = RequestInt("Enter song ID to start with"); } bool generateMarkers = false; bool needAskGenerateMarkers = true; if (args.Length > 2) { switch (args[2]) { case "Y": case "y": case "1": generateMarkers = true; needAskGenerateMarkers = false; break; case "N": case "n": case "0": needAskGenerateMarkers = false; break; } } if (needAskGenerateMarkers) { WriteMarkerFileDescription(); ConsoleKey markerYesNo; Console.WriteLine("Do you want to generate \"marker\" files? (y/N) "); do { markerYesNo = Console.ReadKey(true).Key; if (markerYesNo.Equals(ConsoleKey.Enter) || markerYesNo.Equals(ConsoleKey.N)) { generateMarkers = false; Console.Write("N"); Console.WriteLine(); } else if (markerYesNo.Equals(ConsoleKey.Y)) { generateMarkers = true; Console.Write("Y"); Console.WriteLine(); } } while (markerYesNo != ConsoleKey.Y && markerYesNo != ConsoleKey.Enter && markerYesNo != ConsoleKey.N); } DirectoryInfo directory = null; if (args.Length > 3) { try { directory = new DirectoryInfo(args[3]); } catch { } if (!directory.Exists) { directory = null; } } if (directory == null) { directory = RequestDirectory("Enter folder to process"); } SongProcessor songProcessor = new SongProcessor(directory, startId, categoryId, generateMarkers); songProcessor.ProcessDirectory(); await Task.Delay(2000); }
public void fixLyricsOrdering() { SongProcessor.fixLyricsOrdering(this); }
public void transposeKeyUp() { SongProcessor.transposeKeyUp(this); this.key = SongProcessor.transposeChord(this.key, Settings.GlobalApplicationSettings.PreferFlats).TrimEnd(); }