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
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
else
alert "No browser has been defined for use."
end if
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
set targetticks=the ticks+shortinterval
end
on showrecord me
updateTitle me
end
on startCycle me
if getpos(the actorlist,me)=0 then
add the actorlist me
set interval=shortinterval
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
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 updateTitle me
-- exit
set spritelist=[]
add spritelist,castsprite(me,"Title")
add spritelist,castsprite(me,"TitleLight")
add spritelist,castsprite(me,"TitleDark")
repeat with index=1 to count(spritelist)
set the visible of sprite getat(spritelist,index) to false
end repeat
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