summaryrefslogtreecommitdiff
path: root/UChecksumDruid.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2008-06-07 20:40:48 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2008-06-07 20:40:48 +0200
commita0f1e0e9db4b0edee45018c47a08761916af0ce6 (patch)
treedc9d05f5772442f61ec913631540b24cf67d5e8a /UChecksumDruid.pas
parentecde167da74c86bc047aaf84c5e548cf65a5da98 (diff)
downloadtuxcmd-a0f1e0e9db4b0edee45018c47a08761916af0ce6.tar.xz
Revised UTF-8 filenames supportv0.6.38
Diffstat (limited to 'UChecksumDruid.pas')
-rw-r--r--UChecksumDruid.pas62
1 files changed, 31 insertions, 31 deletions
diff --git a/UChecksumDruid.pas b/UChecksumDruid.pas
index 81266f6..121be80 100644
--- a/UChecksumDruid.pas
+++ b/UChecksumDruid.pas
@@ -1,21 +1,21 @@
(*
Tux Commander - UChecksumDruid - Checksum calculation druid
- Copyright (C) 2004 Tomas Bzatek <tbzatek@users.sourceforge.net>
- Check for updates on tuxcmd.sourceforge.net
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Copyright (C) 2004 Tomas Bzatek <tbzatek@users.sourceforge.net>
+ Check for updates on tuxcmd.sourceforge.net
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)
unit UChecksumDruid;
@@ -310,10 +310,10 @@ var s: string;
begin
// A simple test before we can continue
if (CurrentPage = 3) and (not SeparateFileCheckBox.Checked) and GoingForward then begin
- s := UTF8ToANSI(FileNameEntry.Text);
+ s := UTF8ToStr(FileNameEntry.Text);
i := Engine.OpenFile(s, omWrite, Error);
if Error <> 0 then begin
- Application.MessageBox(Format(LANGCCHKSUMAnErrorOccuredWhileOpeningFileSS, [ANSIToUTF8(ExtractFileName(s)), ANSIToUTF8(GetErrorString(Error))]),
+ Application.MessageBox(Format(LANGCCHKSUMAnErrorOccuredWhileOpeningFileSS, [StrToUTF8(ExtractFileName(s)), GetErrorString(Error)]),
[mbOK], mbError, mbNone, mbOK);
Exit;
end;
@@ -357,8 +357,8 @@ begin
SeparateFileCheckBox.Visible := MD5RadioButton.Checked and (FileNames.Count > 1);
FileNameEntry.Enabled := (not SeparateFileCheckBox.Checked) or (not SeparateFileCheckBox.Visible);
if FileNames.Count = 1
- then FileNameEntry.Text := ANSIToUTF8(ExtractFileName(FileNames[0]) + Ext[SFVRadioButton.Checked])
- else FileNameEntry.Text := ANSIToUTF8(DirName + Ext[SFVRadioButton.Checked]);
+ then FileNameEntry.Text := StrToUTF8(ExtractFileName(FileNames[0]) + Ext[SFVRadioButton.Checked])
+ else FileNameEntry.Text := StrToUTF8(DirName + Ext[SFVRadioButton.Checked]);
FileNameEntry.SetFocus;
FileNameEntryChanged(Self);
end;
@@ -446,17 +446,17 @@ begin
Progress.Value := 0;
Progress.Text := '0 %';
- if SFVRadioButton.Checked then WriteSFVComment(ProcessPattern(Engine, UTF8ToANSI(FileNameEntry.Text), IncludeTrailingPathDelimiter(ExtractFilePath(FileNames[0])), '', False));
+ if SFVRadioButton.Checked then WriteSFVComment(ProcessPattern(Engine, UTF8ToStr(FileNameEntry.Text), IncludeTrailingPathDelimiter(ExtractFilePath(FileNames[0])), '', False));
// Process each file
for i := 0 to FileNames.Count - 1 do begin
- ProcessingLabel.Caption := Format(LANGCCHKSUMNowProcessingFileS, [ANSIToUTF8(ExtractFileName(FileNames[i]))]);
+ ProcessingLabel.Caption := Format(LANGCCHKSUMNowProcessingFileS, [StrToUTF8(ExtractFileName(FileNames[i]))]);
LastValue := Progress.Value;
Stat := Engine.GetFileInfoSL(FileNames[i]);
Application.ProcessMessages;
try
if ProcessFile(FileNames[i], SFVRadioButton.Checked, s) then begin
if not SeparateFileCheckBox.Checked
- then s2 := ProcessPattern(Engine, UTF8ToANSI(FileNameEntry.Text), IncludeTrailingPathDelimiter(ExtractFilePath(FileNames[0])), '', False)
+ then s2 := ProcessPattern(Engine, StrToUTF8(FileNameEntry.Text), IncludeTrailingPathDelimiter(ExtractFilePath(FileNames[0])), '', False)
else s2 := IncludeTrailingPathDelimiter(ExtractFilePath(FileNames[i])) + ExtractFileName(FileNames[i]) + Ext[SFVRadioButton.Checked];
WriteLine(s2, FileNames[i], s, SFVRadioButton.Checked, ((i = 0) and MD5RadioButton.Checked) or SeparateFileCheckBox.Checked,
(i = FileNames.Count - 1) or SeparateFileCheckBox.Checked);
@@ -500,13 +500,13 @@ begin
FD := Engine.OpenFile(FName, omRead, Error);
if Error <> 0 then begin
- ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileOpeningFileSS, [ANSIToUTF8(ExtractFileName(FName)), ANSIToUTF8(GetErrorString(Error))]);
+ ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileOpeningFileSS, [StrToUTF8(ExtractFileName(FName)), GetErrorString(Error)]);
Exit;
end;
repeat
Count := Engine.ReadFile(FD, Buffer, ChksumBlockSize, Error);
if Error <> 0 then begin
- ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileReadingFileSS, [ANSIToUTF8(ExtractFileName(FName)), ANSIToUTF8(GetErrorString(Error))]);
+ ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileReadingFileSS, [StrToUTF8(ExtractFileName(FName)), GetErrorString(Error)]);
Engine.CloseFile(FD);
Exit;
end;
@@ -538,7 +538,7 @@ begin
if CreateFile then begin
FileDes := Engine.OpenFile(FName, omWrite, Error);
if Error <> 0 then begin
- ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileOpeningFileSS, [ANSIToUTF8(ExtractFileName(FName)), ANSIToUTF8(GetErrorString(Error))]);
+ ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileOpeningFileSS, [StrToUTF8(ExtractFileName(FName)), GetErrorString(Error)]);
Exit;
end;
try
@@ -552,14 +552,14 @@ begin
end;
if Buffer = nil then Exit;
- if IsItSFV then s := Format('%s %s'#13#10, [ExtractFileName(CheckedFName), Trim(ANSIUpperCase(HashString))])
+ if IsItSFV then s := Format('%s %s'#13#10, [ExtractFileName(CheckedFName), Trim(WideUpperCase(HashString))])
else s := Format('%s %s'#10, [Trim(AnsiLowerCase(HashString)), ExtractFileName(CheckedFName)]);
for i := 1 to Length(s) do begin
if BufferPos + 1 >= ChksumBlockSize then begin
Count := Engine.WriteFile(FileDes, Buffer, ChksumBlockSize, Error);
BufferPos := -1;
if (Error <> 0) or (Count <> ChksumBlockSize) then begin
- ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileWritingFileSS, [ANSIToUTF8(ExtractFileName(FName)), ANSIToUTF8(GetErrorString(Error))]);
+ ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileWritingFileSS, [StrToUTF8(ExtractFileName(FName)), GetErrorString(Error)]);
Exit;
end;
end;
@@ -571,7 +571,7 @@ begin
Inc(BufferPos); // Counting with zero-starting element
Count := Engine.WriteFile(FileDes, Buffer, BufferPos, Error);
if (Error <> 0) or (Count <> BufferPos) then begin
- ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileWritingFileSS, [ANSIToUTF8(ExtractFileName(FName)), ANSIToUTF8(GetErrorString(Error))]);
+ ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileWritingFileSS, [StrToUTF8(ExtractFileName(FName)), GetErrorString(Error)]);
Exit;
end;
BufferPos := -1;
@@ -587,7 +587,7 @@ var i, Error, Count: integer;
begin
FileDes := Engine.OpenFile(FName, omWrite, Error);
if Error <> 0 then begin
- ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileOpeningFileSS, [ANSIToUTF8(ExtractFileName(FName)), ANSIToUTF8(GetErrorString(Error))]);
+ ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileOpeningFileSS, [StrToUTF8(ExtractFileName(FName)), GetErrorString(Error)]);
Exit;
end;
try
@@ -615,7 +615,7 @@ begin
Count := Engine.WriteFile(FileDes, Buffer, ChksumBlockSize, Error);
BufferPos := -1;
if (Error <> 0) or (Count <> ChksumBlockSize) then begin
- ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileWritingFileSS, [ANSIToUTF8(ExtractFileName(FName)), ANSIToUTF8(GetErrorString(Error))]);
+ ErrorLabel.Caption := ErrorLabel.Caption + Format(LANGCCHKSUMAnErrorOccuredWhileWritingFileSS, [StrToUTF8(ExtractFileName(FName)), GetErrorString(Error)]);
Exit;
end;
end;