-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy patharchset.pas
268 lines (257 loc) · 8.58 KB
/
archset.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
{/////////////////////////////////////////////////////////////////////////
//
// Dos Navigator Open Source 1.51.08
// Based on Dos Navigator (C) 1991-99 RIT Research Labs
//
// This programs is free for commercial and non-commercial use as long as
// the following conditions are aheared to.
//
// Copyright remains RIT Research Labs, and as such any Copyright notices
// in the code are not to be removed. If this package is used in a
// product, RIT Research Labs should be given attribution as the RIT Research
// Labs of the parts of the library used. This can be in the form of a textual
// message at program startup or in documentation (online or textual)
// provided with the package.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. All advertising materials mentioning features or use of this software
// must display the following acknowledgement:
// "Based on Dos Navigator by RIT Research Labs."
//
// THIS SOFTWARE IS PROVIDED BY RIT RESEARCH LABS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The licence and distribution terms for any publically available
// version or derivative of this code cannot be changed. i.e. this code
// cannot simply be copied and put under another distribution licence
// (including the GNU Public Licence).
//
//////////////////////////////////////////////////////////////////////////}
{$I STDEFINE.INC}
unit ArchSet;
interface
uses
Archiver
;
procedure SetupArchive(ArchCommand: Word);
procedure UpdateARH(Arch: PARJArchive);
implementation
uses
Defines, Startup, ArchDet, Dialogs, Views, Menus,
DNApp, Advance1, Commands, profile, DnIni
;
procedure UpdateARH(Arch: PARJArchive);
var
J: Word;
A: PARJArchive;
P: PView;
begin
if Arch <> nil then
Arch^.Save
else
begin
P := WriteMsg(GetString(dlPleaseStandBy));
for J := 0 to NumSupportedArchs-1 do
begin
A := GetArchiveByTag(J);
if A <> nil then
begin
A^.Save;
Dispose(A, Done);
A := nil;
end;
end;
P^.Free;
end;
CloseProfile;
end { UpdateARH };
procedure SetupArchive;
var
D: PDialog;
P: PView;
R: TRect;
Arch: PARJArchive;
W: Word;
DT: record
Pack: String; {Inputline}
Unpack: String; {Inputline}
Extract: String[20]; {Inputline}
ExWP: String[20]; {Inputline}
Add: String[20]; {Inputline}
Move: String[20]; {Inputline}
Delete: String[20]; {Inputline}
Test: String[20]; {Inputline}
Force: String[20]; {Inputline}
IncludeP: String[20]; {Inputline}
ExcludeP: String[20]; {Inputline}
Password: String[20]; {Inputline}
RecovRec: String[20]; {Inputline}
SelfExtr: String[20]; {Inputline}
Solid: String[20]; {Inputline}
Recurse: String[20]; {Inputline}
PthInside: String[20]; {Inputline}
StoreC: String[20]; {Inputline}
FastestC: String[20]; {Inputline}
FastC: String[20]; {Inputline}
NormC: String[20]; {Inputline}
GoodC: String[20]; {Inputline}
MaxC: String[20]; {Inputline}
CList: String[6]; {Inputline}
EList: String[6]; {Inputline}
AllVersion: Word; {Checkbox}
{AK155}
PutDirs: Word; {Checkbox}
{JO}
{$IFNDEF DPMI32}
ShortCmdLine: Word; {Checkbox}
{$ELSE}
SwapWhenExec: Word; {Checkbox}
{$ENDIF}
{/JO}
{$IFNDEF OS2}
UseLFN: Word; {Checkbox}
{㦥 ¢ DOS ¨ W32-¢¥àá¨ïå}
{$ENDIF}
end;
function ArcName(ArcT: Word): String;
var
S: String;
FreeByte: byte;
begin
S := fReplace('~', '', CnvString(LookUpMenu(MenuBar^.Menu, ArcT,
dfByCommand)^.Name));
FreeByte := PosChar('-', S);
if FreeByte > 0 then
Delete(S, 1, FreeByte+1);
ArcName := S;
end;
procedure CndRpl;
var
s: String;
begin
s := ArcName(ArchCommand+cmLoConfigArchiver);
if Length(s)+Length(D^.Title^)+10 < D^.Size.X then
s := D^.Title^+' - '+s;
ReplaceP(D^.Title, s);
end;
label Ex;
begin { SetupArchive }
if ArchCommand >= cmLoConfigArchiver then
Dec(ArchCommand, cmLoConfigArchiver);
Arch := GetArchiveByTag(ArchCommand);
if Arch = nil then
Exit;
with Arch^ do
begin
DT.Pack := CnvString(Packer);
DT.Unpack := CnvString(UnPacker);
DT.Extract := CnvString(Extract);
DT.ExWP := CnvString(ExtractWP);
DT.Add := CnvString(Add);
DT.Move := CnvString(Move);
DT.Test := CnvString(Test);
DT.Delete := CnvString(Delete);
DT.Password := CnvString(Garble);
DT.Force := CnvString(ForceMode);
DT.IncludeP := CnvString(IncludePaths);
DT.ExcludeP := CnvString(ExcludePaths);
DT.RecovRec := CnvString(RecoveryRec);
DT.SelfExtr := CnvString(SelfExtract);
DT.Solid := CnvString(Solid);
DT.Recurse := CnvString(RecurseSubDirs);
DT.PthInside := CnvString(SetPathInside);
DT.StoreC := CnvString(StoreCompression);
DT.FastestC := CnvString(FastestCompression);
DT.FastC := CnvString(FastCompression);
DT.NormC := CnvString(NormalCompression);
DT.GoodC := CnvString(GoodCompression);
DT.MaxC := CnvString(UltraCompression);
DT.CList := CnvString(ComprListChar);
DT.EList := CnvString(ExtrListChar);
DT.AllVersion := Word(AllVersion);
DT.PutDirs := Word(PutDirs);
{$IFNDEF DPMI32}
DT.ShortCmdLine := Word(ShortCmdLine);
{$ELSE}
DT.SwapWhenExec := Word(SwapWhenExec);
{$ENDIF}
{$IFNDEF OS2}
DT.UseLFN := Word(UseLFN);
{$ENDIF}
end;
D := PDialog(Application^.ValidView(PDialog(LoadResource(dlgSetupArc))));
if D = nil then
goto Ex;
D^.SetData(DT);
CndRpl;
W := Desktop^.ExecView(D);
if W = cmOK then
D^.GetData(DT);
Dispose(D, Done);
if W <> cmOK then
goto Ex;
if SystemData.ForceDefArch = '' then
DefaultArchiver := ArchCommand;
with Arch^ do
begin
Done;
Packer := NewStr(DT.Pack);
UnPacker := NewStr(DT.Unpack);
Extract := NewStr(DT.Extract);
ExtractWP := NewStr(DT.ExWP);
Add := NewStr(DT.Add);
Move := NewStr(DT.Move);
Test := NewStr(DT.Test);
Delete := NewStr(DT.Delete);
Garble := NewStr(DT.Password);
ForceMode := NewStr(DT.Force);
IncludePaths := NewStr(DT.IncludeP);
ExcludePaths := NewStr(DT.ExcludeP);
RecoveryRec := NewStr(DT.RecovRec);
SelfExtract := NewStr(DT.SelfExtr);
Solid := NewStr(DT.Solid);
RecurseSubDirs := NewStr(DT.Recurse);
SetPathInside := NewStr(DT.PthInside);
StoreCompression := NewStr(DT.StoreC);
FastestCompression := NewStr(DT.FastestC);
FastCompression := NewStr(DT.FastC);
NormalCompression := NewStr(DT.NormC);
GoodCompression := NewStr(DT.GoodC);
UltraCompression := NewStr(DT.MaxC);
ComprListChar := NewStr(DT.CList);
ExtrListChar := NewStr(DT.EList);
{if DT.List <> '' then ListChar := DT.List[1] else ListChar := ' ';}
AllVersion := (DT.AllVersion and 1) <> 0;
PutDirs := (DT.PutDirs and 1) <> 0;
{$IFNDEF DPMI32}
ShortCmdLine := (DT.ShortCmdLine and 1) <> 0;
{$ELSE}
SwapWhenExec := (DT.SwapWhenExec and 1) <> 0;
{$ENDIF}
{$IFNDEF OS2}
UseLFN := (DT.UseLFN and 1) <> 0;
{$ENDIF}
end;
UpdateARH(Arch);
Message(Application, evCommand, cmUpdateConfig, nil);
Ex:
Dispose(Arch, Done);
end { SetupArchive };
end.