diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-09-28 16:30:08 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-09-28 16:30:08 +0000 |
commit | e5222f99929e0a893fca4ea0ffe08c3bb90fd5c3 (patch) | |
tree | a3ceca35a36e2cef8231f1736b6c709a3baf0313 /src/base | |
parent | d2a4f49752a55a3ecb475eb0a72ffb43c3706a84 (diff) | |
download | usdx-e5222f99929e0a893fca4ea0ffe08c3bb90fd5c3.tar.gz usdx-e5222f99929e0a893fca4ea0ffe08c3bb90fd5c3.tar.xz usdx-e5222f99929e0a893fca4ea0ffe08c3bb90fd5c3.zip |
Songclass now reports an error if there is no linebreak in a txt file. Error is written to log.
Added detailed error description to ERROR_CORRUPT_SONG Popup. Some translation may be added to this one
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1423 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | src/base/USong.pas | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/base/USong.pas b/src/base/USong.pas index 0f36662b..3679863b 100644 --- a/src/base/USong.pas +++ b/src/base/USong.pas @@ -129,6 +129,8 @@ type Mult : integer; MultBPM : integer; + LastError: String; + constructor Create (); overload; constructor Create ( const aFileName : WideString ); overload; function LoadSong: boolean; @@ -159,6 +161,8 @@ begin MultBPM := 4; fFileName := aFileName; + LastError := ''; + if fileexists( aFileName ) then begin self.Path := ExtractFilePath( aFileName ); @@ -195,9 +199,11 @@ var begin Result := false; + LastError := ''; if not FileExists(Path + PathDelim + FileName) then begin + LastError := 'File not found'; Log.LogError('File not found: "' + Path + PathDelim + FileName + '"', 'TSong.LoadSong()'); exit; end; @@ -240,7 +246,7 @@ begin begin //Song File Corrupted - No Notes CloseFile(SongFile); Log.LogError('Could not load txt File, no Notes found: ' + FileName); - Result := False; + LastError := 'Can''t find any notes'; Exit; end; Read(SongFile, TempC); @@ -361,6 +367,16 @@ begin end; CloseFile(SongFile); + + For I := 0 to High(Lines) do + begin + If ((Both) or (I = 0)) AND (Length(Lines[I].Line) < 2) then + begin + LastError := 'Can''t find any linebreaks'; + Log.LogError('Error Loading File, Can''t find any Linebreaks: "' + fFileName + '"'); + exit; + end; + end; except try CloseFile(SongFile); @@ -368,6 +384,7 @@ begin end; + LastError := 'Error reading line ' + inttostr(FileLineNo); Log.LogError('Error Loading File: "' + fFileName + '" in Line ' + inttostr(FileLineNo)); exit; end; |