Produced by Araxis Merge on 8/3/2017 10:10:42 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | V31A.zip\V31A\434\OR_30_434V114_SRC\XE8\Broker\Source | Rpcconf1.pas | Tue Apr 18 19:43:56 2017 UTC |
2 | V31A.zip\V31A\434\OR_30_434V114_SRC\XE8\Broker\Source | Rpcconf1.pas | Thu Aug 3 13:28:03 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 706 |
Changed | 2 | 4 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | { ******** ********** ********** ********** ********** ********** **** | |
2 | Pa ckage: XWB - Kernel RPCBroker | |
3 | Da te Created : Sept 18, 1997 (Ver sion 1.1) | |
4 | Si te Name: O akland, OI Field Off ice, Dept of Veteran Affairs | |
5 | De velopers: Danila Man apsal, Rau l Mendoza, Joel Ivey | |
6 | De scription: Contains TRPCBroker and relat ed compone nts. | |
7 | Unit: Rp cconf1 ser ver select ion dialog . Reads fr om registr y entries | |
8 | HK EY_LOCAL_M ACHINE and HKEY_CURR ENT_USER, and saves new entrie s to | |
9 | HK EY_CURRENT _USER. | |
10 | Cu rrent Rele ase: Versi on 1.1 Pat ch 65 | |
11 | ********** ********** ********** ********** ********** ********** *** } | |
12 | ||
13 | { ******** ********** ********** ********** ********** ** | |
14 | Changes in v1.1.65 (HGW 11/2 1/2016) XW B*1.1*65 | |
15 | 1. None. | |
16 | ||
17 | Changes in v1.1.60 (HGW 05/1 4/2014) XW B*1.1*60 | |
18 | 1. Symbo l 'StrDisp ose' is de precated i n Delphi X E4, moved to the Ans iStrings u nit. | |
19 | 2. Symbo l 'StrPas' is deprec ated in De lphi XE4, moved to t he AnsiStr ings unit. | |
20 | 3. Fixed read/writ e from/to Windows re gistry and added SSH Username i nformation | |
21 | to va lue saved in registr y. | |
22 | 4. Repla ced uses W inSock wit h uses Win Sock2. | |
23 | 5. Creat e overload version o f function GetServer Info for b ackward co mpatibilit y. | |
24 | New v ersion has third arg ument of S SHUsername . | |
25 | ||
26 | Changes in v1.1.50 (JLI 09/0 8/2004) XW B*1.1*50 | |
27 | 1. Updat e string t ypes for h ost and ou tcome | |
28 | ||
29 | Changes in v1.1.13 (REM 04/2 5/2000) XW B*1.1*13 | |
30 | 1. Added an OnDest roy event to release the help file. | |
31 | ********** ********** ********** ********** ********** } | |
32 | ||
33 | //TODO - D eprecate a nd replace documente d function GetServer IP | |
34 | // w ith IPv4/I Pv6 dual-s tack, as m ultiple IP addresses will be r eturned (l ist). | |
35 | // ( Create ove rload vers ion for ba ckward com patibility ?) | |
36 | //TODO - A dd a delet e button t o delete a server re gistry ent ry? Functi on is at | |
37 | // b ottom of t his unit, but button does not exist. | |
38 | //TODO - I mprove fun ction IsIP Address. S ee Indy Id Global uni t for poss ibilities. | |
39 | ||
40 | unit Rpcco nf1; | |
41 | ||
42 | interface | |
43 | ||
44 | uses | |
45 | {System} | |
46 | AnsiStri ngs, SysUt ils, Class es, | |
47 | {WinApi} | |
48 | WinTypes , WinProcs , Messages , WinSock2 , | |
49 | {VA} | |
50 | XWBut1, Rpcnet, MF unStr, | |
51 | {Vcl} | |
52 | Graphics , Controls , Forms, D ialogs, St dCtrls, Bu ttons, Ext Ctrls; | |
53 | ||
54 | type | |
55 | TrpcConf ig = class (TForm) | |
56 | cboSer ver: TComb oBox; | |
57 | TPanel Address: T Panel; | |
58 | Panel3 : TPanel; | |
59 | pnlPor t: TPanel; | |
60 | btnOk: TBitBtn; | |
61 | btnCan cel: TBitB tn; | |
62 | Panel1 : TPanel; | |
63 | pnlAdd ress: TPan el; | |
64 | btnHel p: TBitBtn ; | |
65 | btnNew : TButton; | |
66 | TPanel SSHUsernam e: TPanel; | |
67 | Panel2 : TPanel; | |
68 | pnlSSH Username: TPanel; | |
69 | proced ure cboSer verClick(S ender: TOb ject); | |
70 | proced ure FormCl ose(Sender : TObject; var Actio n: TCloseA ction); | |
71 | proced ure FormCr eate(Sende r: TObject ); | |
72 | proced ure btnOkC lick(Sende r: TObject ); | |
73 | proced ure butCan celClick(S ender: TOb ject); | |
74 | proced ure FormDe stroy(Send er: TObjec t); | |
75 | proced ure cboSer verExit(Se nder: TObj ect); | |
76 | proced ure btnNew Click(Send er: TObjec t); | |
77 | proced ure btnDel eteClick(S ender: TOb ject); | |
78 | proced ure pnlPor tClick(Sen der: TObje ct); | |
79 | proced ure btnHel pClick(Sen der: TObje ct); | |
80 | ||
81 | private | |
82 | { Priv ate declar ations } | |
83 | OrigHe lp : Strin g; //Hel p filename of callin g applicat ion. | |
84 | ||
85 | public | |
86 | { Publ ic declara tions } | |
87 | Server Pairs : TS tringList; | |
88 | end; | |
89 | ||
90 | function G etServerIn fo(var Ser ver,Port: string): i nteger; ov erload; / /p60 backw ard compat ibility | |
91 | function G etServerIn fo(var Ser ver,Port,S SHUsername : string): integer; overload; //p60 new version | |
92 | function G etServerIP (ServerNam e: String) : String; | |
93 | ||
94 | var | |
95 | rpcConfi g: TrpcCon fig; | |
96 | ButtonSt atus, Inst ance: inte ger; | |
97 | rServer, rPort, rS SHUsername : string; | |
98 | TaskInst ance: inte ger; | |
99 | ||
100 | implementa tion | |
101 | ||
102 | uses | |
103 | {VA} | |
104 | AddServe r; | |
105 | ||
106 | {$R *.DFM} | |
107 | ||
108 | function I sIPAddress (Val: Stri ng): Boole an; | |
109 | //TODO - N eed a bett er way to verify an IP address (IPv4 and IPv6) | |
110 | var | |
111 | I: Integ er; | |
112 | C: Char; | |
113 | begin | |
114 | Result : = True; | |
115 | for I := 1 to Leng th(Val) do // Ite rate | |
116 | begin | |
117 | C := V al[I]; | |
118 | if not (C in ['0 ','1','2', '3','4','5 ','6','7', '8','9','A ','B','C', 'D','E','F ','.',':'] ) then | |
119 | begin | |
120 | Resu lt := Fals e; | |
121 | Brea k; | |
122 | end; | |
123 | end; // for | |
124 | end; | |
125 | ||
126 | {: Library function to obtain an IP addr ess, given a server name } | |
127 | //Assumes single IP address fo r server, which coul d be incor rect!!! | |
128 | function G etServerIP (ServerNam e: String) : String; | |
129 | var | |
130 | host,out come: PAns iChar; // JLI 09080 4 | |
131 | begin | |
132 | TaskInst ance := Li bOpen; | |
133 | if not I sIPAddress (ServerNam e) then | |
134 | begin | |
135 | outcom e := PAnsi Char(StrAl loc(256)); // JLI 0 90804 | |
136 | host : = PAnsiCha r(StrAlloc (length(Se rverName) + 1)); // JLI 09080 4 | |
137 | AnsiSt rings.StrP Copy(host, ServerNam e); //p60 | |
138 | LibGet HostIP1(Ta skInstance , host, ou tcome); | |
139 | Result := AnsiSt rings.StrP as(outcome ); //p6 0 | |
140 | AnsiSt rings.StrD ispose(out come); //p60 | |
141 | AnsiSt rings.StrD ispose(hos t); //p60 | |
142 | end | |
143 | else | |
144 | Result := Server Name; | |
145 | LibClose (TaskInsta nce); | |
146 | end; | |
147 | ||
148 | procedure TrpcConfig .cboServer Click(Send er: TObjec t); | |
149 | var | |
150 | index: i nteger; | |
151 | begin | |
152 | {Based o n selectio n, set Por t, Server and SSHUse rname vari ables} | |
153 | index := cboServer .ItemIndex ; | |
154 | rPort := Piece(Pie ce(ServerP airs[index ], '=', 1) , ',', 2); | |
155 | pnlPort. Caption := rPort; | |
156 | rSSHUser name := Pi ece(Server Pairs[inde x], '=', 2 ); | |
157 | pnlSSHUs ername.Cap tion := rS SHUsername ; | |
158 | rServer := Piece(S erverPairs [index], ' ,', 1); | |
159 | btnOk.En abled := T rue; | |
160 | //btnDel ete.Enable d := True; | |
161 | {Based o n Server, get IP add resss.} | |
162 | pnlAddre ss.Caption := GetSer verIP(rSer ver); | |
163 | end; | |
164 | ||
165 | procedure TrpcConfig .FormCreat e(Sender: TObject); | |
166 | begin | |
167 | FormStyl e := fsSta yOnTop; | |
168 | OrigHelp := Applic ation.Help File; // Save orig inal helpf ile. | |
169 | Applicat ion.HelpFi le := Read RegData(HK LM, REG_BR OKER, 'Bro kerDr') + | |
170 | '\c lagent.hlp '; // Identify ConnectTo helpfile. | |
171 | ServerPa irs := TSt ringList.C reate; | |
172 | end; | |
173 | ||
174 | procedure TrpcConfig .FormClose (Sender: T Object; va r Action: TCloseActi on); | |
175 | begin | |
176 | cboServe r.Clear; | |
177 | pnlPort. Caption := ''; | |
178 | pnlSSHUs ername.Cap tion := '' ; | |
179 | ServerPa irs.Free; | |
180 | Applicat ion.HelpFi le := Orig Help; // Restore he lpfile. | |
181 | end; | |
182 | ||
183 | //Overload old versi on of GetS erverInfo for backwa rd compati bility (p6 0) | |
184 | function G etServerIn fo(var Ser ver,Port: string): i nteger; | |
185 | var | |
186 | rSSHUser name : str ing; | |
187 | begin | |
188 | Result : = GetServe rInfo(Serv er, Port, rSSHUserna me); | |
189 | end; | |
190 | ||
191 | //Overload new versi on of GetS erverInfo including SSHUsernam e (p60) | |
192 | function G etServerIn fo(var Ser ver,Port,S SHUsername : string): integer; | |
193 | var | |
194 | index: i nteger; | |
195 | tmpServe rPairs : T StringList ; //F ormat: SER VER,port# | |
196 | TextStr: String; | |
197 | begin | |
198 | rpcconfi g := Trpcc onfig.Crea te(Applica tion); | |
199 | TaskInst ance := Li bOpen; | |
200 | //For Wi ndows 7: | |
201 | // HKEY_LOCA L_MACHINE\ Software\W ow6432Node \Vista\Bro ker\Server s | |
202 | // HKEY_CURR ENT_USER\S oftware\Vi sta\Broker \Servers | |
203 | // server.sit e. URL ,19300 REG _SZ xxxvis ta | |
204 | with rpc Config do | |
205 | begin | |
206 | tmpSer verPairs : = TStringL ist.Create ; | |
207 | ReadRe gValues(HK LM, REG_SE RVERS, tmp ServerPair s); | |
208 | Server Pairs.Assi gn(tmpServ erPairs); | |
209 | tmpSer verPairs.C lear; | |
210 | ReadRe gValues(HK CU, REG_SE RVERS, tmp ServerPair s); | |
211 | for in dex := 0 t o (tmpServ erPairs.Co unt-1) do | |
212 | begin | |
213 | Text Str := tmp ServerPair s[index]; | |
214 | if S erverPairs .IndexOf(T extStr) < 0 then | |
215 | Se rverPairs. Add(TextSt r); | |
216 | end; | |
217 | Button Status := mrOk; | |
218 | if Ser verPairs.C ount < 1 t hen | |
219 | begin | |
220 | Writ eRegData(H KCU, REG_S ERVERS, 'B ROKERSERVE R,9200', ' '); | |
221 | Serv erPairs.Ad d('BROKERS ERVER,9200 '); | |
222 | end; | |
223 | if Ser verPairs.C ount > 1 t hen // P3 1 //need t o show for m | |
224 | begin | |
225 | //In itialize f orm. | |
226 | for index := 0 to (Serve rPairs.Cou nt -1) do //Load combobox | |
227 | cb oServer.It ems.Add(Se rverPairs[ index]); | |
228 | cboS erver.Item Index := 0 ; | |
229 | rSer ver := Pie ce(ServerP airs[0], ' ,', 1); | |
230 | rPor t := Piece (Piece(Ser verPairs[0 ], '=', 1) , ',', 2); | |
231 | pnlP ort.Captio n := rPort ; | |
232 | rSSH Username : = Piece(Se rverPairs[ 0], '=', 2 ); | |
233 | pnlS SHUsername .Caption : = rSSHUser name; | |
234 | //Ge t and disp lay IP add ress. | |
235 | pnlA ddress.Cap tion := Ge tServerIP( rServer); | |
236 | Show Modal; //Displ ay form | |
237 | end | |
238 | else //One choice: fo rm not sho wn, value returned. | |
239 | begin | |
240 | rSer ver := Pie ce(ServerP airs[0], ' ,', 1); | |
241 | rPor t := Pie ce(Piece(S erverPairs [0], '=', 1), ',', 2 ); | |
242 | rSSH Username : = Piece(Se rverPairs[ 0], '=', 2 ); | |
243 | end; | |
244 | if But tonStatus = mrOk the n | |
245 | begin | |
246 | Serv er := rSer ver; | |
247 | Port := rPort; | |
248 | SSHU sername := rSSHUsern ame; | |
249 | end; | |
250 | Result := Button Status; | |
251 | tmpSer verPairs.F ree; | |
252 | libClo se(TaskIns tance); | |
253 | Releas e; | |
254 | end; | |
255 | end; | |
256 | ||
257 | procedure TrpcConfig .btnOkClic k(Sender: TObject); | |
258 | begin | |
259 | ButtonSt atus := mr Ok; | |
260 | rServer := Piece(c boServer.T ext,',',1) ; | |
261 | rPort := pnlPort.C aption; | |
262 | rSSHUser name := pn lSSHUserna me.Caption ; | |
263 | rpcConfi g.close; | |
264 | end; | |
265 | ||
266 | procedure TrpcConfig .butCancel Click(Send er: TObjec t); | |
267 | begin | |
268 | ButtonSt atus := mr Cancel; | |
269 | rServer := cboServ er.Text; | |
270 | rPort := pnlPort.C aption; | |
271 | rSSHUser name := pn lSSHUserna me.Caption ; | |
272 | rpcConfi g.close; | |
273 | end; | |
274 | ||
275 | procedure TrpcConfig .FormDestr oy(Sender: TObject); | |
276 | begin | |
277 | ServerPa irs := TSt ringList.C reate; // {p13 - REM } | |
278 | ServerPa irs.Free; // Release Help File. | |
279 | Applicat ion.HelpFi le := Orig Help; // | |
280 | end; | |
281 | ||
282 | procedure TrpcConfig .pnlPortCl ick(Sender : TObject) ; | |
283 | begin | |
284 | // | |
285 | end; | |
286 | ||
287 | procedure TrpcConfig .cboServer Exit(Sende r: TObject ); | |
288 | begin | |
289 | // | |
290 | end; | |
291 | ||
292 | procedure TrpcConfig .btnHelpCl ick(Sender : TObject) ; | |
293 | begin | |
294 | // | |
295 | end; | |
296 | ||
297 | //On Windo ws 7, btnN ewClick wr ites to: | |
298 | // H KEY_CURREN T_USER\Sof tware\Vist a\Broker\S ervers | |
299 | // server.sit e. URL ,19300 REG _SZ xxxvis ta | |
300 | procedure TrpcConfig .btnNewCli ck(Sender: TObject); | |
301 | var | |
302 | I: Integ er; | |
303 | ServerFo rm: TfrmAd dServer; | |
304 | strServe r, strName , strPort, strSSHUse rname: Str ing; | |
305 | begin | |
306 | ServerFo rm := Tfrm AddServer. Create(Sel f); | |
307 | if Serve rForm.Show Modal <> m rCancel th en | |
308 | begin | |
309 | strSer ver := Ser verForm.ed tAddress.T ext; | |
310 | strPor t := Serve rForm.edtP ortNumber. Text; | |
311 | strSSH Username : = ServerFo rm.edtSSHu sername.Te xt; | |
312 | Server Form.edtPo rtNumber.T ext := str Port; | |
313 | strNam e := strSe rver + ',' + strPort ; | |
314 | WriteR egData(HKC U, REG_SER VERS, strN ame, strSS HUsername) ; | |
315 | Server Pairs.Add( strName); | |
316 | strNam e := Serve rPairs[Ser verPairs.C ount-1]; | |
317 | cboSer ver.Items. Add(strNam e); | |
318 | for I := 0 to cb oServer.It ems.Count- 1 do // Iterate | |
319 | begin | |
320 | if c boServer.I tems[I] = strName th en | |
321 | cb oServer.It emIndex := I; | |
322 | end; // for | |
323 | // cboS erver.Text := strSer ver; | |
324 | // pnlP ort.Captio n := strPo rt; | |
325 | cboSer verClick(S elf); | |
326 | end; | |
327 | ServerFo rm.Free; | |
328 | end; | |
329 | ||
330 | {********* ********** ********** * | |
331 | btnDeleteC lick | |
332 | - remove selected server,por t combinat ion from r egistry | |
333 | - added 10/17/2006 | |
334 | ********** ********** ********** *} | |
335 | procedure TrpcConfig .btnDelete Click(Send er: TObjec t); | |
336 | var | |
337 | index: integer; | |
338 | Text: S tring; | |
339 | begin | |
340 | {Base d on selct ion, get T ext value} | |
341 | index := cboSer ver.ItemIn dex; | |
342 | Text := cboServ er.Items[i ndex]; | |
343 | // no w delete f rom both l ocations i t could be stored | |
344 | Delet eRegData(H KLM, REG_S ERVERS, Te xt); | |
345 | Delet eRegData(H KCU, REG_S ERVERS, Te xt); | |
346 | // an d update b oth cboSer ver and Se rverPairs entries | |
347 | cboSe rver.Items .Delete(in dex); | |
348 | Serve rPairs.Del ete(index) ; | |
349 | // an d set butt ons depend ent on sel ection bac k to disab led | |
350 | btnOK .Enabled : = False; | |
351 | //btn Delete.Ena bled := Fa lse; | |
352 | end; | |
353 | ||
354 | end. | |
355 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.