From 0a97a2e46d5542532f661efeb56281aec8824b0d Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sat, 12 Oct 2013 14:50:10 +0200 Subject: [PATCH] Fix renaming of Editions etc. --- Vocaluxe.sln | 5 +---- Vocaluxe/Base/CSongSorter.cs | 6 +++--- VocaluxeLib/Songs/CSong.cs | 7 +++++-- VocaluxeLib/Songs/CSongLoader.cs | 14 ++++++++++++-- VocaluxeLib/Songs/CSongWriter.cs | 22 ++++++++++++++-------- 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/Vocaluxe.sln b/Vocaluxe.sln index d894246e..0896a6f6 100644 --- a/Vocaluxe.sln +++ b/Vocaluxe.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2012 for Windows Desktop +# Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vocaluxe", "Vocaluxe\Vocaluxe.csproj", "{2A1E0F2D-5392-4BB7-B0A1-A9DFA13E79FF}" ProjectSection(ProjectDependencies) = postProject {6F3E1874-F28A-40E9-AFBD-31934D593678} = {6F3E1874-F28A-40E9-AFBD-31934D593678} @@ -154,7 +154,4 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(Performance) = preSolution - HasPerformanceSessions = true - EndGlobalSection EndGlobal diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index 9526cedb..eefb796f 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -157,10 +157,10 @@ namespace Vocaluxe.Base switch (_SongSorting) { case ESongSorting.TR_CONFIG_EDITION: - fieldName = "Edition"; + fieldName = "Editions"; break; case ESongSorting.TR_CONFIG_GENRE: - fieldName = "Genre"; + fieldName = "Genres"; break; case ESongSorting.TR_CONFIG_FOLDER: fieldName = "FolderName"; @@ -177,7 +177,7 @@ namespace Vocaluxe.Base fieldName = "Year"; break; case ESongSorting.TR_CONFIG_LANGUAGE: - fieldName = "Language"; + fieldName = "Languages"; break; case ESongSorting.TR_CONFIG_DATEADDED: fieldName = "DateAdded"; diff --git a/VocaluxeLib/Songs/CSong.cs b/VocaluxeLib/Songs/CSong.cs index 1db59d29..b8d19405 100644 --- a/VocaluxeLib/Songs/CSong.cs +++ b/VocaluxeLib/Songs/CSong.cs @@ -117,6 +117,9 @@ namespace VocaluxeLib.Songs public string TitleSorting = String.Empty; public string ArtistSorting = String.Empty; + public string Creator = ""; + public string Version = ""; + /// /// Start of the song in s (s in txt) /// @@ -148,7 +151,7 @@ namespace VocaluxeLib.Songs get { return Notes.VoiceCount > 1; } } - public readonly List Edition = new List(); + public readonly List Editions = new List(); public readonly List Genres = new List(); public string Year = ""; @@ -227,7 +230,7 @@ namespace VocaluxeLib.Songs _CatIndex = song._CatIndex; _Selected = song._Selected; - Edition = new List(song.Edition); + Editions = new List(song.Editions); Genres = new List(song.Genres); diff --git a/VocaluxeLib/Songs/CSongLoader.cs b/VocaluxeLib/Songs/CSongLoader.cs index 5236b823..db0445b6 100644 --- a/VocaluxeLib/Songs/CSongLoader.cs +++ b/VocaluxeLib/Songs/CSongLoader.cs @@ -109,6 +109,8 @@ namespace VocaluxeLib.Songs if (pos <= 1) continue; string identifier = line.Substring(1, pos - 1).Trim().ToUpper(); + if (identifier.Contains(" ")) + continue; string value = line.Substring(pos + 1).Trim(); if (value == "") @@ -147,6 +149,12 @@ namespace VocaluxeLib.Songs case "ARTIST-ON-SORTING": _Song.ArtistSorting = value; break; + case "CREATOR": + _Song.Creator = value; + break; + case "VERSION": + _Song.Version = value; + break; case "MP3": if (File.Exists(Path.Combine(_Song.Folder, value))) { @@ -170,7 +178,7 @@ namespace VocaluxeLib.Songs break; case "EDITION": if (value.Length > 1) - _Song.Edition.Add(value); + _Song.Editions.Add(value); else _LogWarning("Invalid edition"); break; @@ -276,7 +284,7 @@ namespace VocaluxeLib.Songs if (value.ToUpper() == "YES") _Song.Relative = true; break; - case "RESULTION": + case "RESOULTION": _LogWarning("#RESOLUTION tag is outdated and ignored. Test the song to see if note timing is still correct!"); break; default: @@ -291,6 +299,8 @@ namespace VocaluxeLib.Songs _Song.Notes.VoiceNames[curPlayer] = value; } } + else + _LogWarning("Unknown tag: #" + identifier); break; } diff --git a/VocaluxeLib/Songs/CSongWriter.cs b/VocaluxeLib/Songs/CSongWriter.cs index 1daf89ff..34cbccdd 100644 --- a/VocaluxeLib/Songs/CSongWriter.cs +++ b/VocaluxeLib/Songs/CSongWriter.cs @@ -31,23 +31,29 @@ namespace VocaluxeLib.Songs private void _WriteHeaderEntry(StreamWriter sw, string id, IList value) { - if (value!=null && value.Count>0) - foreach (var val in value) + if (value != null && value.Count > 0) + { + foreach (T val in value) _WriteHeaderEntry(sw, id, val); + } } private void _WriteHeader(StreamWriter sw) { _WriteHeaderEntry(sw, "ENCODING", _Song.Encoding); + _WriteHeaderEntry(sw, "CREATOR", _Song.Creator); + _WriteHeaderEntry(sw, "VERSION", _Song.Version); + _WriteHeaderEntry(sw, "COMMENT", _Song._Comment); _WriteHeaderEntry(sw, "TITLE", _Song.Title); _WriteHeaderEntry(sw, "ARTIST", _Song.Artist); - if (!_Song.Title.Equals(_Song.TitleSorting)) _WriteHeaderEntry(sw, "TITLE-ON-SORTING", _Song.TitleSorting); - if (!_Song.Artist.Equals(_Song.ArtistSorting)) _WriteHeaderEntry(sw, "ARTIST-ON-SORTING", _Song.ArtistSorting); - _WriteHeaderEntry(sw, "LANGUAGE", _Song.Languages); - _WriteHeaderEntry(sw, "EDITION", _Song.Edition); + if (!_Song.Title.Equals(_Song.TitleSorting)) + _WriteHeaderEntry(sw, "TITLE-ON-SORTING", _Song.TitleSorting); + if (!_Song.Artist.Equals(_Song.ArtistSorting)) + _WriteHeaderEntry(sw, "ARTIST-ON-SORTING", _Song.ArtistSorting); + _WriteHeaderEntry(sw, "EDITION", _Song.Editions); _WriteHeaderEntry(sw, "GENRE", _Song.Genres); + _WriteHeaderEntry(sw, "LANGUAGE", _Song.Languages); _WriteHeaderEntry(sw, "YEAR", _Song.Year); - _WriteHeaderEntry(sw, "COMMENT", _Song._Comment); _WriteHeaderEntry(sw, "MP3", _Song.MP3FileName); _WriteHeaderEntry(sw, "COVER", _Song.CoverFileName); _WriteHeaderEntry(sw, "BACKGROUND", _Song.BackgroundFileName); @@ -60,7 +66,7 @@ namespace VocaluxeLib.Songs _WriteHeaderEntry(sw, "PREVIEWSTART", _Song.PreviewStart); _WriteHeaderEntry(sw, "START", _Song.Start); _WriteHeaderEntry(sw, "END", _Song.Finish); - if(!_Song.CalculateMedley) + if (!_Song.CalculateMedley) _WriteHeaderEntry(sw, "CALCMEDLEY", "OFF"); if (_Song.Medley.Source == EMedleySource.Tag) {