• R/O
  • SSH
  • HTTPS

clxbackup: Commit


Commit MetaInfo

Revision3 (tree)
Zeit2015-03-27 20:53:37
Autoryamat0jp

Log Message

Zip圧縮で実用的になった

Ändern Zusammenfassung

Diff

--- trunk/Unit1.pas (revision 2)
+++ trunk/Unit1.pas (revision 3)
@@ -8,7 +8,7 @@
88 Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls,
99 Vcl.Imaging.pngimage, System.Actions, Vcl.ActnList, Vcl.Touch.GestureMgr,
1010 Vcl.FileCtrl, Vcl.Buttons, System.UITypes, System.IniFiles, System.IOUtils,
11- Vcl.ExtDlgs;
11+ Vcl.ExtDlgs, System.Zip;
1212
1313 type
1414 TForm1 = class(TForm)
@@ -32,6 +32,7 @@
3232 Label5: TLabel;
3333 Button4: TButton;
3434 OpenTextFileDialog1: TOpenTextFileDialog;
35+ CheckBox1: TCheckBox;
3536 procedure CloseButtonClick(Sender: TObject);
3637 procedure Action1Execute(Sender: TObject);
3738 procedure FormResize(Sender: TObject);
@@ -99,22 +100,39 @@
99100
100101 procedure TForm1.Button1Click(Sender: TObject);
101102 var
102- i: integer;
103103 s1, s2, s3: string;
104+ z: TZipFile;
104105 begin
105106 s3 := '';
106107 Preview(Edit1.Text + '\' + ComboBox1.Text);
107108 if Sender = Button2 then
108- for i := 0 to List.Count - 1 do
109- begin
110- s1 := List[i];
111- if s3 = '' then
112- s3 := Label1.Caption + '\' + ChangeFileExt(ExtractFileName(s1), '');
113- if System.SysUtils.DirectoryExists(s3) = False then
114- MkDir(s3);
115- s2 := s3 + '\' + ExtractFileName(s1);
116- CopyFile(System.PWideChar(s1), System.PWideChar(s2), False);
109+ begin
110+ z := TZipFile.Create;
111+ try
112+ for s1 in List do
113+ begin
114+ if s3 = '' then
115+ begin
116+ s3 := Label1.Caption + '\' + ChangeFileExt(ExtractFileName(s1), '');
117+ if CheckBox1.Checked = True then
118+ begin
119+ if FileExists(s3 + '.zip') = True then
120+ DeleteFile(s3 + '.zip');
121+ z.Open(s3 + '.zip', TZipMode.zmWrite);
122+ end
123+ else if System.SysUtils.DirectoryExists(s3) = False then
124+ MkDir(s3);
125+ end;
126+ s2 := s3 + '\' + ExtractFileName(s1);
127+ if CheckBox1.Checked = True then
128+ z.Add(s1)
129+ else
130+ CopyFile(System.PWideChar(s1), System.PWideChar(s2), False);
131+ end;
132+ finally
133+ z.Free;
117134 end;
135+ end;
118136 end;
119137
120138 procedure TForm1.Button3Click(Sender: TObject);
@@ -124,9 +142,9 @@
124142
125143 procedure TForm1.Button4Click(Sender: TObject);
126144 begin
127- if System.SysUtils.DirectoryExists(Label1.Caption) = true then
145+ if System.SysUtils.DirectoryExists(Label1.Caption) = True then
128146 begin
129- OpenTextFileDialog1.InitialDir:=Label1.Caption;
147+ OpenTextFileDialog1.InitialDir := Label1.Caption;
130148 OpenTextFileDialog1.Execute;
131149 end;
132150 end;
--- trunk/backup.dproj (revision 2)
+++ trunk/backup.dproj (revision 3)
@@ -1,7 +1,7 @@
11 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22 <PropertyGroup>
33 <ProjectGuid>{5A1633BE-0B9B-4427-8E25-24E4AC006161}</ProjectGuid>
4- <ProjectVersion>16.0</ProjectVersion>
4+ <ProjectVersion>16.1</ProjectVersion>
55 <FrameworkType>VCL</FrameworkType>
66 <MainSource>backup.dpr</MainSource>
77 <Base>True</Base>
@@ -196,7 +196,7 @@
196196 </DeployClass>
197197 <DeployClass Name="ProjectOSXEntitlements">
198198 <Platform Name="OSX32">
199- <RemoteDir>Contents</RemoteDir>
199+ <RemoteDir>../</RemoteDir>
200200 <Operation>1</Operation>
201201 </Platform>
202202 </DeployClass>
@@ -282,6 +282,7 @@
282282 </DeployClass>
283283 <DeployClass Name="ProjectiOSEntitlements">
284284 <Platform Name="iOSDevice">
285+ <RemoteDir>../</RemoteDir>
285286 <Operation>1</Operation>
286287 </Platform>
287288 </DeployClass>
Show on old repository browser