on new me,mydemofield,mycategoryfield,myImageMember,myVideoSprite,loadflag
global resources
set videoSprite=myVideoSprite
set imageMember=the number of member(myImageMember)
set imageSprite=castsprite(me,myImageMember)
puppetsprite imageSprite,true
if getpos(the actorlist,resources)>0 then
set pos=getpos(the actorlist,resources)
deleteat the actorlist,pos
end if
set IDName="ResourcesClass"
if loadflag then
loadfile me
else
loadcast me
end if
set resources=me
set browser=#undefined
set catlist=[]
set defaultprotocol="http://"
set defaultURL="www.bootnet.com"
getBrowserPath me
set defaultCatPhrase="All Demos"
set activerec=0
set shortinterval=5*60
set longinterval=40*60
set targetticks=0
set IsCycling=false
if not voidP(myDemoField) then
assigndemofield me,mydemofield
assigncategoryfield me,mycategoryfield
end if
return me
end
on loadcast me
set systemlist=value(the text of member "SystemInfoList")
if not voidP(systemlist) then
set restextlist=getprop(systemlist,IDName)
set reslist=the reslist of restextlist
-- set IDName=the IDName of restextlist
else
alert "The list in ""e&"ResourcesList"&" has become corrupt. Please reload from the source file."
halt
end if
end
on loadfile me
set file=fileIO(mNew,"?read","rsc")
if objectP(file) then
set restext=file(mReadfile)
file(mDispose)
repeat with index=1 to the number of lines in restext
if chartonum(char 1 of line index of restext)=10 then
delete char 1 of line index of restext
end if
if chartonum(char 1 of line index of restext)=10 then
delete line index of restext
end if
end repeat
else
alert ("No file was selected.")
halt
end if
parsefile me,restext
end
on parsefile me,restext
set reslist=[:]
set reclist=[:]
set olddelimiter=the itemdelimiter
set the itemdelimiter=tab
set baseline=line 1 of restext
repeat with index=1 to the number of items in baseline
addprop reclist,value(item index of baseline),0
end repeat
repeat with curlineindex=2 to the number of lines in restext
if the number of items in line curlineindex of restext=count(reclist) then
set newlist=duplicate(reclist)
set curline=line curlineindex of restext
repeat with index=1 to the number of items in curline
if item index of curline=#none then
setprop newlist,getpropat(newlist,index),#none
else
setprop newlist,getpropat(newlist,index),item index of curline
end if
end repeat
addprop reslist,getat(newlist,1),newlist
end if
end repeat
put "File parsed"
set the itemdelimiter=olddelimiter
updateSystemInfoList me
-- put reslist
end
on assignDemoField me,demofieldname
set demofield=demofieldname
set the textstyle of member demofield to "plain"
set rt=RETURN
set buffer="on mouseDown"&rt
set buffer=buffer&" set curline=the mouseline"&rt
set buffer=buffer&" set demotext=the text of field ""e&demofield"e&rt
set buffer=buffer&" if curline>0 and curline<=the number of lines in demotext then"&rt
set buffer=buffer&" global resources"&rt
set buffer=buffer&" set obj=resources"&rt
set buffer=buffer&" set rec=getrecord(obj,line curline of demotext)"&rt
set buffer=buffer&" set the fontstyle of member ""e&demofield"e&" to ""e&"plain""e&rt
set buffer=buffer&" set the fontstyle of line curline of field ""e&demofield"e&" to ""e&"bold""e&rt
set buffer=buffer&" showRecord obj,rec"&rt
set buffer=buffer&" set the targetticks of obj=the ticks+the longinterval of obj"&rt
set buffer=buffer&" end if"&rt
set buffer=buffer&"end"
set the scripttext of member demofield to buffer
end
on assignCategoryField me,categoryfieldname
set categoryfield=categoryfieldname
set the textstyle of member categoryfield to "plain"
set rt=RETURN
global resources
getCategories me
set buffer="on mouseDown"&rt
set buffer=buffer&" set curline=the mouseline"&rt
set buffer=buffer&" set cattext=the text of field ""e&categoryfield"e&rt
set buffer=buffer&" if curline>0 and curline<=the number of lines in cattext then"&rt
set buffer=buffer&" global resources"&rt
set buffer=buffer&" set obj=resources"&rt
set buffer=buffer&" set the fontstyle of member ""e&categoryfield"e&" to ""e&"plain""e&rt
set buffer=buffer&" set the fontstyle of line curline of field ""e&categoryfield"e&" to ""e&"bold""e&rt
set buffer=buffer&" getbycategory(obj,line curline of cattext)"&rt
set buffer=buffer&" set the targetticks of obj=the ticks+the shortinterval of obj"&rt
set buffer=buffer&" end if"&rt
set buffer=buffer&"end"
set the scripttext of member categoryfield to buffer
set the textstyle of member categoryfield to "plain"
set the textstyle of line 1 of member categoryfield to "bold"
getall(me)
end
on getBrowserPath me
if browser=#undefined then
set file=fileIO(mNew,"read","c:\windows\bootcd.ini")
if (objectP(file)) then
set myline="temp"
repeat while myline<>""
set myline=file(mReadLine)
if offset("browser=",myline)>0 then
set browser=char 9 to length(myline) of myline
exit repeat
end if
end repeat
file(mDispose)
if browser=#undefined then
alert("You have not yet specified a browser for your use. Could you locate the browser you wish to use?")
set file=fileIO(mNew,"?read","exe")
if objectP(file) then
set browser=file(mFileName)
file(mDispose)
set file=fileIO(mNew,"write","c:\windows\bootcd.ini")
file(mWriteString,"browser="&browser)
file(mDispose)
else
alert("You have opted not to choose a browser this session. If you change your mind, you can set the browser path in the bootNet section of this application.")
set browser=#none
end if
end if
else
alert("You have not yet specified a browser for your use. Could you locate the browser you wish to use?")
set file=fileIO(mNew,"?read","exe")
if objectP(file) then
set browser=file(mFileName)
file(mDispose)
set file=fileIO(mNew,"write","c:\windows\bootcd.ini")
file(mWriteString,"browser="&browser)
file(mDispose)
else
alert("You have opted not to choose a browser this session. If you change your mind, you can set the browser path in the bootNet section of this application.")
set browser=#none
end if
end if
end if
return browser
end
on getrecord me,myAppname
set activeRec=getprop(the reslist of me,myAppName)
return activeRec
end
on getexepath me,myAppname
set rec=getrecord(me,myAppname)
if the platform of rec="Mac" then
set path=the moviepath&":"&(the appfolder of rec)&":"&(the exename of rec)
else
set path=the moviepath &(the appfolder of rec)&"\"&(the exename of rec)
end if
return path
end
on getreadmepath me,myAppname
set rec=getrecord(me,myAppname)
if the platform of rec="Mac" then
set path=the moviepath&":"&(the appfolder of rec)&":"&(the readmename of rec)
else
set path=the moviepath &(the appfolder of rec)&"\"&(the readmename of rec)
end if
return path
end
on getAll me
set buffer=""
set templist=[]
sort templist
repeat with recindex=1 to count(reslist)
set rec=getat(reslist,recindex)
add templist,the appname of rec
end repeat
repeat with recname in templist
set buffer=buffer&(recname)&return
end repeat
delete char(length(buffer)) of buffer
if demofield="" then
put buffer
else
put buffer into field demofield
end if
return buffer
end
on getByCategory me,whichcategory
set buffer=""
set templist=[]
sort templist
repeat with recindex=1 to count(reslist)
set rec=getat(reslist,recindex)
if offset(whichcategory,the category of rec)>0 then
repeat with itemindex=1 to the number of items in the category of rec
if item itemindex of the category of rec=whichcategory then
add templist,the appname of rec
set itemindex=the number of items in the category of rec+2
end if
end repeat
else
if whichcategory=defaultcatphrase then
add templist,the appname of rec
end if
end if
end repeat
repeat with recname in templist
set buffer=buffer&(recname)&return
end repeat
delete char(length(buffer)) of buffer
if demofield="" then
put buffer
else
set the textstyle of member demofield to "plain"
set the text of member demofield to buffer
set the textstyle of line 1 of member demofield to "bold"
getrecord me,line 1 of field demofield
showrecord me
end if
return buffer
end
on getCategories me
set buffer=""
set catlist=[]
add catlist,defaultcatphrase
repeat with recindex=1 to count(reslist)
set rec=getat(reslist,recindex)
repeat with index=1 to the number of items in the category of rec
if getpos(catlist,item index of the category of rec)=0 then
add catlist,item index of the category of rec
end if
end repeat
end repeat
repeat with index=1 to count(catlist)
set buffer=buffer&getat(catlist,index)&return
end repeat
delete char(length(buffer)) of buffer
if categoryfield="" then
put buffer
else
set the textstyle of member categoryfield to "plain"
set the text of member categoryfield to buffer
end if
return buffer
end
on describe me
put "ResourcesClass"
put "Resources Class,a Director Object for handling demo file access"
put "by Kurt Cagle, Imagine Publishing, copyright 1996"
end
on updateSystemInfoList me
set systemlist=[:]
if the number of member "SystemInfoList"<1 then
set systemlist=[:]
set sysmember=findEmpty(member 1)
repeat with index=1 to the maxInteger
if the type of member index=#field then
duplicate member index, sysmember
exit repeat
end if
end repeat
set the name of member sysmember to "SystemInfoList"
set the text of member sysmember to "[:]"
else
set sysmember=the number of member ("SystemInfoList")
set systemlist=value(the text of member sysmember)
if systemlist=0 then
set systemlist=[:]
end if
end if
set proplist=[:]
repeat with index=1 to count(me)
set prop=getpropat(me,index)
set entry=getprop(me,prop)
if voidP(entry) then set entry=0
addprop proplist,prop,entry
end repeat
if voidP(getaprop(systemlist,IDName)) then
addprop systemlist,IDName,proplist
else
setprop systemlist,IDName,proplist
end if
set the text of member sysmember to string(systemlist)
end
on launchURL me,URL
if browser<>#none then
puppetsound 0
puppetsound "PULSE0"&string(random(5))&".AIF"
if voidP(URL) then
if activerec=0 then
set URL=defaultprotocol&defaultURL
else
set URL=defaultprotocol&the URL of activerec
end if
end if
open browser&&URL
if the freeblock<500000 then
alert "There is insufficient memory to keep both the boot Disc and your browser open, so bootDisc will quit. Double click on the bootDisc icon to relaunch."
halt
end if
else
alert "No browser has been defined for use."
end if
end
on launchApp me
if activerec=0 then
alert("You must select an application to launch.")
end if
repeat with index=3 to 27
set drive=numtochar(64+index)
if fileExists(me,drive&":\bootcd\keylock.rsc") then
exit repeat
end if
end repeat
if drive=numtochar(91) then
alert("The bootCD was not found. Please insert it into your disk drive to launch any applications.")
exit
end if
puppetsound 0
puppetsound "PULSE0"&string(random(5))&".AIF"
if the platform of activerec="DOS" then
set basepath="explorer.exe "&drive&":\bootcd\apps\"&(the appfolder of activerec)
else
set basepath=drive&":\bootcd\apps\"&(the appfolder of activerec)&"\"&(the exename of activerec)
end if
-- alert basepath
open basepath
if the freeblock<500000 then
alert "There is insufficient memory to keep both the boot Disc and your browser open, so bootDisc will quit. Double click on the bootDisc icon to relaunch."
halt
end if
end
on fileExists me,filename
set file=fileIO(mNew,"read",filename)
if objectP(file) then
file(mDispose)
return true
else
return false
end if
end
on getBasePath me
if activerec=0 then
alert("You must select an application to launch.")
end if
repeat with index=3 to 27
set drive=numtochar(64+index)
if fileExists(me,drive&":\bootcd\keylock.rsc") then
exit repeat
end if
end repeat
if drive=numtochar(91) then
alert("The bootCD was not found. Please insert it into your disk drive to launch any applications.")
exit
end if
set basepath=drive&":\bootcd\apps\"&(the appfolder of activerec)&"\"
return basepath
end
on cycle me
if activerec=0 then
getrecord me,line (the number of lines in field demofield) of field demofield
end if
set app=the appname of activerec
set curtext=the text of field demofield
repeat with index=1 to the number of lines in field demofield
set curline=line index of curtext
if app=curline then
set cycleIndex=index
exit repeat
end if
end repeat
if cycleindex=the number of lines in curtext then
set cycleindex=1
else
set cycleindex=cycleindex+1
end if
set app=line cycleindex of curtext
set the fontstyle of member demofield to "plain"
set the fontstyle of line cycleindex of field demofield to "bold"
getrecord me,app
showrecord me,app
showTitle me
set targetticks=the ticks+shortinterval
end
on showrecord me
set rt=RETURN
puppetsound 0
puppetsound "LED0"&string(random(5))&".AIF"
if not IsCycling then showTitle me
set the fontstyle of member "Description" to "plain"
set the text of member "Description" to (the description of activerec)&rt&"System Requirements"&rt&(the system of activerec)&rt&"Special Instructions"&rt&(the instructions of activerec)
showTitle me
global videoBtns
set the membernum of sprite imagesprite to the number of member (strip(me,the imagepath of activerec,".bmp"))
updateStage
playVideo videoBtns
setstate videoBtns,not(the dvpath of activerec="#none")
end
on strip me,imagename,extension
set pos=offset(extension,imagename)
if pos>0 then
delete char pos to pos+length(extension)-1 of imagename
end if
-- alert(imagename)
return imagename
end
on startCycle me
if getpos(the actorlist,me)=0 then
add the actorlist me
set interval=shortinterval
set IsCycling=true
end if
end
on stepframe me
if the ticks>targetticks then
cycle me
end if
end stepframe me
on endCycle me
set pos=getpos(the actorlist,me)
if pos>0 then
deleteat the actorlist,pos
end if
set IsCycling=false
end
on castsprite me,whichcast
set curcast=the number of member whichcast
set spritenum=0
if curcast>0 then
repeat with index=1 to 48
if the membernum of sprite index=curcast then
set spritenum=index
exit repeat
end if
end repeat
end if
return spritenum
end
on hideTitle me
-- if the text of member "Title"=the appname of activerec then exit
-- exit
if spritelist=0 then
set spritelist=[]
add spritelist,castsprite(me,"Title")
add spritelist,castsprite(me,"TitleLight")
add spritelist,castsprite(me,"TitleDark")
end if
repeat with index=1 to count(spritelist)
set the visible of sprite getat(spritelist,index) to false
end repeat
end
on showTitle me
-- if the text of member "Title"=the appname of activerec then exit
-- exit
if spritelist=0 then
set spritelist=[]
add spritelist,castsprite(me,"Title")
add spritelist,castsprite(me,"TitleLight")
add spritelist,castsprite(me,"TitleDark")
end if
repeat with index=1 to count(spritelist)
set the text of member (the membernum of sprite getat(spritelist,index)) to the appname of activerec
end repeat
repeat with index=1 to count(spritelist)
set the visible of sprite getat(spritelist,index) to true
end repeat
end
on getNextCategory me
hidetitle me
repeat while the frame<>label("doorsclosed")
go to the frame+1
end repeat
set whichcategory=line 1 of the text of member categoryfield
set pos=getpos(catlist,whichcategory)
set pos=pos+1
if pos>count(catlist) then
set pos=1
end if
set the text of member categoryfield to getat(catlist,pos)
getByCategory me,getat(catlist,pos)
set targetticks=the ticks+1*60
set activerec=0
global videobtns
setstate videobtns,false
end
on getPreviousCategory me
hidetitle me
repeat while the frame<>label("doorsclosed")
go to the frame+1
end repeat
set whichcategory=line 1 of the text of member categoryfield
set pos=getpos(catlist,whichcategory)
set pos=pos-1
if pos=0 then
set pos=count(catlist)
end if
set the text of member categoryfield to getat(catlist,pos)