diff options
author | brunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-07-24 08:31:15 +0000 |
---|---|---|
committer | brunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-07-24 08:31:15 +0000 |
commit | dec577c0d954dfbbdcd03fc8b4159d8d5965e7c8 (patch) | |
tree | b48e03216d69659b10afae17cecc603946aa2269 /Game/Code/Classes | |
parent | ac12e8ff541b2d30f0b5dd070f83fc43d9b2116d (diff) | |
download | usdx-dec577c0d954dfbbdcd03fc8b4159d8d5965e7c8.tar.gz usdx-dec577c0d954dfbbdcd03fc8b4159d8d5965e7c8.tar.xz usdx-dec577c0d954dfbbdcd03fc8b4159d8d5965e7c8.zip |
- added session log
- some minor changes for medley mode
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2606 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r-- | Game/Code/Classes/ULog.pas | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 62414999..8be7a8ca 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -294,19 +294,44 @@ var Num: integer;
FileName: string;
I: integer;
+ Year, Month, Day: word;
+ Hour, Min, Sec, MSec: word;
+ timestamp: integer;
+ datestr: string;
+ timestr: string;
+
+ function Fill(w: word): string;
+ begin
+ Result := '';
+ if (w<10) then
+ Result := '0';
+
+ Result := Result + IntToStr(w);
+ end;
begin
+ timestamp := DateTimeToUnix(Now());
+ DecodeDate(UnixToDateTime(timestamp), Year, Month, Day);
+ DecodeTime(UnixToDateTime(timestamp), Hour, Min, Sec, MSec);
+
+ datestr := IntToStr(Year) + Fill(Month) + Fill(Day);
+ timestr := Fill(Hour) + Fill(Min) + Fill(Sec);
+
if not FileSessionO then
begin
FileSessionO := false;
NumSungSongs := 0;
+ FileName := SessionLogPath + 'Session_' + datestr + '-' + timestr + '.log';
- for Num := 1 to 99999 do
+ if FileExists(FileName) then
begin
- FileName := IntToStr(Num);
- while Length(FileName) < 5 do FileName := '0' + FileName;
- FileName := SessionLogPath + 'Session_' + FileName + '.log';
- if not FileExists(FileName) then break
+ for Num := 1 to 9999 do
+ begin
+ FileName := IntToStr(Num);
+ while Length(FileName) < 4 do FileName := '0' + FileName;
+ FileName := SessionLogPath + 'Session_' + datestr + '-' + timestr + '_' + FileName + '.log';
+ if not FileExists(FileName) then break
+ end;
end;
AssignFile(FileSession, FileName);
@@ -319,7 +344,8 @@ begin If (FileSessionO) then
begin
WriteLn(FileSession, 'Session Log');
- WriteLn(FileSession, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now));
+ WriteLn(FileSession, 'Date: ' + IntToStr(Year) + '-' + Fill(Month) + '-' + Fill(Day) +
+ ' Time: ' + Fill(Hour) + ':' + Fill(Min) + ':' + Fill(Sec));
Flush(FileSession);
end;
@@ -332,7 +358,8 @@ begin WriteLn(FileSession, '');
WriteLn(FileSession, '');
WriteLn(FileSession, '#----------------------------------------------------------------');
- WriteLn(FileSession, '# ' + IntToStr(NumSungSongs) + ') ' + 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now));
+ WriteLn(FileSession, '# ' + IntToStr(NumSungSongs) + ') ' + 'Date: ' + IntToStr(Year) + '-' + Fill(Month) + '-' + Fill(Day) +
+ ' Time: ' + Fill(Hour) + ':' + Fill(Min) + ':' + Fill(Sec));
WriteLn(FileSession, '# Sing mode: ' + singmode);
WriteLn(FileSession, '#----------------------------------------------------------------');
WriteLn(FileSession, '# Song: ' + Artist + ' - ' + Title + ':');
|