1 | import { IncludeModel } from './models/IncludeModel';
|
2 | import { Severity, Erro } from './models/Erro';
|
3 | import { ValidaAdvpl } from './validaAdvpl';
|
4 |
|
5 | export class Include {
|
6 | private includeExpressoes: IncludeModel[];
|
7 | private includesObsoletos: string[];
|
8 | protected local;
|
9 | constructor(local) {
|
10 | this.local = local;
|
11 | this.includesObsoletos = [];
|
12 | this.includesObsoletos.push('PROTHEUS.CH');
|
13 | this.includesObsoletos.push('DIALOG.CH');
|
14 | this.includesObsoletos.push('FONT.CH');
|
15 | this.includesObsoletos.push('PTMENU.CH');
|
16 | this.includesObsoletos.push('PRINT.CH');
|
17 | this.includesObsoletos.push('COLORS.CH');
|
18 | this.includesObsoletos.push('FOLDER.CH');
|
19 | this.includesObsoletos.push('MSOBJECT.CH');
|
20 | this.includesObsoletos.push('VKEY.CH');
|
21 | this.includesObsoletos.push('WINAPI.CH');
|
22 | this.includesObsoletos.push('FWCOMMAND.CH');
|
23 | this.includesObsoletos.push('FWCSS.CH');
|
24 |
|
25 | this.includeExpressoes = [];
|
26 |
|
27 | this.includeExpressoes.push({
|
28 | expressoes: [
|
29 | /CONNECT+(\ |\t)+SMTP+(\ |\t)+SERVER/gim,
|
30 | /CONNECT+(\ |\t)+POP+(\ |\t)+SERVER/gim,
|
31 | /DISCONNECT+(\ |\t)+SMTP+(\ |\t)+SERVER/gim,
|
32 | /DISCONNECT+(\ |\t)+POP+(\ |\t)+SERVER/gim,
|
33 | /POP+(\ |\t)+MESSAGE+(\ |\t)+COUNT/gim,
|
34 | /SEND+(\ |\t)+MAIL+(\ |\t)+FROM/gim,
|
35 | /GET+(\ |\t)+MAIL+(\ |\t)+ERROR/gim,
|
36 | /RECEIVE+(\ |\t)+MAIL+(\ |\t)+MESSAGE/gim
|
37 | ],
|
38 | include: 'AP5MAIL.CH',
|
39 | precisa: false,
|
40 | includes: []
|
41 | });
|
42 |
|
43 |
|
44 |
|
45 | this.includeExpressoes.push({
|
46 | expressoes: [
|
47 | /APWEB+(\ |\t)+INIT+(\ |\t)+.+(\ |\t)+USING/gim,
|
48 | /APWEB+(\ |\t)+END/gim
|
49 | ],
|
50 | include: 'APWEB.CH',
|
51 | precisa: false,
|
52 | includes: []
|
53 | });
|
54 |
|
55 | this.includeExpressoes.push({
|
56 | expressoes: [
|
57 | /OPEN+(\ |\t)+QUERY+(\ |\t)+ALIAS/gim,
|
58 | /CLOSE+(\ |\t)+QUERY/gim,
|
59 | /WEB+(\ |\t)+EXTENDED+(\ |\t)+INIT/gim,
|
60 | /WEB+(\ |\t)+EXTENDED+(\ |\t)+END/gim
|
61 | ],
|
62 | include: 'APWEBEX.CH',
|
63 | precisa: false,
|
64 | includes: []
|
65 | });
|
66 |
|
67 | this.includeExpressoes.push({
|
68 | expressoes: [
|
69 | /(\ |\t|\(|\,)+SOAPFAULT_VERSIONMISMATCH/gim,
|
70 | /(\ |\t|\(|\,)+SOAPFAULT_MUSTUNDERSTAND/gim,
|
71 | /(\ |\t|\(|\,)+SOAPFAULT_DTDNOTSUPPORTED/gim,
|
72 | /(\ |\t|\(|\,)+SOAPFAULT_DATAENCODINGUNKNOWN/gim,
|
73 | /(\ |\t|\(|\,)+SOAPFAULT_SENDER/gim,
|
74 | /(\ |\t|\(|\,)+SOAPFAULT_RECEIVER/gim,
|
75 | /(\ |\t|\(|\,)+BYREF/gim,
|
76 | /(^|\t|\ )+WSSTRUCT/gim,
|
77 | /(^|\t|\ )+WSSERVICE/gim,
|
78 | /(^|\t|\ )+WSCLIENT/gim
|
79 | ],
|
80 | include: 'APWEBSRV.CH',
|
81 | precisa: false,
|
82 | includes: []
|
83 | });
|
84 |
|
85 | this.includeExpressoes.push({
|
86 | expressoes: [
|
87 | /DEFINE+(\ |\t)+WIZARD/gim,
|
88 | /ACTIVATE+(\ |\t)+WIZARD/gim,
|
89 | /CREATE+(\ |\t)+PANEL/gim
|
90 | ],
|
91 | include: 'APWIZARD.CH',
|
92 | precisa: false,
|
93 | includes: []
|
94 | });
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | this.includeExpressoes.push({
|
110 | expressoes: [/TCQUERY+(\ |\t)/gim],
|
111 | include: 'TOPCONN.CH',
|
112 | precisa: false,
|
113 | includes: []
|
114 | });
|
115 |
|
116 | this.includeExpressoes.push({
|
117 | expressoes: [
|
118 | /CREATE+(\ |\t)+RPCCONN+(\ |\t)/gim,
|
119 | /CLOSE+(\ |\t)+RPCCONN+(\ |\t)/gim,
|
120 | /PREPARE+(\ |\t)+ENVIRONMENT+(\ |\t)/gim,
|
121 | /RESET+(\ |\t)+ENVIRONMENT+(\ |\t)/gim,
|
122 | /OPEN+(\ |\t)+REMOTE+(\ |\t)+TRANSACTION+(\ |\t)/gim,
|
123 | /CLOSE+(\ |\t)+REMOTE+(\ |\t)+TRANSACTION+(\ |\t)/gim,
|
124 | /CALLPROC+(\ |\t)+IN+(\ |\t)/gim,
|
125 | /OPEN+(\ |\t)+REMOTE+(\ |\t)+TABLES+(\ |\t)/gim
|
126 | ],
|
127 | include: 'TBICONN.CH',
|
128 | precisa: false,
|
129 | includes: ['AP5MAIL.CH']
|
130 | });
|
131 |
|
132 | this.includeExpressoes.push({
|
133 | expressoes: [
|
134 | /DEFINE+(\ |\t)+REPORT+(\ |\t)+.+(\ |\t)+NAME+(\ |\t)/gim,
|
135 | /DEFINE+(\ |\t)+SECTION+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/gim,
|
136 | /DEFINE+(\ |\t)+CELL+(\ |\t)+NAME+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/gim,
|
137 | /DEFINE+(\ |\t)+BREAK+(\ |\t)+OF+(\ |\t)/gim,
|
138 | /DEFINE+(\ |\t)+FUNCTION+(\ |\t)+FROM+(\ |\t)/gim,
|
139 | /DEFINE+(\ |\t)+COLLECTION+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/gim,
|
140 | /DEFINE+(\ |\t)+BORDER+(\ |\t)+.+(\ |\t)+OF+(\ |\t)+/gim,
|
141 | /DEFINE+(\ |\t)+HEADER+(\ |\t)+BORDER+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/gim,
|
142 | /DEFINE+(\ |\t)+CELL+(\ |\t)+BORDER+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/gim,
|
143 | /DEFINE+(\ |\t)+CELL+(\ |\t)+HEADER+(\ |\t)+BORDER+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/gim
|
144 | ],
|
145 | include: 'REPORT.CH',
|
146 | precisa: false,
|
147 | includes: []
|
148 | });
|
149 |
|
150 | this.includeExpressoes.push({
|
151 | expressoes: [
|
152 | /(^|\t|\ )+WSRESTFUL/gim,
|
153 | /(^|\t|\ )+WADL/gim,
|
154 | /(^|\t|\ )+WADLMETHOD/gim
|
155 | ],
|
156 | include: 'RESTFUL.CH',
|
157 | precisa: false,
|
158 | includes: ['APWEBSRV.CH']
|
159 | });
|
160 |
|
161 | this.includeExpressoes.push({
|
162 | expressoes: [
|
163 | /(\ |\t|\(|\,)+F_ERROR/gim,
|
164 | /(\ |\t|\(|\,)+FS_SET/gim,
|
165 | /(\ |\t|\(|\,)+FS_RELATIVE/gim,
|
166 | /(\ |\t|\(|\,)+FS_END/gim,
|
167 | /(\ |\t|\(|\,)+FO_READ/gim,
|
168 | /(\ |\t|\(|\,)+FO_WRITE/gim,
|
169 | /(\ |\t|\(|\,)+FO_READWRITE/gim,
|
170 | /(\ |\t|\(|\,)+FO_COMPAT/gim,
|
171 | /(\ |\t|\(|\,)+FO_EXCLUSIVE/gim,
|
172 | /(\ |\t|\(|\,)+FO_DENYWRITE/gim,
|
173 | /(\ |\t|\(|\,)+FO_DENYREAD/gim,
|
174 | /(\ |\t|\(|\,)+FO_DENYNONE/gim,
|
175 | /(\ |\t|\(|\,)+FO_SHARED/gim,
|
176 | /(\ |\t|\(|\,)+FC_NORMAL/gim,
|
177 | /(\ |\t|\(|\,)+FC_READONLY/gim,
|
178 | /(\ |\t|\(|\,)+FC_HIDDEN/gim,
|
179 | /(\ |\t|\(|\,)+FC_SYSTEM/gim,
|
180 | /(\ |\t|\(|\,)+FD_RAW/gim,
|
181 | /(\ |\t|\(|\,)+FD_BINARY/gim,
|
182 | /(\ |\t|\(|\,)+FD_COOKED/gim,
|
183 | /(\ |\t|\(|\,)+FD_TEXT/gim,
|
184 | /(\ |\t|\(|\,)+FD_ASCII/gim
|
185 | ],
|
186 | include: 'FILEIO.CH',
|
187 | precisa: false,
|
188 | includes: []
|
189 | });
|
190 |
|
191 | this.includeExpressoes.push({
|
192 | expressoes: [
|
193 | /(\ |\t|\(|\,)+RPC_LOGIN/gim,
|
194 | /(\ |\t|\(|\,)+RPC_LOGOFF/gim,
|
195 | /(\ |\t|\(|\,)+RPC_SEND_COTACAO/gim,
|
196 | /(\ |\t|\(|\,)+RPC_ESTORNA_COTACAO/gim,
|
197 | /(\ |\t|\(|\,)+RPC_READ_COTACAO/gim,
|
198 | /(\ |\t|\(|\,)+RPC_SEND_ORCAMENTO/gim,
|
199 | /(\ |\t|\(|\,)+RPC_ESTORNA_ORCAMENTO/gim,
|
200 | /(\ |\t|\(|\,)+RPC_READ_ORCAMENTO/gim
|
201 | ],
|
202 | include: 'TBICODE.CH',
|
203 | precisa: false,
|
204 | includes: []
|
205 | });
|
206 |
|
207 | this.includeExpressoes.push({
|
208 | expressoes: [
|
209 | /(\ |\t|\(|\,)+PARAMEXCEPTION/gim,
|
210 | /(\ |\t|\(|\,)+CLASSEXCEPTION/gim,
|
211 | /(\ |\t|\(|\,)+CLASSPARAMEXCEPTION/gim,
|
212 | /(\ |\t|\(|\,)+BLOCKPARAMEXCEPTION/gim,
|
213 | /(\ |\t|\(|\,)+PARAMTYPE/gim
|
214 | ],
|
215 | include: 'PARMTYPE.CH',
|
216 | precisa: false,
|
217 | includes: []
|
218 | });
|
219 |
|
220 | this.includeExpressoes.push({
|
221 | expressoes: [
|
222 | /(\ |\t|\(|\,)+FORM_STRUCT_TABLE_/gim,
|
223 | /(\ |\t|\(|\,)+FORM_STRUCT_CARGO_/gim,
|
224 | /(\ |\t|\(|\,)+MVC_BUTTON_/gim,
|
225 | /(\ |\t|\(|\,)+MVC_TOOLBAR_/gim,
|
226 | /(\ |\t|\(|\,)+MODELO_PK_/gim,
|
227 | /(\ |\t|\(|\,)+MODEL_TRIGGER_/gim,
|
228 | /(\ |\t|\(|\,)+MODEL_FIELD_/gim,
|
229 | /(\ |\t|\(|\,)+MODEL_RELATION_/gim,
|
230 | /(\ |\t|\(|\,)+MODEL_STRUCT_/gim,
|
231 | /(\ |\t|\(|\,)+STRUCT_FEATURE_/gim,
|
232 | /(\ |\t|\(|\,)+STRUCT_RULES_/gim,
|
233 | /(\ |\t|\(|\,)+MODEL_GRID_/gim,
|
234 | /(\ |\t|\(|\,)+MODEL_GRIDLINE_/gim,
|
235 | /(\ |\t|\(|\,)+MODEL_RULES_/gim,
|
236 | /(\ |\t|\(|\,)+MODEL_MSGERR_/gim,
|
237 | /(\ |\t|\(|\,)+MODEL_OPERATION_/gim,
|
238 | /(\ |\t|\(|\,)+MVC_LOADFILTER_/gim,
|
239 | /(\ |\t|\(|\,)+MODEL_CONTROL_/gim,
|
240 | /(\ |\t|\(|\,)+VIEWS_VIEW_/gim,
|
241 | /(\ |\t|\(|\,)+MVC_VIEW_/gim,
|
242 | /(\ |\t|\(|\,)+MVC_MODEL_/gim,
|
243 | /(\ |\t|\(|\,)+FORMSTRUFIELD/gim,
|
244 | /(\ |\t|\(|\,)+FORMSTRUTRIGGER/gim,
|
245 | /(\ |\t|\(|\,)+VIEWSTRUFIELD/gim,
|
246 | /(\ |\t|\(|\,)+VIEWSTRUFOLDER/gim,
|
247 | /(\ |\t|\(|\,)+VIEWSTRUDOCKWINDOW/gim,
|
248 | /(\ |\t|\(|\,)+VIEWSTRUGROUP/gim,
|
249 | /(\ |\t|\(|\,)+VIEW_BUTTON_/gim,
|
250 | /(\ |\t|\(|\,)+OP_PESQUISAR/gim,
|
251 | /(\ |\t|\(|\,)+OP_VISUALIZAR/gim,
|
252 | /(\ |\t|\(|\,)+OP_INCLUIR/gim,
|
253 | /(\ |\t|\(|\,)+OP_ALTERAR/gim,
|
254 | /(\ |\t|\(|\,)+OP_EXCLUIR/gim,
|
255 | /(\ |\t|\(|\,)+OP_IMPRIMIR/gim,
|
256 | /(\ |\t|\(|\,)+OP_COPIA/gim,
|
257 | /(^|\t|\ )+ADD+(\ |\t)+FWTOOLBUTTON/gim,
|
258 | /(^|\t|\ )+NEW+(\ |\t)+MODEL/gim,
|
259 | /(^|\t|\ )+PUBLISH+(\ |\t)+MODEL+(\ |\t)+REST+(\ |\t)+NAME/gim,
|
260 | /(^|\t|\ )+ADD+(\ |\t)+OPTION+(\ |\t)+(.|)+(\ |\t|)+TITLE+(\ |\t|)+(.|)+(\ |\t|)+ACTION+(\ |\t)+(.|)+(\ |\t|)+OPERATION+(\ |\t)+(.|)+(\ |\t)+ACCESS/gim
|
261 | ],
|
262 | include: 'FWMVCDEF.CH',
|
263 | precisa: false,
|
264 | includes: ['PARMTYPE.CH', 'FWMBROWSE.CH']
|
265 | });
|
266 |
|
267 | this.includeExpressoes.push({
|
268 | expressoes: [/\[+(\ |\t|)+\#+(.|)+\]/gim],
|
269 | include: 'AARRAY.CH',
|
270 | precisa: false,
|
271 | includes: []
|
272 | });
|
273 |
|
274 | this.includeExpressoes.push({
|
275 | expressoes: [
|
276 | /(\ |\t|\(|\,)+CELL_ALIGN_LEFT/gim,
|
277 | /(\ |\t|\(|\,)+CELL_ALIGN_CENTER/gim,
|
278 | /(\ |\t|\(|\,)+CELL_ALIGN_RIGHT/gim,
|
279 | /(\ |\t|\(|\,)+BORDER_NONE/gim,
|
280 | /(\ |\t|\(|\,)+BORDER_CONTINUOUS/gim,
|
281 | /(\ |\t|\(|\,)+BORDER_PARENT/gim,
|
282 | /(\ |\t|\(|\,)+BORDER_HEADERPARENT/gim,
|
283 | /(\ |\t|\(|\,)+BORDER_CELL/gim,
|
284 | /(\ |\t|\(|\,)+BORDER_FUNCTION/gim,
|
285 | /(\ |\t|\(|\,)+BORDER_SECTION/gim,
|
286 | /(\ |\t|\(|\,)+EDGE_TOP/gim,
|
287 | /(\ |\t|\(|\,)+EDGE_BOTTOM/gim,
|
288 | /(\ |\t|\(|\,)+EDGE_LEFT/gim,
|
289 | /(\ |\t|\(|\,)+EDGE_RIGHT/gim,
|
290 | /(\ |\t|\(|\,)+EDGE_ALL/gim,
|
291 | /(\ |\t|\(|\,)+NEGATIVE_PARENTHESES/gim,
|
292 | /(\ |\t|\(|\,)+NEGATIVE_SIGNAL/gim,
|
293 | /(\ |\t|\(|\,)+IMP_DISCO/gim,
|
294 | /(\ |\t|\(|\,)+IMP_SPOOL/gim,
|
295 | /(\ |\t|\(|\,)+IMP_EMAIL/gim,
|
296 | /(\ |\t|\(|\,)+IMP_EXCEL/gim,
|
297 | /(\ |\t|\(|\,)+IMP_HTML/gim,
|
298 | /(\ |\t|\(|\,)+IMP_PDF/gim,
|
299 | /(\ |\t|\(|\,)+IMP_ODF/gim,
|
300 | /(\ |\t|\(|\,)+IMP_PDFMAIL/gim,
|
301 | /(\ |\t|\(|\,)+IMP_MAILCOMPROVA/gim,
|
302 | /(\ |\t|\(|\,)+IMP_ECM/gim,
|
303 | /(\ |\t|\(|\,)+AMB_SERVER/gim,
|
304 | /(\ |\t|\(|\,)+AMB_CLIENT/gim,
|
305 | /(\ |\t|\(|\,)+AMB_ECM+(\ |\t)/gim,
|
306 | /(\ |\t|\(|\,)+PORTRAIT+(\ |\t)/gim,
|
307 | /(\ |\t|\(|\,)+LANDSCAPE+(\ |\t)/gim,
|
308 | /(\ |\t|\(|\,)+NO_REMOTE/gim,
|
309 | /(\ |\t|\(|\,)+REMOTE_DELPHI/gim,
|
310 | /(\ |\t|\(|\,)+REMOTE_QTWIN/gim,
|
311 | /(\ |\t|\(|\,)+REMOTE_QTLINUX/gim,
|
312 | /(\ |\t|\(|\,)+TYPE_CELL/gim,
|
313 | /(\ |\t|\(|\,)+TYPE_FORMULA/gim,
|
314 | /(\ |\t|\(|\,)+TYPE_FUNCTION/gim,
|
315 | /(\ |\t|\(|\,)+TYPE_USER/gim,
|
316 | /(\ |\t|\(|\,)+COLLECTION_VALUE/gim,
|
317 | /(\ |\t|\(|\,)+COLLECTION_REPORT/gim,
|
318 | /(\ |\t|\(|\,)+COLLECTION_SECTION/gim,
|
319 | /(\ |\t|\(|\,)+COLLECTION_PAGE/gim,
|
320 | /(\ |\t|\(|\,)+TSEEK/gim,
|
321 | /(\ |\t|\(|\,)+TCACHE/gim,
|
322 | /(\ |\t|\(|\,)+TSTRUCT/gim,
|
323 | /(\ |\t|\(|\,)+TALIAS/gim,
|
324 | /(\ |\t|\(|\,)+TDESC/gim,
|
325 | /(\ |\t|\(|\,)+FSTRUCTALL/gim,
|
326 | /(\ |\t|\(|\,)+FSTRUCTFIELD/gim,
|
327 | /(\ |\t|\(|\,)+FTITLE/gim,
|
328 | /(\ |\t|\(|\,)+FTOOLTIP/gim,
|
329 | /(\ |\t|\(|\,)+FFIELD/gim,
|
330 | /(\ |\t|\(|\,)+FTYPE/gim,
|
331 | /(\ |\t|\(|\,)+FSIZE/gim,
|
332 | /(\ |\t|\(|\,)+FDECIMAL/gim,
|
333 | /(\ |\t|\(|\,)+FCOMBOBOX/gim,
|
334 | /(\ |\t|\(|\,)+FOBRIGAT/gim,
|
335 | /(\ |\t|\(|\,)+FUSED/gim,
|
336 | /(\ |\t|\(|\,)+FCONTEXT/gim,
|
337 | /(\ |\t|\(|\,)+FNIVEL/gim,
|
338 | /(\ |\t|\(|\,)+FTABLE/gim,
|
339 | /(\ |\t|\(|\,)+FPICTURE/gim,
|
340 | /(\ |\t|\(|\,)+FCONPAD/gim,
|
341 | /(\ |\t|\(|\,)+ISTRUCTALL/gim,
|
342 | /(\ |\t|\(|\,)+ISTRUCTINDEX/gim,
|
343 | /(\ |\t|\(|\,)+IDESC/gim,
|
344 | /(\ |\t|\(|\,)+IKEY/gim,
|
345 | /(\ |\t|\(|\,)+IDESC/gim,
|
346 | /(\ |\t|\(|\,)+ITABLE/gim,
|
347 | /(\ |\t|\(|\,)+PGROUP/gim,
|
348 | /(\ |\t|\(|\,)+PORDER/gim,
|
349 | /(\ |\t|\(|\,)+PGSC/gim,
|
350 | /(\ |\t|\(|\,)+PTYPE/gim,
|
351 | /(\ |\t|\(|\,)+PDESC/gim,
|
352 | /(\ |\t|\(|\,)+PPERG1/gim,
|
353 | /(\ |\t|\(|\,)+PPERG2/gim,
|
354 | /(\ |\t|\(|\,)+PPERG3/gim,
|
355 | /(\ |\t|\(|\,)+PPERG4/gim,
|
356 | /(\ |\t|\(|\,)+PPERG5/gim,
|
357 | /(\ |\t|\(|\,)+PPYME/gim,
|
358 | /(\ |\t|\(|\,)+PPICTURE/gim
|
359 | ],
|
360 | include: 'RPTDEF.CH',
|
361 | precisa: false,
|
362 | includes: []
|
363 | });
|
364 |
|
365 | this.includeExpressoes.push({
|
366 | expressoes: [
|
367 | /(\ |\t|\(|\,)+PD_ISTOTVSPRINTER/gim,
|
368 | /(\ |\t|\(|\,)+PD_DISABLEDESTINATION/gim,
|
369 | /(\ |\t|\(|\,)+PD_DISABLEORIENTATION/gim,
|
370 | /(\ |\t|\(|\,)+PD_DISABLEPAPERSIZE/gim,
|
371 | /(\ |\t|\(|\,)+PD_DISABLEPREVIEW/gim,
|
372 | /(\ |\t|\(|\,)+PD_DISABLEMARGIN/gim,
|
373 | /(\ |\t|\(|\,)+PD_TYPE_FILE/gim,
|
374 | /(\ |\t|\(|\,)+PD_TYPE_SPOOL/gim,
|
375 | /(\ |\t|\(|\,)+PD_TYPE_EMAIL/gim,
|
376 | /(\ |\t|\(|\,)+PD_TYPE_EXCEL/gim,
|
377 | /(\ |\t|\(|\,)+PD_TYPE_HTML/gim,
|
378 | /(\ |\t|\(|\,)+PD_TYPE_PDF/gim,
|
379 | /(\ |\t|\(|\,)+PD_DESTINATION/gim,
|
380 | /(\ |\t|\(|\,)+PD_PRINTTYPE/gim,
|
381 | /(\ |\t|\(|\,)+PD_ORIENTATION/gim,
|
382 | /(\ |\t|\(|\,)+PD_PAPERSIZE/gim,
|
383 | /(\ |\t|\(|\,)+PD_PREVIEW/gim,
|
384 | /(\ |\t|\(|\,)+PD_VALUETYPE/gim,
|
385 | /(\ |\t|\(|\,)+PD_MARGIN/gim,
|
386 | /(\ |\t|\(|\,)+PD_MARGIN_LEFT/gim,
|
387 | /(\ |\t|\(|\,)+PD_MARGIN_TOP/gim,
|
388 | /(\ |\t|\(|\,)+PD_MARGIN_RIGHT/gim,
|
389 | /(\ |\t|\(|\,)+PD_MARGIN_BOTTOM/gim,
|
390 | /(\ |\t|\(|\,)+PD_OK/gim,
|
391 | /(\ |\t|\(|\,)+PD_CANCEL/gim
|
392 | ],
|
393 | include: 'FWPRINTSETUP.CH',
|
394 | precisa: false,
|
395 | includes: []
|
396 | });
|
397 |
|
398 | this.includeExpressoes.push({
|
399 | expressoes: [
|
400 | /(\ |\t|\(|\,)+OLEONERROR/gim,
|
401 | /(\ |\t|\(|\,)+OLEWDLEFT/gim,
|
402 | /(\ |\t|\(|\,)+OLEWDTOP/gim,
|
403 | /(\ |\t|\(|\,)+OLEWDWIDTH/gim,
|
404 | /(\ |\t|\(|\,)+OLEWDHEIGHT/gim,
|
405 | /(\ |\t|\(|\,)+OLEWDCAPTION/gim,
|
406 | /(\ |\t|\(|\,)+OLEWDVISIBLE/gim,
|
407 | /(\ |\t|\(|\,)+OLEWDWINDOWSTATE/gim,
|
408 | /(\ |\t|\(|\,)+OLEWDPRINTBACK/gim,
|
409 | /(\ |\t|\(|\,)+OLEWDVERSION/gim,
|
410 | /(\ |\t|\(|\,)+OLEWDFORMATDOCUMENT/gim,
|
411 | /(\ |\t|\(|\,)+OLEWDFORMATTEMPLATE/gim,
|
412 | /(\ |\t|\(|\,)+OLEWDFORMATTEXT/gim,
|
413 | /(\ |\t|\(|\,)+OLEWDFORMATTEXTLINEBREAKS/gim,
|
414 | /(\ |\t|\(|\,)+OLEWDFORMATDOSTEXT/gim,
|
415 | /(\ |\t|\(|\,)+OLEWDFORMATDOSTEXTLINEBREAKS/gim,
|
416 | /(\ |\t|\(|\,)+OLEWDFORMATRTF/gim,
|
417 | /(\ |\t|\(|\,)+OLEWDFORMATUNICODETEXT/gim,
|
418 | /(\ |\t|\(|\,)+WDFORMATHTML/gim,
|
419 | /(\ |\t|\(|\,)+WDFORMATDOCUMENTDEFAULT/gim,
|
420 | /(\ |\t|\(|\,)+OLEWDFORMATHTML/gim
|
421 | ],
|
422 | include: 'MSOLE.CH',
|
423 | precisa: false,
|
424 | includes: []
|
425 | });
|
426 |
|
427 | this.includeExpressoes.push({
|
428 | expressoes: [
|
429 | /@+(\ |\t)+.+\,+.+(\ |\t)+TO+(\ |\t)+.+\,+.+(\ |\t)+DIALOG/gim,
|
430 | /@+(\ |\t)+.+\,+.+(\ |\t)+BMPBUTTON/gim
|
431 | ],
|
432 | include: 'RWMAKE.CH',
|
433 | precisa: false,
|
434 | includes: ['STDWIN.CH']
|
435 | });
|
436 | }
|
437 | public valida(objetoValidacao: ValidaAdvpl, conteudoFile: String) {
|
438 |
|
439 | let includesFonte: string[] = objetoValidacao.includes.map(
|
440 | (x: any) => x.include
|
441 | );
|
442 | let includesAnalise: string[] = this.includeExpressoes.map(
|
443 | (x: any) => x.include
|
444 | );
|
445 |
|
446 | if (
|
447 | !objetoValidacao.includes.indexOf((x: any) => x.include === 'TOTVS.CH')
|
448 | ) {
|
449 | objetoValidacao.aErros.push(
|
450 | new Erro(
|
451 | 0,
|
452 | 0,
|
453 | traduz('includes.faltaTOTVS', this.local),
|
454 | Severity.Warning
|
455 | )
|
456 | );
|
457 | }
|
458 |
|
459 |
|
460 | for (let i = 0, il = objetoValidacao.includes.length; i < il; i++) {
|
461 | let include: any = objetoValidacao.includes[i];
|
462 |
|
463 | if (this.includesObsoletos.indexOf(include.include) !== -1) {
|
464 | objetoValidacao.aErros.push(
|
465 | new Erro(
|
466 | include.linha,
|
467 | include.linha,
|
468 | traduz('includes.oInclude', this.local) +
|
469 | include.include +
|
470 | traduz('includes.SubstTOTVS', this.local),
|
471 | Severity.Warning
|
472 | )
|
473 | );
|
474 | }
|
475 |
|
476 |
|
477 | if (
|
478 | objetoValidacao.includes.findIndex(function (x: any) {
|
479 | return x.include === include.include && x.linha !== include.linha;
|
480 | }) !== -1
|
481 | ) {
|
482 | objetoValidacao.aErros.push(
|
483 | new Erro(
|
484 | include.linha,
|
485 | include.linha,
|
486 | traduz('includes.oInclude', this.local) +
|
487 | include.include +
|
488 | traduz('includes.emDuplicidade', this.local),
|
489 | Severity.Warning
|
490 | )
|
491 | );
|
492 | }
|
493 | }
|
494 |
|
495 |
|
496 | let linhas = conteudoFile.split('\n');
|
497 | let listaAnalise = [];
|
498 |
|
499 |
|
500 | for (let i = 0, il = this.includeExpressoes.length; i < il; i++) {
|
501 | let element = this.includeExpressoes[i];
|
502 | for (let i2 = 0, il2 = element.expressoes.length; i2 < il2; i2++) {
|
503 | let expressao: RegExp = element.expressoes[i2];
|
504 | if (conteudoFile.search(expressao) !== -1) {
|
505 | listaAnalise.push(element);
|
506 | break;
|
507 | }
|
508 | }
|
509 | }
|
510 |
|
511 |
|
512 | let includesFonteAll: string[] = includesFonte;
|
513 | for (let i2 = 0, il2 = objetoValidacao.includes.length; i2 < il2; i2++) {
|
514 | let element = this.includeExpressoes[
|
515 | includesAnalise.indexOf(objetoValidacao.includes[i2].include)
|
516 | ];
|
517 | if (element) {
|
518 | includesFonteAll = includesFonteAll.concat(element.includes);
|
519 | }
|
520 | }
|
521 |
|
522 |
|
523 | if (listaAnalise.length > 0) {
|
524 | for (var key in linhas) {
|
525 |
|
526 | let linha = ' ' + linhas[key];
|
527 | let linhacls = linhas[key];
|
528 |
|
529 | for (let i = 0, il = listaAnalise.length; i < il; i++) {
|
530 | let element = listaAnalise[i];
|
531 | for (let i2 = 0, il2 = element.expressoes.length; i2 < il2; i2++) {
|
532 | let expressao: RegExp = element.expressoes[i2];
|
533 | if (
|
534 | linha.search(expressao) !== -1 ||
|
535 | linhacls.search(expressao) !== -1
|
536 | ) {
|
537 | element.precisa = true;
|
538 |
|
539 | if (includesFonteAll.indexOf(element.include) === -1) {
|
540 | objetoValidacao.aErros.push(
|
541 | new Erro(
|
542 | parseInt(key),
|
543 | parseInt(key),
|
544 | traduz('includes.faltaInclude', this.local) +
|
545 | element.include +
|
546 | '!',
|
547 | Severity.Error
|
548 | )
|
549 | );
|
550 | }
|
551 | }
|
552 | }
|
553 | }
|
554 | }
|
555 | }
|
556 |
|
557 |
|
558 | for (let i2 = 0, il2 = objetoValidacao.includes.length; i2 < il2; i2++) {
|
559 | let include: any = objetoValidacao.includes[i2];
|
560 |
|
561 | let includeAnalise = this.includeExpressoes[
|
562 | includesAnalise.indexOf(include.include)
|
563 | ];
|
564 | if (includeAnalise) {
|
565 |
|
566 | for (let i = 0, il = includeAnalise.includes.length; i < il; i++) {
|
567 | let includeContido: string = includeAnalise.includes[i];
|
568 | let includeAnaliseContido =
|
569 | objetoValidacao.includes[includesFonte.indexOf(includeContido)];
|
570 | if (includeAnaliseContido) {
|
571 | includeAnaliseContido.precisa = false;
|
572 | objetoValidacao.aErros.push(
|
573 | new Erro(
|
574 | includeAnaliseContido.linha,
|
575 | includeAnaliseContido.linha,
|
576 | traduz('includes.oInclude', this.local) +
|
577 | includeAnaliseContido.include +
|
578 | traduz('includes.desnecessarioContido', this.local) +
|
579 | include.include +
|
580 | '!',
|
581 | Severity.Warning
|
582 | )
|
583 | );
|
584 | }
|
585 | }
|
586 | if (!includeAnalise.precisa) {
|
587 | objetoValidacao.aErros.push(
|
588 | new Erro(
|
589 | include.linha,
|
590 | include.linha,
|
591 | 'Include ' +
|
592 | include.include +
|
593 | traduz('includes.desnecessario', this.local),
|
594 | Severity.Warning
|
595 | )
|
596 | );
|
597 | }
|
598 | }
|
599 | }
|
600 | }
|
601 | }
|
602 |
|
603 | function traduz(key, local) {
|
604 | let locales = ['en', 'pt-br'];
|
605 | let i18n = require('i18n');
|
606 | i18n.configure({
|
607 | locales: locales,
|
608 | directory: __dirname + '/locales'
|
609 | });
|
610 | i18n.setLocale(locales.indexOf(local) + 1 ? local : 'en');
|
611 | return i18n.__(key);
|
612 | }
|