Introduce SongLoader class as some fields are only required while loading

Change relative to be a bool
This commit is contained in:
Flamefire committed 2013-10-11 14:50:30 +02:00
1 parent 31976ed498
commit 3c2d7dcafd
4 files changed
+516 -499

No files matched your search

+1 -1
View File
@@ -312,7 +312,7 @@ namespace Vocaluxe.Base
if (song == null)
continue;
song.ID = _Songs.Count;
if (song.ReadNotes())
if (song.LoadNotes())
_Songs.Add(song);
}
CLog.StopBenchmark(2, "Read TXTs");
+14 -7
View File
@@ -82,7 +82,7 @@ namespace VocaluxeLib.Songs
public string Folder = String.Empty;
public string FolderName = String.Empty;
public string FileName = String.Empty;
public EOffOn Relative = EOffOn.TR_CONFIG_OFF;
public bool Relative;
public string MP3FileName = String.Empty;
public string CoverFileName = String.Empty;
@@ -165,12 +165,6 @@ namespace VocaluxeLib.Songs
//No point creating a song without a text file --> Use factory method LoadSong
private CSong() {}
public static CSong LoadSong(string filePath)
{
var song = new CSong();
return song._InitPaths(filePath) && song._ReadHeader() ? song : null;
}
public CSong(CSong song)
{
_CoverTextureSmall = song._CoverTextureSmall;
@@ -236,6 +230,19 @@ namespace VocaluxeLib.Songs
Notes = new CNotes(song.Notes);
}
public static CSong LoadSong(string filePath)
{
var song = new CSong();
var loader = new CSongLoader(song);
return loader.InitPaths(filePath) && loader.ReadHeader() ? song : null;
}
public bool LoadNotes()
{
var loader = new CSongLoader(this);
return loader.ReadNotes();
}
public string GetMP3()
{
return Path.Combine(Folder, MP3FileName);
+1 -1
View File
@@ -133,7 +133,7 @@ namespace VocaluxeLib.Songs
//Maybe we have to split the previous line
while (prevLine.NoteCount > 0 && prevLine.LastNote.StartBeat >= startBeat)
{
throw new Exception("This should not happen on song loading!");
//throw new Exception("This should not happen on song loading!");
line.AddNote(prevLine.LastNote);
prevLine.DeleteNote(prevLine.NoteCount - 1);
}
File diff suppressed because it is too large. Load diff