unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IDGLobal, GIFImg, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
Edit1: TEdit;
Label1: TLabel;
Image1: TImage;
Button1: TButton;
Image2: TImage;
Label2: TLabel;
Edit2: TEdit;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
path:
String;
destPath: TStrings;
implementation
{$R *.dfm}
uses Registry, ShellAPI;
function DoFileWork(
aWnd: HWND; aOperation: UINT; aFrom, aTo: TStrings; aFlags: FILEOP_FLAGS
): Integer;
var
I: Integer;
FromPath, ToPath:
string;
SHFileOpStruct: TSHFileOpStruct;
begin
FromPath := '
';
for I := 0
to aFrom.Count - 1
do
FromPath := FromPath + aFrom.Strings[I] + #0;
FromPath := FromPath + #0;
if Assigned(aTo)
then
begin
ToPath := '
';
for I := 0
to aTo.Count - 1
do
ToPath := ToPath + aTo.Strings[I] + #0;
ToPath := ToPath + #0;
if aTo.Count > 0
then
aFlags := aFlags
or FOF_MULTIDESTFILES;
end;
with SHFileOpStruct
do
begin
Wnd := aWnd;
wFunc := aOperation;
pFrom := PChar(FromPath);
if Assigned(aTo)
then
begin
pTo := PChar(ToPath)
end else begin
pTo :=
nil;
end;
fFlags := aFlags;
end;
Result := SHFileOperation(SHFileOpStruct);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
steamname:
string;
regist: TRegistry;
begin
regist := TRegistry.Create();
try
regist.RootKey := HKEY_LOCAL_MACHINE;
regist.OpenKey('
Software\Valve\Steam', true);
path := regist.ReadString('
InstallPath');
finally
regist.Free;
end;
steamname := Edit1.Text;
if steamname = '
'
then
begin
ShowMessage('
Steamname ist leer');
Exit;
end;
Edit2.Text := path + '
\SteamApps\' + steamname +
'
\counter-strike source\cstrike';
DestPath.Add(Edit2.Text);
Image1.Visible := false;
Image2.Visible := true;
end;
procedure TForm1.Button2Click(Sender: TObject);
var rootPath : TStrings; preRootPath :
string;
begin
path := Edit2.Text;
if MessageDlg(
'
Configdatein wirklich übertragen. Bereits vorhandene Daten werden überschrieben'
, mtConfirmation, mbYesNo, 0) = mrYes
then
begin
preRootPath := ParamStr(0) + '
\install\maps';
rootPath.Add(preRootPath);
DoFileWork(Self.Handle, FO_MOVE, rootPath, destPath,FOF_NOCONFIRMATION );
rootPath.Free;
destPath.Free;
end;
end;
end.