/*
-------------------------------------------------------------------------------
SAD-DOWNLOAD DIR v1.0 ©1995 Fli7e/SAD
=====================================

Limitations:    -=> Maximum of 9 Filedirs/Conf

Options:	-=> Get amount of Filedirs from "conf/NDIRS"
		-=> Different Configfiles depending on ACCESSLEVEL

Future Plans:	-=> Add other archiver like ZIP, LZX ... ->OPTIONAL<-
                -=> ConfConfig.info, Access.info and Relative conferences
                    usage instead of different configfiles

-------------------------------------------------------------------------------
*/
PARSE ARG NODE;OPTIONS RESULTS;NODEID="AERexxControl"||NODE;ADDRESS VALUE NODEID;SIGNAL ON ERROR;SIGNAL ON SYNTAX;SIGNAL ON IOERR;GU=GETUSER;GU 105;access=result;QU=Query;TR=TRANSMIT;SS=SENDSTRING;SF=SHOWFILE;CLS= d2c(12);GC=GETCHAR;LF= D2C('10');CR= D2C('13');ZMODEMRECEIVE=138;ZMODEMSEND=137;doordir="doors:sceptic/F!-DownLoadDir";SepLine="[34m- -- --- ------------------------------------------------------------- --- -- -[0m";if exists(doordir"/SAD-DLD."access".cfg") then call load;if ~exists(doordir"/SAD-DLD."access".cfg") then call noload;noload:TR "";TR Sepline;TR Center("[36mI`m sorry to say: There`s no Configfile for [33mYOUR [36mlevel!",79+15);TR "";TR Center("[36mAt the moment your level is [32m"access"[36m! Maybe ask the SYSOP why",79+15);TR Center("[36mhe locked the access to this Door for THIS level![0m",79+9);TR Sepline;TR "";shutdown;exit;end;load:open(cfg,doordir"/SAD-DLD."access".cfg","R");Interpret ReadLN(cfg);I=1;Do until I=Amount+1;Interpret readln(cfg);name.i=name;I=I+1;end;I=1;Do until I=Amount+1;Interpret readln(cfg);location.i=location;I=I+1;end;call close(cfg);UP=8;Down=2;XMIN=1;XMAX=Amount;start:SS CLS;TR "[25C[36m·[0m";TR "[12C[36m_____________:____[31m  [34m·[36m___________________________[0m";TR "[12C[36m\[34m___[31m       [34m______/[31m  [34m:[31m      [34m/[36m____[31m [34m____/[36m__[31m  [34m_____/[36m______[31m [36m_[0m";TR "[12C[36m\[34m_[36m\[34m__[31m     [34m_____/[31m    [34m¡[31m     [34m/[31m    [34m/[36m__/[31m    [34m/___[31m       [34m___/_/[0m";TR "[14C[36m\[34m_[36m\[34m__[31m      [34m|[31m  [36m__[31m  [34m![31m         [34m/[31m       [34m/[31m   [36m/[31m      [34m__/_/[0m";TR "[16C[36m\[34m_[36ml[34m______![31m [36m_\[34m/[36m_[31m [34m:________/_______/___________/_/[0m";TR "[25C[36m:[31m [36m\[34m/[36m\[34m/[31m [34m.[0m";TR "[25C[36m.[31m  [33mF![0m";TR Sepline;TR "[33mS[36m/[34m\[33mD [32mDownload Dir [35mv1.0                                      [35m©1995 [32mFli7e of [33mS[36m/[34m\[33mD[0m";TR Sepline;restart:TR "[11H";getuser 525;Linenum=11;I=XMIN;Do until I=XMAX+1;TR "["I+Linenum+1";16H[34m-=%#[35m(  [36m"center(name.i,35)"  [35m)[34m#%=-[0 p";I=I+1;end;I=Xmin;TR "";TR Sepline;TR "[33m8[35m=[36mMARKER UP           [33m2[35m=[36mMARKER DOWN           [33mENTER[35m=[36mSelect           [33mSPACE[35m=[36mQUIT  [0m";TR Sepline;ELinenum=Linenum+XMAX+4;TR "["I+Linenum+1";22H[44m[34m>[33m"center(name.i,35)"[34m<[0m[0 p";do until Ans=CR;loop:Getchar;Ans=strip(upper(Result));If ans=up&I>XMIN then;do;TR "["I+Linenum+1";22H[0m[0 p [36m"center(name.i,35)"[0m ";I=I-1;call Showx;end;If ans=up&I=XMIN then I=XMIN;If ans= down&I<XMAX then;do;TR "["I+Linenum+1";22H[0m[0 p [36m"center(name.i,35)"[0m ";I=I+1;call Showx;end;If ans= down&I=XMAX then I=XMAX;If ans=CR then call shwbull;If ans="" then call exit;else call loop;end;showx:TR "["I+Linenum+1";22H[44m[34m>[33m"center(name.i,35)"[34m<[0m[0 p";TR "[A[A";CALL loop;SHWBULL:open(ndir,location.i"/ndirs","R");maxdir=readln(ndir);If maxdir>9 then maxdir=9;call close(ndir);TR "["elinenum"H"Center("[36mWhich Dir do you like to download: [34m[[33m1[35m-[33m"maxdir"[35m,[33mA[34m][0m [34m([33mSPACE [32mto abort[34m)[0m[0 p",79+73);choose:J=1;GC;ANS=UPPER(STRIP(RESULT));DO until J=maxdir+1;IF ANS=J THEN CALL doone;J=J+1;END;IF ANS="" THEN CALL restart;IF ANS="A" THEN CALL doall;else call choose;END;doall:TR "["elinenum"H"Center("[36mYou`re about to download [33m"maxdir" [36mdirfile([35ms[36m)! Stay tuned ... Packing LHA![0m[0 p",79+34);filename="DLD-"compress(translate(time(),"",":"));address command("c:lha a ram:"filename" "location.i"/dir#?");open(myadd,"ram:SAD-DLD-v1.0","W");writeln(myadd,center("Created using",79)||"0a"x||center("-> SAD-DLD v1.0 by FLI7e/SAD 1995 <-",79));call close(myadd);address command("c:lha m ram:"filename" ram:SAD-DLD-v1.0");address command("c:lha d ram:"filename" #?.info");call dlp;doone:TR "["elinenum"H"Center("[36mYou`re about to download Dir[33m"j" [36m! Wanna pack it? [34m[[33mY[35mes[34m,[33mN[35mo[34m,[33mA[35mbort[34m][0m[0 p",79+74);choose1:GC;ANS=UPPER(STRIP(RESULT));IF ANS="Y" THEN CALL packone;IF ANS="A" THEN CALL restart;IF ANS="N" THEN CALL nopackone;else call choose1;END;packone:if exists(location.i"/dir"j) then call itsthere;if ~exists(location.i"/dir"j) then call itsnotthere;end;itsthere:TR "["elinenum"H"Center("[33mFound wanted Dirfile & packing LHA! Stay tuned![0m[0 p",79+14);filename="DLD-"compress(translate(time(),"",":"));address command("c:lha a ram:"filename" "location.i"/dir"j);open(myadd,"ram:SAD-DLD-v1.0","W");writeln(myadd,center("Created using",79)||"0a"x||center("-> SAD-DLD v1.0 by FLI7e/SAD 1995 <-",79));call close(myadd);address command("c:lha m ram:"filename" ram:SAD-DLD-v1.0");call dlp;itsNOTthere:TR "["elinenum"H"Center("[33mCan`t find wanted Dirfile![0m",79+9);call exit;dlp:PUTUSTR "ram:"filename".lha";PUTUSER 137;address command("c:delete >nil: ram:"filename".lha");call start;end;nopackone:TR "["elinenum"H"Center("[33mHere we go![0m",79+9);dlnp:filename="DLD-"compress(translate(time(),"",":"))".txt";address command("c:copy "location.i"/dir"j" ram:"filename);PUTUSTR "ram:"filename".lha";PUTUSER 137;address command("c:delete >nil: ram:"filename".lha");call start;end;ERROR:TR;TR "Error in Line #"Sigl" : exiting ...";TR ERRORTEXT(Sigl);call quit;END;SYNTAX:TR;TR "Error in Line #"Sigl" : exiting ...";TR ERRORTEXT(Sigl);call quit;END;IOERR:TR;TR "IO Error in Line #"Sigl" : exiting ...";TR ERRORTEXT(Sigl);call quit;END;exit:TR "["Elinenum+1"H[0m[ p";Shutdown;exit;end;ERROR:TR;TR "Error in Line #"Sigl" : exiting ...";TR ERRORTEXT(Sigl);CALL EXIT;END;Syntax:TR;TR "Syntax Error in Line #"Sigl" : exiting ...";TR ERRORTEXT(Sigl);CALL EXIT;END;IOERR:TR;TR "I/O Error in Line #"Sigl" : exiting ...";TR ERRORTEXT(Sigl);CALL EXIT;END