Файловая оболочка (Delphi 30 )
Case tmpinteger of
1 : LFileList.Caption:=FL1;
2 : LFileList.Caption:=FL2;
3 : LFileList.Caption:=FL3;
end; //Case
end;
end;
Procedure WriteIniOptions;
// Запись параметров в ини файл
begin
with MCIni do
begin
WriteBool('Options','AskOnExit',OptionsForm.AskOnExit.Checked);
WriteBool('Options','StatusBar',OptionsForm.CStatusBar.Checked);
Case MainForm.FileList.Columns of
1 : WriteInteger('Options','FileListColumns',1);
2 : WriteInteger('Options','FileListColumns',2);
3 : WriteInteger('Options','FileListColumns',3);
end; //case
end;
end;
Procedure UpdateMC;
// Обновление интерфейсных параметров программы
begin
if OptionsForm.AskOnExit.Checked then AskExit:=True
else AskExit:=False;
If OptionsForm.CStatusBar.Checked then MainForm.StatusBar.Visible:=True
else MainForm.StatusBar.Visible:=False;
if OptionsForm.LFilelist.Caption=FL1 then
begin
MainForm.FileList.Columns:=1;
MainForm.FileList.Update;
end;
if OptionsForm.LFilelist.Caption=FL2 then
begin
MainForm.FileList.Columns:=2;
MainForm.FileList.Update;
end;
if OptionsForm.LFilelist.Caption=FL3 then
begin
MainForm.FileList.Columns:=3;
MainForm.FileList.Update;
end;
end;
Procedure SetUpMainForm;
begin
//Подключение файла параметров
MCIni:=TIniFile.Create('MC.Ini');
ReadIniMainForm;
end;
Procedure ReadIniMainForm;
begin
with MainForm do
begin
Top:=MCIni.ReadInteger('ASWindow','Top',100);
Left:=MCIni.ReadInteger('ASWindow','Left',100);
Height:=MCIni.ReadInteger('ASWindow','Height',100);
Width:=MCIni.ReadInteger('ASWindow','Width',100);
Directory.Width:=McIni.ReadInteger('ASWindow','Splitter',100);
end;
end;
Procedure SaveIniMainForm;
begin
if MainForm.Top<>-4 then
begin
MCIni.WriteInteger('ASWindow','Top',MainForm.Top);
MCIni.WriteInteger('ASWindow','Left',MainForm.Left);
MCIni.WriteInteger('ASWindow','Width',MainForm.Width);
MCIni.WriteInteger('ASWindow','Height',MainForm.Height);
end;
end;
Function FloatToInt(x:real):integer;
begin
FloatToInt:=StrToInt(FloatToStr(Int(X)));
end;
Procedure GetFormToCenter(Form:TForm);
begin
Form.Top:=FloatToInt(MainForm.Top+MainForm.Height/2-Form.Height/2);
Form.Left:=FloatToInt(MainForm.Left+MainForm.Width/2-Form.Width/2);
end;
Function FormatSize(S:String):String;
// перевод целого числа в читабельный формат (для размеров файлов / директорий)
Var
i,j,n:integer;
Tmp,Temp:String;
begin
Tmp:='';
for i:=Length(S) downto 1 do
tmp:=tmp+S[i];
n:=0;
for i:=1 to Length(tmp) do
begin
if n=3 then
begin
n:=0;
Temp:=Temp+',';
end;
Temp:=Temp+Tmp[i];
n:=n+1;
end;
Tmp:='';
for i:=Length(Temp) downto 1 do
Tmp:=Tmp+Temp[i];
FormatSize:=Tmp;
end;
end.
unit UNotTrivial; //Вспамагательный модуль программы
interface
Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons;
Var
IndexDelDir:integer;
CurDeleteDir:string;
Yes,No,All:boolean;
SourseDir:String;
DestinationDir:String;
IndexDeleteDirectory:integer;
Procedure DelOneFile(dFile:string;Flag:boolean);
Procedure DelNotEmptyDirectory(Dir:String);
Procedure PasteDirectory(SDir,DDir:string);
Procedure CreateDirInDestin(S,D:string);
Procedure SortCMDirList;
implementation
Uses
UMainForm, UMainForm_, UDeleteDir, DirOutLn, UAskDeleteCurrentFile,
FMXUtils,UProgressForm;
Procedure DelNotEmptyDirectory(Dir:string);
//Удаление не пустой директории
Var
i:integer;
Max:integer;
EndFor:integer;
begin
//Создание временных списков
GreateCopyMoveDirList(dir);
//Удаление файлов из всех поддиректорий
For i:=0 to MainForm.CMFileList.Items.Count-1 do
begin
DelOneFile(MainForm.CMFileList.Items[i],True);
FDeleteDir.Label1.Visible:=False;
FDeleteDir.LDir.Caption:='File '+MainForm.CMFileList.Items[i]+' is now deleting';
FdeleteDir.Update;