home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windoware
/
WINDOWARE_1_6.iso
/
winutil
/
fc-11f
/
wwwzip.dl$
< prev
next >
Wrap
Text File
|
1992-07-29
|
9KB
|
241 lines
; WWWZIP.DLL
ErrMsg=""
If !FileExist("wwwdos.bat") Then ErrMsg="WWWDOS.BAT not found"
If !FileExist("wwwdosp.pif") Then ErrMsg="WWWDOSP.PIF not found"
If !FileExist("wwwdosc.pif") Then ErrMsg="WWWDOSC.PIF not found"
If !FileExist("wwwzipls.exe") Then ErrMsg="WWWZIPLS.EXE not found"
If !FileExist("pkzip.exe") Then ErrMsg="PKZIP.EXE not found"
If !FileExist("pkunzip.exe") Then ErrMsg="PKUNZIP.EXE not found"
If !FileExist("browser.exe") Then ErrMsg="BROWSER.EXE not found"
If ErrMsg!="" Then Goto ShowError
goto %param1% ; must be ZIP or UNZIP
:ZIP
DaMove=" -a "
DaDirs=""
DaWho="*.*"
DaZip=""
DaRefresh=0
DaTitle="Files"
param3=strlower(param3)
if param3=="move" then DaMove=" -m "
goto %param2% ; Must be CURRENT, DIR, SUBDIR, or HILITED
:CURRENT
DaWho=strcat(CurrentPath(),CurrentFile())
DaZip=strcat(FileRoot(DaWho),".ZIP")
goto ZIPDO
:SUBDIR
DaDirs=" -r -p "
DaRefresh=1
DaTitle="Structure"
goto ZIPDO
:HILITED
b=FileItemize("")
If b=="" Then ErrMsg="Zip Hilited files? No files hilited!"
Then Goto ShowError
b=strreplace(b," ",CR)
fp=FileOpen("FC-TEMP9.XCV","WRITE")
FileWrite(fp,b)
FileClose(fp)
Drop(b)
DaWho="@FC-TEMP9.XCV"
goto ZIPDO
:DIR
DaTitle="Directory"
goto ZIPDO
:ZIPDO
DaZip=AskLine("Zip %DaTitle%","Enter desired ZIP name",DaZip)
if DaZip=="" then goto cancel
Runwait("wwwdosc.pif","pkzip.exe %DaMove% %DaDirs% %DaZip% %DaWho%")
if DaWho=="FC-TEMP9.XCV" then FileDelete(DaWho)
Refresh(DaRefresh)
Display(3,"Zip %DaTitle%","Complete")
goto cancel
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:UNZIP
ViewFlag=0
zipsort=param3
goto %param2% ; must be ALL, VIEW, or INDIV
:ALL
zipfile=strcat(CurrentPath(),CurrentFile())
if FileExtension(zipfile)=="ZIP" then goto alldoit
zipfile=FileItemize("*.zip")
If zipfile=="" Then ErrMsg="UnZip files? No zip files found!"
Then Goto ShowError
zipfile=itemselect("Select file to UnZip",zipfile," ")
if zipfile=="" then goto cancel
:alldoit
if param3==2 then goto allspec
runwait("wwwdosc.pif","pkunzip.exe -d %zipfile%")
Refresh(1)
goto cancel
:allspec
RetHome="allspec1"
goto DoOptions
:allspec1
if overwarn==0 then overwarn=" -o "
else overwarn=""
RunWait("wwwdosc.pif", "pkunzip.exe -d %overwarn% %zipfile% %targdir% *.*")
Refresh(1)
goto cancel
:INDIV
ViewFlag=param3
if ViewFlag==1 then zipsort=1
then overwarn=0
then targdir=""
then goto VIEW
RetHome="VIEW"
goto DoOptions
:VIEW
workdir = Environment("TEMP")
If workdir == "" Then workdir = DirWindows(0)
If StrSub(workdir, StrLen(workdir), 1) != "\" Then workdir = StrCat(workdir, "\")
if ViewFlag==0 then targdir=workdir
zipfile=strcat(CurrentPath(),CurrentFile())
if FileExtension(zipfile)=="ZIP" then goto viewdoit
zipfile=FileItemize("*.zip")
If zipfile=="" Then ErrMsg="UnZip files? No zip files found!"
Then Goto ShowError
if ViewFlag==0 then TSMsg="Select ZIP file to view"
else TSMsg="Select ZIP file to use"
zipfile=itemselect(TSMsg,zipfile," ")
if zipfile=="" then goto cancel
:viewdoit
ziplist = StrCat(workdir, "wwwunzip.lst")
If FileExist(ziplist) Then FileDelete(ziplist)
RunWait("wwwzipls.exe","%zipfile% %ziplist% %zipsort%")
if ViewFlag==0 then TSMsg="Select file to view"
else TSMsg="Select file to extract"
:TXSEL
OldFont=IntControl(28,1,0,0,0) ; Set fixed pitch font in text box
member=TextBox(TSMsg,ziplist)
IntControl(28,OldFont,0,0,0) ; Restore previous font pitch type
if member=="" then goto CANCEL
member=strsub(member,46,strlen(member)-45)
memfile=FileExtension(member)
if memfile!="" then memfile=strcat(FileRoot(member),".",memfile)
else memfile=FileRoot(member)
if ViewFlag==0 then goto extract
if overwarn==0 then goto extract
If FileExist("%targdir%%memfile%") == @FALSE Then Goto extract
b= AskYesNo("%member% already exists in %targdir%", "Do you wish to replace it?")
If b == @NO Then Goto TXSEL
:extract
RunHideWait("wwwdosc.pif", "pkunzip.exe -o %zipfile% %targdir% %member%")
If !FileExist("%targdir%%memfile%") Then ErrMsg="Problem extracting %member% from ZIP file"
Then Goto ShowError
if ViewFlag!=0 then TSMsg="Extract Another?"
then goto TXSEL
member = StrUpper(StrCat(targdir, memfile))
RunZoomWait("browser.exe", member)
FileDelete(member)
TSMsg="View Another?"
goto TXSEL
:SHOWERROR
Message("Error", ErrMsg)
:CANCEL
if IsDefined(ziplist) then If FileExist(ziplist) Then FileDelete(ziplist)
Drop(DaMove,DaDirs,DaWho,DaZip,DaRefresh,DaTitle,ViewFlag,zipsort)
Drop(zipfile,b,RetHome,overwarn,targdir,workdir,ziplist,TSMsg,member)
Drop(ErrMsg,usecurdir,ThisDir,CheckDir,memfile)
Drop(ZippyFormat,ZippyCaption,ZippyX,ZippyY,ZippyWidth,ZippyHeight)
Drop(ZippyNumControls,Zippy01,Zippy02,Zippy03,Zippy04,Zippy05,Zippy06)
Drop(Zippy07,Zippy08,Zippy09,Zippy10,Zippy11,Zippy12,Zippy13)
exit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:DOOPTIONS
zipsort = IniReadPvt("WWWUNZIP", "SortOrder", 1, "www-prod.ini")
overwarn=IniReadPvt("WWWUNZIP","OverWarn",1,"www-prod.ini")
whichdir=IniReadPvt("WWWUNZIP","WhichDir",1,"www-prod.ini")
; Undocumented, new, beta dialog function being used here. Will
; be documented in the 2.0 release. Good Luck.
ZippyFormat=`WWWDLGED,4.0`
ZippyCaption=`Zip Options`
ZippyX=69
ZippyY=85
ZippyWidth=217
ZippyHeight=115
ZippyNumControls=13
Zippy01=`6,18,80,DEFAULT,RADIOBUTTON,whichdir,"Use Current Dir ->",1`
Zippy02=`6,32,80,DEFAULT,RADIOBUTTON,whichdir,"Use Specified Dir ->",2`
Zippy03=`86,32,124,DEFAULT,EDITBOX,targdir,""`
Zippy04=`16,64,56,DEFAULT,RADIOBUTTON,zipsort,"by Name",1`
Zippy05=`16,76,58,DEFAULT,RADIOBUTTON,zipsort,"by Extension",2`
Zippy06=`16,88,46,DEFAULT,RADIOBUTTON,zipsort,"by Date",3`
Zippy07=`16,100,46,DEFAULT,RADIOBUTTON,zipsort,"by Size",4`
Zippy08=`108,58,80,DEFAULT,CHECKBOX,overwarn,"Warn on Overwrite",1`
Zippy09=`120,78,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Ok",1`
Zippy10=`120,98,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0`
Zippy11=`6,4,64,DEFAULT,STATICTEXT,NONAME,"Target Directory"`
Zippy12=`6,52,64,DEFAULT,STATICTEXT,NONAME,"Sort list by:"`
Zippy13=`88,20,122,DEFAULT,VARYTEXT,ThisDir,""`
:gettarg
; Undocumented, new, beta dialog function being used here. Will
; be documented in the 2.0 release. Good Luck.
ThisDir=DirGet()
targdir = IniReadPvt("WWWUNZIP", "TargetDir", DirGet(), "www-prod.ini")
Dialog("Zippy")
if whichdir==1 then usecurdir = @YES
then targdir=ThisDir
else usecurdir = @NO
targdir = StrUpper(targdir)
If targdir == "" Then usecurdir = @YES
Then targdir = DirGet()
If StrSub(targdir, StrLen(targdir), 1) != "\" Then targdir = StrCat(targdir, "\")
If ThisDir==targdir then usecurdir = @YES
then goto targok
DirChange(targdir)
CheckDir=DirGet()
DirChange(ThisDir)
If ThisDir!=CheckDir Then Goto targok
b= AskYesNo("WWWUNZIP", "%targdir% does not exist. Do you wish to create it?")
If b == @NO Then Goto gettarg
DirMake(targdir)
DirChange(targdir)
CheckDir=DirGet()
DirChange(ThisDir)
If ThisDir!=CheckDir Then Goto targok
Message("WWWUNZIP","%targdir% could not be created. Please respecify.")
goto gettarg
:targok
If usecurdir == @NO Then IniWritePvt("WWWUNZIP", "TargetDir", targdir, "www-prod.ini")
IniWritePvt("WWWUNZIP", "SortOrder", zipsort, "www-prod.ini")
IniWritePvt("WWWUNZIP", "OverWarn", overwarn, "www-prod.ini")
IniWritePvt("WWWUNZIP", "WhichDir", whichdir, "www-prod.ini")
goto %RetHome%