算了,这问题若知其然,则很简单。我老人家自己随手写一个,将就着用吧。
****************************
* __VfpAllCode2Txt__.prg
* 功能:将当前目录下的所有源码,全部打包至AllCode.txt
* 包括:*.h *.mpr *.prg *.SCX *.VCX 和 *.DBC *
****************************
clear all
close all
set safe off
on error do DoNothing
lMyself = PROGRAM()
lPathName = JUSTPATH(sys(16))
PathName = ADDBS(lPathName)
lFileName = ""
lcAllText = "*-----------" + 0h0D0A
lCRLF = 0h0D0A + "*-----------" + 0h0D0A
SET DEFAULT TO (lPathName)
SET PATH TO (lPathName)
*--------H--------
EXTENNAME = '*.h'
FILENUM = Adir(NAMEARRAY, EXTENNAME)
FOR NCOUNT = 1 TO FILENUM
lFileName = (PATHNAME) + NAMEARRAY(NCOUNT,1)
lprg = FileToStr(lFileName)
lcAllText = lcAllText + "* " + lFileName + lCRLF + lprg + lCRLF
ENDFOR NCOUNT
*--------Mpr--------
EXTENNAME = '*.mpr'
FILENUM = Adir(NAMEARRAY, EXTENNAME)
FOR NCOUNT = 1 TO FILENUM
lFileName = (PATHNAME) + NAMEARRAY(NCOUNT,1)
lprg = FileToStr(lFileName)
lcAllText = lcAllText + "* " + lFileName + lCRLF + lprg + lCRLF
ENDFOR NCOUNT
*--------Prg--------
EXTENNAME = '*.prg'
FILENUM = Adir(NAMEARRAY, EXTENNAME)
FOR NCOUNT = 1 TO FILENUM
if upper(JUSTSTEM(NAMEARRAY(NCOUNT,1))) == upper(lMyself)
loop
endif
lFileName = (PATHNAME) + NAMEARRAY(NCOUNT,1)
lprg = FileToStr(lFileName)
lcAllText = lcAllText + "* " + lFileName + lCRLF + lprg + lCRLF
ENDFOR NCOUNT
*---------Form--------
EXTENNAME = '*.SCX'
FILENUM = Adir(NAMEARRAY, EXTENNAME)
FOR NCOUNT = 1 TO FILENUM
lFileName = (PATHNAME) + NAMEARRAY(NCOUNT,1)
*
COMPILE FORM (lFileName)
use (lFileName)
pack
scan
lobjname = objname
lMethods = Methods
if ! EMPTY(lMethods)
lcAllText = lcAllText + "* " + lFileName + " : " + lobjname + lCRLF + lMethods + lCRLF
endif
endscan
ENDFOR NCOUNT
*--------Visual Class--------
EXTENNAME = '*.VCX'
FILENUM = Adir(NAMEARRAY, EXTENNAME)
FOR NCOUNT = 1 TO FILENUM
lFileName = (PATHNAME) + NAMEARRAY(NCOUNT,1)
*
COMPILE CLASSLIB (lFileName)
use (lFileName)
pack
scan
lobjname = objname
lMethods = Methods
if ! EMPTY(lMethods)
lcAllText = lcAllText + "* " + lFileName + " : " + lobjname + lCRLF + lMethods + lCRLF
endif
endscan
ENDFOR NCOUNT
*--------DBC--------
EXTENNAME = '*.DBC'
FILENUM = Adir(NAMEARRAY, EXTENNAME)
FOR NCOUNT = 1 TO FILENUM
lFileName = (PATHNAME) + NAMEARRAY(NCOUNT,1)
*
COMPILE DATABASE (lFileName)
use (lFileName)
pack
locate for objectName = 'StoredProceduresSource'
lMethods = code
if ! EMPTY(lMethods)
lcAllText = lcAllText + "* " + lFileName + lCRLF + lMethods + lCRLF
endif
ENDFOR NCOUNT
strToFile(lcAllText, 'AllCode.txt')
CLOSE ALL
CLEAR ALL
*QUIT
PROCEDURE DoNothing
return