Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("maxintosh/mAPI")
- side="right"
- files={}
- yToF={}
- --------------UNWRAP--------------
- unwrap=function(cPath)
- mAPI.drawWindow(5,4,colWind)
- term.setBackgroundColor(colors[colWind])
- term.setTextColor(colors[colText])
- content={}
- yToC={}
- content=fs.list(cPath)
- max=table.maxn(content)
- for i=1,max do
- term.setCursorPos(7,4+(i))
- if fs.isDir(cPath.."/"..content[i]) then term.setBackgroundColor(colors[col]) end
- write(content[i])
- term.setBackgroundColor(colors[colWind])
- yToF[4+(i)]=content[i]
- end
- while true do
- e,n,x,y=os.pullEvent("mouse_click")
- if x==47 and y==4 then
- shell.run(shell.getRunningProgram())
- error()
- end
- if x<35 and n==1 then
- yyy=y
- if not(fs.isDir(cPath.."/"..yToF[yyy])) then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- shell.run(path.."/"..yToF[y])
- shell.run("maxintosh/desktop")
- error()
- error()
- else
- unwrap(cPath.."/"..yToF[yyy])
- end
- end
- if x<35 and n==2 then
- yyy=y
- mAPI.drawWindow(10,6)
- term.setTextColor(colors[colText])
- term.setBackgroundColor(colors[colWind])
- term.setCursorPos(12,8)
- write("delete")
- term.setCursorPos(12,10)
- write("copy to PC")
- term.setCursorPos(12,12)
- write("rename")
- while true do
- e,n,x,y=os.pullEvent("mouse_click")
- if y==6 then
- shell.run(shell.getRunningProgram())
- error()
- end
- if y==8 then
- fs.delete(cPath.."/"..yToF[yyy])
- shell.run(shell.getRunningProgram())
- error()
- end
- if y==10 then
- fs.copy(cPath.."/"..yToF[yyy],"maxintosh/"..currentUser.."/programs/"..yToF[yyy])
- end
- if y==12 then
- term.setCursorPos(12,13)
- name=read()
- fs.copy(cPath.."/"..yToF[yyy],cPath.."/"..name)
- paintutils.drawBox(12,13,30,13,colors[colWind])
- fs.delete(cPath.."/"..yToF[yyy])
- end
- end
- end
- end
- end
- ------------------------------FLOPPY--------------------------------------
- mAPI.drawWindow(2,2,colWind)
- term.setTextColor(colors[colText])
- term.setBackgroundColor(colors[colWind])
- if disk.hasData(side) then
- name=disk.getLabel(side)
- id=disk.getID(side)
- if not(name==nil) then l=string.len(name) else l=5 name="-no-"
- end
- path=disk.getMountPath(side)
- term.setCursorPos((49-(6+l)),3)
- write("disk: "..name)
- files=fs.list(path)
- max=table.maxn(files)
- for i=1,max do
- term.setCursorPos(4,2+(2*i))
- if fs.isDir(path.."/"..files[i]) then term.setBackgroundColor(colors[col]) end
- write(files[i])
- term.setBackgroundColor(colors[colWind])
- yToF[2+(2*i)]=files[i]
- end
- term.setCursorPos(39,7)
- write("eject disk")
- term.setCursorPos(37,9)
- write("copy from PC")
- term.setCursorPos(38,11)
- write("change Name")
- while true do
- event,n,x,y=os.pullEvent("mouse_click")
- if x==50 and y==2 then error() end
- if y==7 then disk.eject(side) error() end
- if y==9 then
- term.setCursorPos(38,10)
- p=read()
- if fs.exists("maxintosh/"..currentUser.."/programs/"..p) then
- fs.copy("maxintosh/"..currentUser.."/programs/"..p, path.."/"..p)
- else
- paintutils.drawBox(37,10,49,10,colors[colWind])
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.black)
- term.setCursorPos(37,10)
- write("not found")
- sleep(3)
- end
- shell.run(shell.getRunningProgram())
- error()
- paintutils.drawBox(37,10,49,10,colors[colWind])
- end
- if y==11 then
- term.setCursorPos(38,12)
- p=read()
- disk.setLabel(side,p)
- paintutils.drawBox(36,12,49,12,colors[colWind])
- end
- if x<35 and n==1 then
- yyy=y
- if not(fs.isDir(path.."/"..yToF[y])) then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- shell.run(path.."/"..yToF[y])
- shell.run("maxintosh/desktop")
- error()
- error()
- else
- cPath=fs.combine(path,yToF[y])
- unwrap(cPath)
- end
- end
- if x<35 and n==2 then
- mAPI.drawWindow(10,6)
- term.setTextColor(colors[colText])
- term.setBackgroundColor(colors[colWind])
- term.setCursorPos(12,8)
- write("delete")
- term.setCursorPos(12,10)
- write("copy to PC")
- term.setCursorPos(12,12)
- write("rename")
- while true do
- e,n,x,y=os.pullEvent("mouse_click")
- if y==6 then
- shell.run(shell.getRunningProgram())
- error()
- end
- if y==8 then
- fs.delete(path.."/"..yToF[yyy])
- shell.run(shell.getRunningProgram())
- error()
- end
- if y==10 then
- fs.copy(path.."/"..yToF[yyy],"maxintosh/"..currentUser.."/programs/"..yToF[yyy])
- end
- if y==12 then
- term.setCursorPos(12,13)
- name=read()
- fs.copy(path.."/"..yToF[yyy],path.."/"..name)
- paintutils.drawBox(12,13,30,13,colors[colWind])
- fs.delete(path.."/"..yToF[yyy])
- end
- end
- end
- end
- ---------------------------------AUDIO-----------------------------------------------
- elseif disk.hasAudio(side) then
- title=disk.getAudioTitle(side)
- l=string.len(title)
- term.setCursorPos((41-l),4)
- write("title: "..title)
- term.setCursorPos(24,8)
- write("play")
- term.setCursorPos(24,10)
- write("stop")
- term.setCursorPos(21,13)
- write("eject disk")
- while true do
- event,n,x,y=os.pullEvent("mouse_click")
- if x==50 and y==2 then error() end
- if y==13 then disk.eject(side) error() end
- if y==8 then disk.playAudio(side) end
- if y==10 then disk.stopAudio(side) end
- end
- else
- ------------------------NO_DISK-----------------------------------------
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.black)
- term.setCursorPos(22,8)
- write("no disk")
- term.setBackgroundColor(colors.green)
- term.setCursorPos(21,10)
- write(" refresh! ")
- while true do
- event,n,x,y=os.pullEvent("mouse_click")
- if x==50 and y==2 then error() end
- if y==10 then
- p=shell.getRunningProgram()
- shell.run(p)
- error()
- end
- end
- end
Add Comment
Please, Sign In to add comment