PARAMETERS lcAl3File IF TYPE('lcAl3File')="L" .OR. EMPTY(lcAl3File) && no path sent so look for it in temp folder RETURN .F. ENDIF PRIVATE lcat lcat=0 lcat=RAT("\",lcAl3File) IF lcat>0 PRIVATE lcAL3NewFile lcAL3NewFile=LEFT(lcAl3File,lcat)+'AL3.NEW' ELSE && no path available so store it in the temporary folder lcAL3NewFile=tdir+'AL3.NEW' ENDIF m.handle = FOPEN(lcAl3File,0) IF m.handle < 0 WAIT WINDOW "Could not open Download file." RETURN ELSE m.sizeof = FSEEK(m.handle,0,2) ENDIF m.output = FCREATE(lcAL3NewFile,0) IF m.output < 0 WAIT WINDOW "An error ocurred expanding the file. Press anykey..." RETURN ENDIF IF TYPE('oprogress')="O" .and. !ISNULL(oprogress) oprogress.RELEASE() ELSE oprogress = NULL RELEASE oprogress ENDIF =SYS(1104) oprogress = CREATEOBJECT('therm',m.sizeof,lcAl3File) oprogress.CAPTION = "IVANS TRANSFER - File Expansion Step 1 of 3" oprogress.VISIBLE = .T. Y=0 =FSEEK(m.handle,0) PRIVATE llabortall llabortall = .F. ON KEY LABEL ALT+F10 DO abortall DO WHILE !FEOF(m.handle) IF llabortall EXIT ENDIF m.line=FREAD(m.handle,1) Y=Y+LEN(m.line) oprogress.updatetherm(Y) IF m.line = CHR(250) m.count=Hex2Dec(FREAD(m.handle,2)) m.expChar = FREAD(m.handle,1) =FWRITE(m.output,REPLI(m.expChar,m.count)) ELSE =FWRITE(m.output,m.line) ENDIF ENDDO =FCLOSE(m.handle) =FCLOSE(m.output) FLUSH IF !llabortall IF FILE(lcAL3NewFile) IF " " $ lcAL3NewFile lcAL3NewFile = "'"+lcAL3NewFile+"'" ENDIF IF " " $ lcAl3File lcAl3File = "'"+lcAl3File+"'" ENDIF COPY FILE &lcAL3NewFile TO &lcAl3File ENDIF ENDIF IF TYPE('oprogress')="O" .and. !ISNULL(oprogress) oprogress.RELEASE() ELSE oprogress = NULL RELEASE oprogress ENDIF ON KEY LABEL ALT+F10 IF FILE(lcAL3NewFile) DELETE FILE (lcAL3NewFile) ENDIF IF llabortall RETURN .F. ELSE RETURN .T. ENDIF ************************ PROCEDURE Hex2Dec ************************ * Convert Hex 00 - FF to decimal 0 - 255 PARAMETER hexvalue2 RETURN (DECIVALUE(LEFT(hexvalue2,1))*16)+DECIVALUE(RIGHT(hexvalue2,1)) ************************ PROCEDURE DECIVALUE ************************ * Convert single hex number into decimal PARAMETER hexvalue1 RETURN AT(hexvalue1,'0123456789ABCDEF')-1 PROCEDURE abortall llabortall = .T. RETURN