Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stahovani = nil
- pastebincode = nil
- kod1 = nil
- filename1 = nil
- akce = nil
- if not fs.exists ("/system/programs/setdata/pmanager.nft") then
- shell.run ("pastebin get xfCE1FjU /system/programs/setdata/pmanager.nft")
- end
- local nastaveni={barva=colors.blue}
- local f=fs.open("system/.core/colors","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- local f=fs.open("system/.core/textcol","r")
- local tnt=f.readAll()
- f.close()
- local text=textutils.unserialize(tnt)
- local function prc(text, y)
- local w = term.getSize()
- local _, cy = term.getCursorPos()
- term.setCursorPos(math.ceil((w-#text)/2), y or cy)
- write(text)
- end
- function start ()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear ()
- local image = paintutils.loadImage("/system/programs/setdata/pmanager.nft")
- paintutils.drawImage(image, 18, 4)
- prc ("Programs manager", 16)
- sleep (1)
- menud ()
- end
- function downinstal ()
- if yPos == nil then
- yPos = 8
- end
- if filename1 == nil then
- filename1 = filename
- end
- if yf == nil then
- yf=12
- end
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear ()
- paintutils.drawLine(1, 4, 51, 4, colors.lightBlue)
- term.setBackgroundColor(colors.white)
- prc (" Program manager for Verua ", 4)
- term.setCursorPos(5,6)
- print "Include in the menu:"
- term.setCursorPos(5,8)
- print "Auto"
- term.setCursorPos(5,9)
- print "Manual"
- term.setCursorPos(2,yPos)
- print "->"
- term.setCursorPos(20,8)
- print "Name the file menu: "
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos(40,8)
- print " "
- term.setTextColor(colors.white)
- term.setCursorPos(40,8)
- print (filename1)
- term.setBackgroundColor(colors.gray)
- term.setCursorPos (42,18)
- print " Download "
- term.setCursorPos (1,18)
- print " Back "
- local myWindow = window.create(term.current(),16,11,13,9)
- myWindow.setBackgroundColor(colors.lime)
- myWindow.clear()
- local myWindow = window.create(term.current(),17,12,11,7)
- myWindow.setBackgroundColor(colors.white)
- myWindow.clear()
- if fs.exists ("/system/.core/lsprogram") then
- local data = fs.open ("/system/.core/lsprogram", "r")
- menu1 = data.readLine ()
- path1 = data.readLine ()
- menu2 = data.readLine ()
- path2 = data.readLine ()
- menu3 = data.readLine ()
- path3 = data.readLine ()
- menu4 = data.readLine ()
- path4 = data.readLine ()
- menu5 = data.readLine ()
- path5 = data.readLine ()
- menu6 = data.readLine ()
- path6 = data.readLine ()
- menu7 = data.readLine ()
- path7 = data.readLine ()
- data.close ()
- end
- if yPos == 8 then
- term.setTextColor(colors.lightGray)
- else
- term.setTextColor(colors.black)
- end
- term.setCursorPos(5,12)
- print "Order: "
- term.setCursorPos(17,12)
- print (menu1)
- term.setCursorPos(17,13)
- print (menu2)
- term.setCursorPos(17,14)
- print (menu3)
- term.setCursorPos(17,15)
- print (menu4)
- term.setCursorPos(17,16)
- print (menu5)
- term.setCursorPos(17,17)
- print (menu6)
- term.setCursorPos(17,18)
- print (menu7)
- if yPos == 9 then
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos (17, yf)
- write " "
- term.setCursorPos (17, yf)
- write (filename1)
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 17 and x <= 27 and y == 12 and button == 1 then
- yf = 12
- pozice = "1"
- downinstal ()
- elseif x >= 17 and x <= 27 and y == 13 and button == 1 then
- yf = 13
- pozice = "2"
- downinstal ()
- elseif x >= 17 and x <= 27 and y == 14 and button == 1 then
- yf = 14
- pozice = "3"
- downinstal ()
- elseif x >= 17 and x <= 27 and y == 15 and button == 1 then
- yf = 15
- pozice = "4"
- downinstal ()
- elseif x >= 17 and x <= 27 and y == 16 and button == 1 then
- yf = 16
- pozice = "5"
- downinstal ()
- elseif x >= 17 and x <= 27 and y == 17 and button == 1 then
- yf = 17
- pozice = "6"
- downinstal ()
- elseif x >= 17 and x <= 27 and y == 18 and button == 1 then
- yf = 18
- pozice = "7"
- downinstal ()
- elseif x >= 5 and x <= 15 and y == 8 and button == 1 then
- yPos = 8
- downinstal ()
- elseif x >= 5 and x <= 15 and y == 9 and button == 1 then
- yPos = 9
- downinstal ()
- elseif x >= 40 and x <= 52 and y == 8 and button == 1 then
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos (40,8)
- print " "
- term.setCursorPos (40,8)
- filename1 = io.read ()
- downinstal ()
- elseif x >= 1 and x <= 11 and y == 18 and button == 1 then
- filename1 = nil
- download ()
- elseif x >= 42 and x <= 51 and y == 18 and button == 1 then
- if fs.exists("/system/RAM/editmenu") then
- fs.delete ("/system/RAM/editmenu")
- end
- shell.run ("pastebin get",pastebincode,ulozit)
- local data = fs.open ("/system/RAM/editmenu", "w")
- data.writeLine (filename)
- data.writeLine (ulozit)
- data.writeLine (pastebincode)
- data.writeLine (filename1)
- data.writeLine (pozice)
- data.close ()
- else
- paintutils.drawLine(1, 1, 51, 1, colors.black)
- paintutils.drawPixel (51,1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos (51,1)
- print "*"
- paintutils.drawPixel (50,1, colors.lightGray)
- term.setCursorPos (50,1)
- print "<"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x == 51 and y == 1 then
- shell.run ("/system/desktop")
- elseif x == 50 and y == 1 then
- menud ()
- else
- downinstal ()
- end
- end
- end
- end
- end
- function upload ()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear ()
- paintutils.drawLine(1, 4, 51, 4, colors.lightBlue)
- term.setBackgroundColor(colors.white)
- prc (" Program manager for Verua ", 4)
- term.setCursorPos (5,8)
- print "Paste path file for upload:"
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos (5,10)
- print " "
- term.setTextColor(colors.white)
- term.setCursorPos (6,10)
- print (kod1)
- term.setBackgroundColor(colors.gray)
- term.setCursorPos (42,18)
- print " Upload "
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 5 and x <= 45 and y == 10 and button == 1 then
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos (5,10)
- print " "
- term.setCursorPos (6,10)
- kod1 = io.read ()
- upload ()
- elseif x >= 42 and x <= 51 and y == 18 and button == 1 then
- if akce == nil then
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- term.setCursorPos(5,18)
- if kod1 == "" then
- prc ("Paste a valid path!")
- elseif kod1 == " " then
- prc ("Paste a valid path!")
- elseif not fs.exists (kod1) then
- prc ("File is not exists!")
- else
- term.setTextColor(colors.black)
- term.setCursorPos(5,12)
- shell.run ("pastebin put "..kod1)
- paintutils.drawLine(1, 17, 51, 17, colors.white)
- paintutils.drawLine(1, 18, 41, 18, colors.white)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.gray)
- term.setCursorPos (42,18)
- print " Menu "
- akce = menu
- end
- else
- akce = nil
- menud ()
- end
- else
- paintutils.drawLine(1, 1, 51, 1, colors.black)
- paintutils.drawPixel (51,1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos (51,1)
- print "*"
- paintutils.drawPixel (50,1, colors.lightGray)
- term.setCursorPos (50,1)
- print "<"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x == 51 and y == 1 then
- shell.run ("/system/desktop")
- elseif x == 50 and y == 1 then
- menud ()
- else
- upload ()
- end
- end
- end
- end
- end
- function download ()
- function spustit ()
- local myWindow = window.create(term.current(),17,7,22,10)
- myWindow.setBackgroundColor(colors.gray)
- myWindow.clear()
- local myWindow = window.create(term.current(),16,6,22,10)
- myWindow.setBackgroundColor(colors.lime)
- myWindow.clear()
- local myWindow = window.create(term.current(),17,7,20,8)
- myWindow.setBackgroundColor(colors.white)
- myWindow.clear()
- paintutils.drawPixel (37,6, colors.red)
- term.setCursorPos(37,6)
- print "*"
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- myWindow.setCursorPos(2,1)
- print " program Manager "
- myWindow.setCursorPos(2,3)
- print " Run a downloaded "
- myWindow.setCursorPos(2,4)
- print " file ? "
- myWindow.setCursorPos(2,6)
- print " Yes No "
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 37 and x <= 37 and y == 6 and button == 1 then
- (zpet) ()
- elseif x >= 18 and x <= 21 and y == 12 and button == 1 then
- shell.run (ulozit)
- elseif x >= 32 and x <= 36 and y == 12 and button == 1 then
- download ()
- end
- end
- end
- if stahovani == nil then
- defcesta = "/system/downloads"
- filename = "files"
- stahovani = 1
- end
- if pastebincode == nil then
- pastebincode = "Pastebin"
- end
- ulozit = (defcesta.."/"..filename)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear ()
- paintutils.drawLine(1, 4, 51, 4, colors.lightBlue)
- term.setBackgroundColor(colors.white)
- prc (" Program manager for Verua ", 4)
- term.setCursorPos (5,8)
- print "Paste code from pastebin:"
- term.setCursorPos (25,10)
- print "Paste File name:"
- term.setCursorPos (5,14)
- print "Paste a path for download:"
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos (5,10)
- print " "
- term.setCursorPos (5,16)
- print " "
- term.setCursorPos (25,12)
- print " "
- term.setTextColor(colors.white)
- term.setCursorPos (6,10)
- print (pastebincode)
- term.setCursorPos (6,16)
- print (ulozit)
- term.setCursorPos (26,12)
- print (filename)
- term.setCursorPos (6,10)
- print (pastebincode)
- term.setBackgroundColor(colors.gray)
- term.setCursorPos (42,18)
- if instalace == nil then
- print " Download "
- else
- print " Next "
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 5 and x <= 15 and y == 10 and button == 1 then
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos (5,10)
- print " "
- term.setCursorPos (6,10)
- pastebincode = read ()
- download ()
- elseif x >= 5 and x <= 31 and y == 16 and button == 1 then
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos (5,16)
- print " "
- term.setCursorPos (6,16)
- defcesta = read ()
- download ()
- elseif x >= 25 and x <= 41 and y == 12 and button == 1 then
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos (25,12)
- print " "
- term.setCursorPos (26,12)
- filename = read ()
- download ()
- elseif x >= 42 and x <= 51 and y == 18 and button == 1 then
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- term.setCursorPos(5,18)
- if pastebincode == "Pastebin" then
- prc ("Paste a Pastebin code!")
- elseif pastebincode == "" then
- prc ("Paste a Pastebin code!")
- elseif pastebincode == " " then
- prc ("Paste a Pastebin code!")
- elseif fs.exists (ulozit) then
- prc ("File is exists, rename it!")
- else
- if instalace == nil then
- term.setTextColor(colors.green)
- term.setCursorPos(4,17)
- shell.run ("pastebin get",pastebincode,ulozit)
- paintutils.drawLine(1, 17, 51, 17, colors.white)
- paintutils.drawLine(1, 18, 41, 18, colors.white)
- term.setCursorPos(5,18)
- prc "Succesful!"
- sleep (0.5)
- zpet = download
- spustit ()
- else
- downinstal ()
- end
- end
- else
- paintutils.drawLine(1, 1, 51, 1, colors.black)
- paintutils.drawPixel (51,1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos (51,1)
- print "*"
- paintutils.drawPixel (50,1, colors.lightGray)
- term.setCursorPos (50,1)
- print "<"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x == 51 and y == 1 then
- shell.run ("/system/desktop")
- elseif x == 50 and y == 1 then
- menud ()
- else
- download ()
- end
- end
- end
- end
- end
- function menud()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear ()
- paintutils.drawLine(1, 4, 51, 4, colors.lightBlue)
- term.setBackgroundColor(colors.white)
- prc (" Program manager for Verua ", 4)
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos(5,8)
- print "-> Download and install "
- term.setCursorPos(5,10)
- print "-> Download "
- term.setCursorPos(5,12)
- print "-> Upload "
- term.setCursorPos(5,14)
- print "-> Edit menu "
- term.setCursorPos(5,16)
- print "-> Uinstall "
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,19)
- write" Pepek"
- term.setCursorPos(28,19)
- write"Soft "
- term.setCursorPos(27,19)
- term.setTextColor(colors.lime)
- write"@"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x >= 5 and x <= 28 and y == 8 and button == 1 then
- instalace = 1
- download ()
- elseif x >= 5 and x <= 16 and y == 10 and button == 1 then
- instalace = nil
- download ()
- elseif x >= 5 and x <= 14 and y == 12 and button == 1 then
- upload ()
- else
- paintutils.drawLine(1, 1, 51, 1, colors.black)
- paintutils.drawPixel (51,1, colors.red)
- term.setCursorPos (51,1)
- term.setTextColor(text.barva)
- print "*"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x == 51 and y == 1 then
- shell.run ("/system/desktop")
- else
- menud ()
- end
- end
- break
- end
- end
- end
- start ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement