-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fjointure_Unit.pas
100 lines (82 loc) · 2.23 KB
/
Fjointure_Unit.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
unit Fjointure_Unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxGDIPlusClasses, ExtCtrls, StdCtrls, ExtDlgs, Buttons, acPNG,
System.ImageList, Vcl.ImgList;
type
TFjointure = class(TForm)
Image1: TImage;
Button2: TButton;
OpenTextFileDialog1: TOpenTextFileDialog;
GroupBox1: TGroupBox;
Edit1: TEdit;
Button3: TButton;
GroupBox2: TGroupBox;
ListBox1: TListBox;
Panel1: TPanel;
Button1: TButton;
Edit5: TEdit;
ToolbarImages: TImageList;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Fjointure: TFjointure;
implementation
{$R *.dfm}
procedure MergeFiles(FirstSplitFileName, OutFileName : TFileName) ;
// FirstSplitFileName == the name of the first piece of the split file
// OutFileName == the name of the resulting merged file
var
fs, ss: TFileStream;
cnt: integer;
begin
cnt := 1;
fs := TFileStream.Create(OutFileName, fmCreate or fmShareExclusive) ;
try
while FileExists(FirstSplitFileName) do
begin
ss := TFileStream.Create(FirstSplitFileName, fmOpenRead or fmShareDenyWrite) ;
try
fs.CopyFrom(ss, 0) ;
finally
ss.Free;
end;
Inc(cnt) ;
FirstSplitFileName := ChangeFileExt(FirstSplitFileName, Format('%s%d', ['._',cnt])) ;
end;
finally
fs.Free;
end;
end;
procedure TFjointure.Button1Click(Sender: TObject);
begin
if OpenTextFileDialog1.Execute then
ListBox1.Items.Add(OpenTextFileDialog1.FileName);
end;
procedure TFjointure.Button2Click(Sender: TObject);
var i:Integer;
begin
for I := 0 to Listbox1.items.Count - 1 do
begin
try
MergeFiles(ListBox1.Items[i],Edit1.text);
except
Edit5.text:='Files Joinded Succesfully !, Check the folder !';
Exit;
end;
end;
Edit5.text:='Files Joinded Succesfully !, Check the folder !';
end;
procedure TFjointure.Button3Click(Sender: TObject);
begin
if OpenTextFileDialog1.Execute then
Edit1.Text:=OpenTextFileDialog1.FileName;
end;
end.