Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local verze = "20.0212.6"
- local w, h = term.getSize()
- local nastaveni={barva=colors.blue}
- lastprikaz = ""
- local computerMode = 0
- filePos = {
- [1] = {3,2},
- [2] = {15,2},
- [3] = {27,2},
- [4] = {39,2},
- [5] = {3,6},
- [6] = {15,6},
- [7] = {27,6},
- [8] = {39,6},
- [9] = {3,10},
- [10] = {15,10},
- [11] = {27,10},
- [12] = {39,10},
- [13] = {3,14},
- [14] = {15,14},
- [15] = {27,14},
- [16] = {39,14}
- }
- local vyber = 0
- local cPage = 1
- local nPage = 1
- local vystrih = ""
- 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
- if fs.exists("/system/.core/system") then
- local data = fs.open ("/system/.core/system", "r")
- edice = data.readLine()
- data.close()
- else
- edice = "Standard"
- end
- if (edice == "Server") then
- ServerMode = true
- end
- function downloading()
- local myWindow = window.create(term.current(),1,1,40,4)
- myWindow.setBackgroundColor(nastaveni.barva)
- myWindow.clear()
- term.setBackgroundColor(nastaveni.barva)
- term.setTextColor(text.barva)
- term.setCursorPos(1,1)
- write "Downloading files..."
- term.setCursorPos(1,3)
- shell.run("pastebin get "..kod.." "..cestaP)
- cestaP = ""
- kod = ""
- end
- function vyvinfo()
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.white)
- write (w..", "..h)
- term.setCursorPos(1,2)
- if computerMode == 0 then
- write ("Monitor")
- elseif computerMode == 1 then
- write ("Computer")
- elseif computerMode == 2 then
- write ("Pocket")
- else
- write ("Other")
- end
- end
- function desktop()
- term.setCursorPos(1,1)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.black)
- local f=fs.open("/system/RAM/user","r")
- user=f.readLine()
- f.close()
- if not fs.exists("/system/Users/"..user.."/vyvoj") then
- vyvoj = false
- else
- vyvoj = true
- end
- if not fs.exists("/system/Users/"..user.."/colors") then
- shell.run("pastebin get ECh4d3A4 /system/Users/"..user.."/colors")
- end
- local f=fs.open("/system/Users/"..user.."/colors","r")
- cnt=f.readAll()
- f.close()
- nastaveni=textutils.unserialize(cnt)
- if not fs.exists("/system/Users/"..user.."/textcol") then
- shell.run("pastebin get 4JttBRbg /system/Users/"..user.."/textcol")
- end
- local f=fs.open("/system/Users/"..user.."/textcol","r")
- tnt=f.readAll()
- f.close()
- text=textutils.unserialize(tnt)
- plocha()
- end
- function panel()
- local f=fs.open("/system/Users/"..user.."/textcol","r")
- tnt=f.readAll()
- f.close()
- text=textutils.unserialize(tnt)
- term.setTextColor(text.barva)
- paintutils.drawLine(4, h, w, h, nastaveni.barva)
- if os.time() > 12 then
- term.setCursorPos(w-5,h)
- write(textutils.formatTime(os.time(), true))
- else
- term.setCursorPos(w-4,h)
- write(textutils.formatTime(os.time(), true))
- end
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(1,h)
- write"MENU"
- if computerMode == 0 then
- term.setCursorPos(w-2,h-1)
- term.setBackgroundColor(nastaveni.barva)
- write"dsc"
- end
- local smodem = peripheral.find("modem")
- if not smodem then
- paintutils.drawPixel (w-7,h, colors.red)
- term.setCursorPos(w-7,h)
- term.write ("M")
- else
- paintutils.drawPixel (w-7,h, colors.lime)
- term.setCursorPos(w-7,h)
- term.write ("M")
- end
- if rednet.isOpen('back') == true then
- a = 1
- elseif rednet.isOpen('left') == true then
- b = 1
- elseif rednet.isOpen('right') == true then
- c = 1
- elseif rednet.isOpen('top') == true then
- d = 1
- elseif rednet.isOpen('bottom') == true then
- e = 1
- elseif rednet.isOpen('front') == true then
- f = 1
- else
- a = 0
- b = 0
- c = 0
- d = 0
- e = 0
- f = 0
- end
- if a == 1 then
- pripojeni = 1
- elseif b == 1 then
- pripojeni = 1
- elseif c == 1 then
- pripojeni = 1
- elseif d == 1 then
- pripojeni = 1
- elseif e == 1 then
- pripojeni = 1
- elseif f == 1 then
- pripojeni = 1
- else
- pripojeni = 0
- end
- if pripojeni == 0 then
- paintutils.drawPixel (w-8,h, colors.red)
- term.setCursorPos(w-8,h)
- term.write ("W")
- W = 0
- elseif pripojeni == 1 then
- if not smodem then
- paintutils.drawPixel (w-8,h, colors.red)
- term.setCursorPos(w-8,h)
- term.write ("W")
- W = 0
- else
- paintutils.drawPixel (w-8,h, colors.lime)
- term.setCursorPos(w-8,h)
- term.write ("W")
- W = 1
- end
- end
- local label = os.getComputerLabel()
- if label then
- paintutils.drawPixel (w-9,h, colors.lime)
- term.setCursorPos(w-9,h)
- term.write ("L")
- elseif not label then
- paintutils.drawPixel (w-9,h, colors.red)
- term.setCursorPos(w-9,h)
- term.write ("L")
- end
- kurzor()
- if event == "mouse_click" and x == w-7 and y == h then
- if not smodem then
- term.setCursorPos(w-23,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- write " Modem is not connected"
- else
- term.setCursorPos(w-23,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lime)
- write " Modem is connected"
- end
- sleep(0.5)
- plocha()
- end
- if event == "mouse_click" and x == w-8 and y == h then
- if W == 0 then
- term.setCursorPos(w-23,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- write " Wireless disconect"
- sleep (0.5)
- pruvodcepr ()
- else
- term.setCursorPos(w-23,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lime)
- write " Wireless connected"
- sleep(0.5)
- plocha()
- end
- end
- if event == "mouse_click" and x >= w-2 and y == h-1 and computerMode == 0 then
- local data = fs.open ("/system/RAM/displayreboot", "w")
- data.close ()
- term.setCursorPos(31,14)
- write" Disconect "
- if fs.exists("/system/.core/display") then
- fs.delete("/system/.core/display")
- end
- term.setBackgroundColor(colors.black)
- term.clear()
- os.reboot()
- end
- if event == "mouse_click" and x == w-9 and y == h then
- if not label then
- term.setCursorPos(w-23,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- write " Computer is not labeled"
- sleep (0.5)
- propojeni ()
- else
- term.setCursorPos(w-23,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lime)
- write " Computer is label"
- end
- end
- end
- function sColor(color)
- term.setBackgroundColor(color)
- end
- cesta = {}
- typ = {}
- function vypis()
- cDir = fs.list(shell.dir())
- term.setTextColor(colors.black)
- for i = 1, #cDir do
- local num = i
- local a = i+16*(cPage-1)
- local name = tostring(cDir[a])
- if name == "nil" then break end
- if #name > 9 then
- text = string.sub(name,1,6).."..."
- else
- text = name
- end
- if not (i == nil) then
- cesta[i] = name
- end
- if fs.isDir(shell.dir().."/"..name) then
- sColor(colors.yellow)
- typ[i] = "folder"
- else
- sColor(colors.lightGray)
- typ[i] = "file"
- end
- if shell.dir() == "" then
- location = "C:/"
- else
- location = tostring("C:/"..shell.dir().."/")
- end
- if i > 16 then break end
- x = filePos[i][1]
- y = filePos[i][2]
- term.setCursorPos(x,y)
- term.write(string.rep(" ",11))
- term.setCursorPos(x,y+1)
- term.write(string.rep(" ",math.floor(5.5-#tostring(text)/2)))
- term.write(text)
- term.write(string.rep(" ",math.ceil(5.5-#tostring(text)/2)))
- term.setCursorPos(x,y+2)
- term.write(string.rep(" ",11))
- end
- end
- function mrizka()
- if x >= (filePos[1][1]) and x <= ((filePos[1][1])+10) and y >= (filePos[1][2]) and y <= ((filePos[1][2])+3) then
- vyber = 1
- elseif x >= (filePos[2][1]) and x <= ((filePos[2][1])+10) and y >= (filePos[2][2]) and y <= ((filePos[2][2])+3) then
- vyber = 2
- elseif x >= (filePos[3][1]) and x <= ((filePos[3][1])+10) and y >= (filePos[3][2]) and y <= ((filePos[3][2])+3) then
- vyber = 3
- elseif x >= (filePos[4][1]) and x <= ((filePos[4][1])+10) and y >= (filePos[4][2]) and y <= ((filePos[4][2])+3) then
- vyber = 4
- elseif x >= (filePos[5][1]) and x <= ((filePos[5][1])+10) and y >= (filePos[5][2]) and y <= ((filePos[5][2])+3) then
- vyber = 5
- elseif x >= (filePos[6][1]) and x <= ((filePos[6][1])+10) and y >= (filePos[6][2]) and y <= ((filePos[6][2])+3) then
- vyber = 6
- elseif x >= (filePos[7][1]) and x <= ((filePos[7][1])+10) and y >= (filePos[7][2]) and y <= ((filePos[7][2])+3) then
- vyber = 7
- elseif x >= (filePos[8][1]) and x <= ((filePos[8][1])+10) and y >= (filePos[8][2]) and y <= ((filePos[8][2])+3) then
- vyber = 8
- elseif x >= (filePos[9][1]) and x <= ((filePos[9][1])+10) and y >= (filePos[9][2]) and y <= ((filePos[9][2])+3) then
- vyber = 9
- elseif x >= (filePos[10][1]) and x <= ((filePos[10][1])+10) and y >= (filePos[10][2]) and y <= ((filePos[10][2])+3) then
- vyber = 10
- elseif x >= (filePos[11][1]) and x <= ((filePos[11][1])+10) and y >= (filePos[11][2]) and y <= ((filePos[11][2])+3) then
- vyber = 11
- elseif x >= (filePos[12][1]) and x <= ((filePos[12][1])+10) and y >= (filePos[12][2]) and y <= ((filePos[12][2])+3) then
- vyber = 12
- elseif x >= (filePos[13][1]) and x <= ((filePos[13][1])+10) and y >= (filePos[13][2]) and y <= ((filePos[13][2])+3) then
- vyber = 13
- elseif x >= (filePos[14][1]) and x <= ((filePos[14][1])+10) and y >= (filePos[14][2]) and y <= ((filePos[14][2])+3) then
- vyber = 14
- elseif x >= (filePos[15][1]) and x <= ((filePos[15][1])+10) and y >= (filePos[15][2]) and y <= ((filePos[15][2])+3) then
- vyber = 15
- elseif x >= (filePos[16][1]) and x <= ((filePos[16][1])+10) and y >= (filePos[16][2]) and y <= ((filePos[16][2])+3) then
- vyber = 16
- else
- vyber = 0
- end
- end
- function zpatky()
- vyber = 0
- if (zpet == "plocha") then
- plocha()
- else
- pruzkumnik()
- end
- end
- function kurzor()
- event, button, x,y = os.pullEvent()
- if event == "mouse_click" and x >= 1 and x <= 5 and y == h and button == 1 then
- menu()
- end
- if event == "mouse_click" then
- mrizka()
- end
- if event == "mouse_click" and button == 1 then
- if not (cesta[vyber] == nil) then
- if (typ[vyber] == "file") then
- shell.run(cesta[vyber])
- elseif (typ[vyber] == "folder") then
- shell.run("cd "..cesta[vyber].."/")
- pruzkumnik()
- end
- shell.run("/system/api/closeapp")
- end
- end
- if event == "mouse_click" and y < h and button == 2 then
- term.setBackgroundColor(colors.gray)
- if (x > w-9) then
- x = w-9
- end
- if (y > h-5) then
- y = h-5
- end
- menu_win = window.create(term.current(),x,y,10,6)
- menu_win.setBackgroundColor(colors.gray)
- menu_win.clear()
- menu_win.setCursorPos(2,1)
- menu_win.write "Run"
- menu_win.setCursorPos(2,2)
- menu_win.write"New >"
- menu_win.setCursorPos(2,3)
- menu_win.write "Open/Edit"
- menu_win.setCursorPos(2,4)
- menu_win.write "Delete"
- menu_win.setCursorPos(2,5)
- menu_win.write "Action >"
- term.setCursorPos(1,1)
- menu_win.setCursorPos(2,6)
- menu_win.write "Pastebin"
- menu_win.setBackgroundColor(colors.lightGray)
- if vyvoj then
- write ("x:"..x.." y: "..y)
- end
- PosX = x
- PosY = y
- while true do
- event, button, x,y = os.pullEvent()
- if event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+1 and button == 1 then
- if (x > w-19) then
- PosX = w-29
- end
- if (y > h-5) then
- y = h-5
- end
- menu_win.setCursorPos(1,2)
- menu_win.write " New >"
- local new_menu = window.create(term.current(),PosX+10,y,10,3)
- new_menu.setBackgroundColor(colors.lightGray)
- new_menu.clear()
- new_menu.setCursorPos(2,1)
- new_menu.write "File"
- new_menu.setCursorPos(2,2)
- new_menu.write "Folder"
- new_menu.setCursorPos(2,3)
- new_menu.write "Shortcut"
- new_menu.setBackgroundColor(colors.gray)
- term.setCursorPos(1,1)
- if vyvoj then
- write ("x:"..x.." y: "..y)
- end
- PosX = PosX+10
- PosY = y
- new_file = ""
- while true do
- event, button, x,y = os.pullEvent()
- if event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY and button == 1 then
- new_menu.setCursorPos(1,1)
- new_menu.write" "
- new_menu.setCursorPos(1,1)
- new_file = read()
- if (new_file == "") then
- new_menu.setCursorPos(1,1)
- new_menu.write" Error "
- sleep(0.2)
- zpatky()
- end
- if not fs.exists(shell.dir().."/"..new_file) then
- local create_file = fs.open(shell.dir().."/"..new_file,"w")
- create_file.close()
- new_menu.setCursorPos(1,1)
- new_menu.write" Created "
- sleep(0.2)
- zpatky()
- else
- new_menu.setCursorPos(1,1)
- new_menu.write" Error "
- sleep(0.2)
- zpatky()
- end
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+1 and button == 1 then
- new_menu.setCursorPos(1,2)
- new_menu.write" "
- new_menu.setCursorPos(1,2)
- new_file = read()
- if (new_file == "") then
- new_menu.setCursorPos(1,2)
- new_menu.write" Error "
- sleep(0.2)
- zpatky()
- end
- if not fs.exists(shell.dir().."/"..new_file) then
- local create_folder = fs.open(shell.dir().."/"..new_file.."/.folder","w")
- create_folder.close()
- fs.delete(shell.dir().."/"..new_file.."/.folder")
- new_menu.setCursorPos(1,2)
- new_menu.write" Created "
- sleep(0.2)
- zpatky()
- else
- new_menu.setCursorPos(1,2)
- new_menu.write" Error "
- sleep(0.2)
- zpatky()
- end
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+2 and button == 1 then
- new_menu.setCursorPos(1,3)
- new_menu.write" "
- new_menu.setCursorPos(1,3)
- new_file = read()
- if (new_file == "") then
- new_menu.setCursorPos(1,3)
- new_menu.write" Error "
- sleep(0.2)
- zpatky()
- end
- new_path = ""
- new_menu.setCursorPos(1,2)
- new_menu.write"Path: "
- new_menu.setCursorPos(1,3)
- new_menu.write" "
- new_menu.setCursorPos(1,3)
- new_path = read()
- if (new_patch == "") then
- new_menu.setCursorPos(1,3)
- new_menu.write" Error "
- sleep(0.2)
- zpatky()
- end
- if not fs.exists(shell.dir().."/"..new_file) then
- local create_short = fs.open(shell.dir().."/"..new_file,"w")
- create_short.writeLine("shell.run(\""..new_path.."\")")
- create_short.close()
- new_menu.setCursorPos(1,3)
- new_menu.write" Created "
- sleep(0.2)
- zpatky()
- else
- new_menu.setCursorPos(1,3)
- new_menu.write" Error "
- sleep(0.2)
- zpatky()
- end
- elseif event == "mouse_click" then
- zpatky()
- end
- end
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY and button == 1 then
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos(PosX,y)
- write" Run "
- sleep(0.1)
- if not (cesta[vyber] == nil) then
- if (typ[vyber] == "file") then shell.run(cesta[vyber]) shell.run("/system/api/closeapp") else plocha () end
- end
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+4 and button == 1 then
- menu_win.setCursorPos(1,5)
- menu_win.write " Action >"
- local new_menu = window.create(term.current(),PosX+10,y-2,7,4)
- new_menu.setBackgroundColor(colors.lightGray)
- new_menu.clear()
- new_menu.setCursorPos(2,1)
- new_menu.write "Cut"
- new_menu.setCursorPos(2,2)
- new_menu.write "Copy"
- new_menu.setCursorPos(2,3)
- new_menu.write "Paste"
- new_menu.setCursorPos(2,4)
- new_menu.write "Rename"
- new_menu.setBackgroundColor(colors.gray)
- PosX = x
- PosY = y-2
- new_file = ""
- while true do
- event, button, x,y = os.pullEvent()
- if event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY and button == 1 then
- new_menu.setCursorPos(1,1)
- new_menu.write " Cut "
- shell.run("move /"..shell.dir().."/"..cesta[vyber].." /system/RAM/cut/"..cesta[vyber])
- vystrih = cesta[vyber]
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+1 and button == 1 then
- new_menu.setCursorPos(1,2)
- new_menu.write " Copy "
- shell.run("copy /"..shell.dir().."/"..cesta[vyber].." /system/RAM/cut/"..cesta[vyber])
- vystrih = cesta[vyber]
- sleep(0.1)
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+2 and button == 1 then
- new_menu.setCursorPos(1,3)
- new_menu.write " Paste "
- sleep(0.1)
- if not (vystrih == "") then
- shell.run("move /system/RAM/cut/"..vystrih.." /"..shell.dir().."/"..vystrih)
- fs.delete("/system/RAM/cut/")
- end
- vystrih = ""
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+3 and button == 1 then
- new_menu.setCursorPos(1,4)
- new_menu.write " "
- new_menu.setCursorPos(1,4)
- newName = read()
- shell.run("rename /"..shell.dir().."/"..cesta[vyber].." /"..shell.dir().."/"..newName)
- zpatky()
- elseif event == "mouse_click" then
- zpatky()
- end
- end
- sleep(1)
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+5 and button == 1 then
- term.setBackgroundColor(colors.lightGray)
- menu_win.setCursorPos(1,5)
- menu_win.write " Name "
- menu_win.setCursorPos(1,6)
- menu_win.write " "
- menu_win.setCursorPos(1,6)
- newName = read()
- menu_win.setCursorPos(1,5)
- menu_win.write " Code "
- menu_win.setCursorPos(1,6)
- menu_win.write " "
- menu_win.setCursorPos(1,6)
- kod = read()
- sleep(0.2)
- cestaP = tostring(newName)
- downloading()
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+3 and button == 1 then
- menu_win.setCursorPos(1,4)
- menu_win.write " Delete "
- sleep(0.1)
- if not (cesta[vyber] == nil) then
- fs.delete(shell.dir().."/"..cesta[vyber])
- end
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+2 and button == 1 then
- menu_win.setCursorPos(1,3)
- menu_win.write " Open/Edit"
- sleep(0.2)
- mrizka()
- if not (cesta[vyber] == nil) then
- if (typ[vyber] == "file") then shell.run("edit "..cesta[vyber]) elseif (typ[vyber] == "folder") then pruzkumnik(typ[vyber]) end
- shell.run("/system/api/closeapp")
- end
- zpatky()
- elseif event == "mouse_click" then
- zpatky()
- end
- end
- end
- end
- function pruzkumnik()
- zpet = "pruzkumnik"
- local myWindow = window.create(term.current(),1,1,w,h-1)
- myWindow.setBackgroundColor(colors.white)
- myWindow.clear()
- paintutils.drawLine(1, 1, w, 1, colors.black)
- paintutils.drawPixel (w,1, colors.red)
- term.setTextColor(colors.white)
- term.setCursorPos (w,1)
- write "*"
- vypis()
- paintutils.drawLine(1, h-1, w, h-1, colors.lightGray)
- term.setCursorPos(1, h-1)
- write("/"..shell.dir())
- while true do
- x,y = term.getSize()
- os.startTimer(1)
- panel()
- kurzor()
- if event == "mouse_click" and x == w and y == 1 and button == 1 then
- shell.run("cd /system/Users/"..user.."/Desktop/")
- plocha()
- elseif event == "mouse_click" and y == h-1 and button == 1 then
- paintutils.drawLine(1, h-1, w, h-1, colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos(1, h-1)
- nova_cesta = read()
- shell.run("cd "..nova_cesta)
- pruzkumnik()
- end
- end
- end
- function plocha()
- zpet = "plocha"
- local w, h = term.getSize()
- if fs.exists ("/system/Users/"..user.."/bar.nfp") then
- local image = paintutils.loadImage("/system/Users/"..user.."/bar.nfp")
- if (h == 19) and (w == 51) then
- computerMode = 1
- term.setBackgroundColor(colors.black)
- term.clear ()
- paintutils.drawImage(image, 1,1)
- elseif ServerMode then
- computerMode = 1
- term.setBackgroundColor(colors.cyan)
- term.clear ()
- elseif (h == 20) and (w == 26) then
- computerMode = 2
- term.setBackgroundColor(colors.lightBlue)
- term.clear ()
- paintutils.drawImage(image, (w/2)-25, (h/2)-9)
- else
- computerMode = 0
- term.setBackgroundColor(colors.lightBlue)
- term.clear ()
- paintutils.drawImage(image, (w/2)-25, (h/2)-9)
- end
- else
- if (h == 19) and (w == 51) then
- computerMode = 1
- term.setBackgroundColor(colors.black)
- term.clear ()
- elseif ServerMode then
- computerMode = 1
- term.setBackgroundColor(colors.cyan)
- term.clear ()
- elseif (h == 20) and (w == 26) then
- computerMode = 2
- term.setBackgroundColor(colors.lightBlue)
- term.clear ()
- paintutils.drawImage(image, (w/2)-25, (h/2)-9)
- else
- computerMode = 0
- term.setBackgroundColor(colors.lightBlue)
- term.clear ()
- end
- if ServerMode then
- local myWindow = window.create(term.current(),1,1,w,h)
- myWindow.setBackgroundColor(colors.cyan)
- myWindow.clear()
- term.setTextColor(colors.white)
- term.setCursorPos(w-19,h-1)
- write("Pepdroll 7 Server R1")
- else
- local myWindow = window.create(term.current(),1,1,w,h)
- if (user == "pepeksoft") then
- myWindow.setBackgroundColor(colors.cyan)
- else
- myWindow.setBackgroundColor(colors.black)
- end
- myWindow.clear()
- myWindow.setTextColor(colors.white)
- myWindow.setCursorPos(w-(#("Pepdroll 7 "..edice))+1,h-1)
- myWindow.write ("Pepdroll 7 "..edice)
- myWindow.setCursorPos(1,5)
- end
- end
- if vyvoj then
- vyvinfo()
- end
- ----------- ikony
- if not fs.exists("/system/Users/"..user.."/Desktop/.folder") then
- local create_folder = fs.open("/system/Users/"..user.."/Desktop/.folder","w")
- create_folder.close()
- fs.delete("/system/Users/"..user.."/Desktop/.folder")
- end
- shell.run("cd /system/Users/"..user.."/Desktop/")
- vypis()
- while true do
- x,y = term.getSize()
- os.startTimer(1)
- if ServerMode and fs.exists("/system/RAM/shutdown.pdr") then
- vypnout()
- end
- panel()
- end
- end
- function propojeni()
- local w, h = term.getSize()
- if computerMode == 1 then
- 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(nastaveni.barva)
- myWindow.clear()
- okno = window.create(term.current(),17,7,20,8)
- okno.setBackgroundColor(colors.white)
- okno.clear()
- paintutils.drawPixel (37,6, colors.red)
- term.setCursorPos(37,6)
- else
- local myWindow = window.create(term.current(),(w/2)-11,(h/2)-5,22,10)
- myWindow.setBackgroundColor(colors.gray)
- myWindow.clear()
- local myWindow = window.create(term.current(),(w/2)-11,(h/2)-5,22,10)
- myWindow.setBackgroundColor(nastaveni.barva)
- myWindow.clear()
- okno = window.create(term.current(),(w/2)-10,(h/2)-4,20,8)
- okno.setBackgroundColor(colors.white)
- okno.clear()
- paintutils.drawPixel (w/2+10,(h/2)-5, colors.red)
- term.setCursorPos(w/2+10,(h/2)-5)
- end
- write "*"
- term.setBackgroundColor(colors.gray)
- okno.setCursorPos(4,8)
- write " Set Label "
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- okno.setCursorPos(2,1)
- write "Connection Manager"
- okno.setCursorPos(2,3)
- write " Manual label "
- okno.setCursorPos(2,5)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.lightGray)
- write " "
- okno.setCursorPos(3,5)
- write (spojovak)
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if vyvoj then
- vyvinfo()
- term.setCursorPos(1,3)
- write (x..", "..y)
- end
- if (x <= (w/2+10) and x >= (w/2+10)-0.5) and (y <= (h/2-5) and y >=(h/2-5)-0.5) and computerMode ~= 1 then
- plocha()
- elseif x >= w/2-9 and x <= w/2+8 and (y <= (h/2) and y >=(h/2)-0.5) and computerMode ~= 1 then
- okno.setCursorPos(2,5)
- term.setBackgroundColor(colors.gray)
- write " "
- okno.setCursorPos(3,5)
- spojovak = read ()
- elseif x >= w/2-8 and x <= w/2+6 and (y <= (h/2+3) and y >=(h/2+3)-0.5) and computerMode ~= 1 then
- if spojovak == "" then
- os.setComputerLabel()
- elseif spojovak == " " then
- os.setComputerLabel()
- else
- os.setComputerLabel(spojovak)
- end
- plocha ()
- elseif x == 37 and y == 6 and computerMode == 1 then
- plocha ()
- elseif x >= 18 and x <= 36 and y == 11 and computerMode == 1 then
- okno.setCursorPos(2,5)
- term.setBackgroundColor(colors.gray)
- write " "
- okno.setCursorPos(3,5)
- spojovak = read ()
- elseif x >= 20 and x <= 33 and y == 14 and computerMode == 1 then
- if spojovak == "" then
- os.setComputerLabel()
- elseif spojovak == " " then
- os.setComputerLabel()
- else
- os.setComputerLabel(spojovak)
- end
- plocha ()
- else
- -- plocha()
- end
- end
- end
- function pruvodcepr ()
- local w, h = term.getSize()
- if computerMode == 1 then
- 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(nastaveni.barva)
- myWindow.clear()
- okno = window.create(term.current(),17,7,20,8)
- okno.setBackgroundColor(colors.white)
- okno.clear()
- paintutils.drawPixel (37,6, colors.red)
- term.setCursorPos(37,6)
- else
- local myWindow = window.create(term.current(),(w/2)-11,(h/2)-5,22,10)
- myWindow.setBackgroundColor(colors.gray)
- myWindow.clear()
- local myWindow = window.create(term.current(),(w/2)-11,(h/2)-5,22,10)
- myWindow.setBackgroundColor(nastaveni.barva)
- myWindow.clear()
- okno = window.create(term.current(),(w/2)-10,(h/2)-4,20,8)
- okno.setBackgroundColor(colors.white)
- okno.clear()
- paintutils.drawPixel (w/2+10,(h/2)-5, colors.red)
- term.setCursorPos(w/2+10,(h/2)-5)
- end
- write "*"
- term.setBackgroundColor(colors.gray)
- okno.setCursorPos(4,8)
- write " Auto Repair "
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- okno.setCursorPos(2,1)
- write "Connection Manager"
- okno.setCursorPos(2,3)
- write " Manual connect "
- okno.setCursorPos(2,4)
- write "Top Bottom"
- okno.setCursorPos(2,5)
- write "Left Right"
- okno.setCursorPos(2,6)
- write "Front Back"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if vyvoj then
- vyvinfo()
- term.setCursorPos(1,3)
- write (x..", "..y)
- end
- if (x <= (w/2+10) and x >= (w/2+10)-0.5) and (y <= (h/2-5) and y >=(h/2-5)-0.5) and computerMode ~= 1 then
- plocha()
- elseif (x <= (w/2-5) and x >= (w/2-9)-0.5) and (y <= (h/2-1) and y >=(h/2-1)-0.5) and computerMode ~= 1 then
- pripojka = "top"
- connecting ()
- elseif (x <= (w/2+8) and x >= (w/2+3)-0.5) and (y <= (h/2-1) and y >=(h/2-1)-0.5) and computerMode ~= 1 then
- pripojka = "bottom"
- connecting ()
- elseif (x <= (w/2-5) and x >= (w/2-9)-0.5) and (y <= (h/2) and y >=(h/2)-0.5) and computerMode ~= 1 then
- pripojka = "left"
- connecting ()
- elseif (x <= (w/2+8) and x >= (w/2+3)-0.5) and (y <= (h/2) and y >=(h/2)-0.5) and computerMode ~= 1 then
- pripojka = "right"
- connecting ()
- elseif (x <= (w/2-5) and x >= (w/2-9)-0.5) and (y <= (h/2+1) and y >=(h/2+1)-0.5) and computerMode ~= 1 then
- pripojka = "front"
- connecting ()
- elseif (x <= (w/2+8) and x >= (w/2+3)-0.5) and (y <= (h/2+1) and y >=(h/2+1)-0.5) and computerMode ~= 1 then
- pripojka = "back"
- connecting ()
- elseif (x <= (w/2+6) and x >= (w/2-8)-0.5) and (y <= (h/2+3) and y >=(h/2+3)-0.5) and computerMode ~= 1 then
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.white)
- okno.setCursorPos(4,8)
- write " Auto Repair "
- term.setBackgroundColor(colors.white)
- sleep(0.1)
- autooprava()
- elseif x >= 37 and x <= 37 and y == 6 and computerMode == 1 then
- plocha ()
- elseif x >= 18 and x <= 20 and y == 10 and computerMode == 1 then
- pripojka = "top"
- connecting ()
- elseif x >= 18 and x <= 21 and y == 11 and computerMode == 1 then
- pripojka = "left"
- connecting ()
- elseif x >= 18 and x <= 21 and y == 12 and computerMode == 1 then
- pripojka = "front"
- connecting ()
- elseif x >= 30 and x <= 36 and y == 10 and computerMode == 1 then
- pripojka = "bottom"
- connecting ()
- elseif x >= 31 and x <= 36 and y == 11 and computerMode == 1 then
- pripojka = "right"
- connecting ()
- elseif x >= 32 and x <= 36 and y == 12 and computerMode == 1 then
- pripojka = "back"
- connecting ()
- elseif x >= 20 and x <= 33 and y == 14 and computerMode == 1 then
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.white)
- okno.setCursorPos(4,8)
- write " Auto Repair "
- term.setBackgroundColor(colors.white)
- sleep(0.1)
- autooprava()
- end
- end
- end
- function autooprava()
- local function openRednet()
- for _,side in ipairs({"top", "bottom", "back", "left", "right", "front"}) do
- if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
- rednet.open(side)
- return side
- end
- end
- end
- modemSide = openRednet()
- if modemSide == nil then
- term.setCursorPos(w/2-9,h/2+2)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- write "No modem found!"
- sleep (1)
- plocha ()
- else
- if not fs.exists ("/system/.core/modem") then
- back = "0"
- left = "0"
- right = "0"
- top = "1"
- bottom = "0"
- else
- data = fs.open ("/system/.core/modem", "r")
- back = data.readLine ()
- left = data.readLine ()
- right = data.readLine ()
- top = data.readLine ()
- bottom = data.readLine ()
- data.close ()
- end
- if modemSide == ("back") then
- back = "1"
- elseif modemSide == ("right") then
- right = "1"
- elseif modemSide == ("left") then
- left = "1"
- elseif modemSide == ("top") then
- top = "1"
- elseif modemSide == ("bottom") then
- bottom = "1"
- end
- data = fs.open ("/system/.core/modem", "w")
- data.writeLine (back)
- data.writeLine (left)
- data.writeLine (right)
- data.writeLine (top)
- data.writeLine (bottom)
- data.close ()
- term.setCursorPos(w/2-9,h/2+2)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lime)
- write ("Connected on: "..modemSide)
- sleep (1)
- plocha ()
- end
- end
- function connecting ()
- local function openRednet()
- for _,side in ipairs({pripojka}) do
- if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
- rednet.open(side)
- return side
- end
- end
- end
- modemSide = openRednet()
- if modemSide == nil then
- term.setCursorPos(w/2-9,h/2+2)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- write "Error - Bad modem!"
- sleep (1)
- plocha ()
- else
- term.setCursorPos(w/2-9,h/2+2)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lime)
- write "Successful"
- sleep (1)
- end
- plocha ()
- end
- function menu()
- local w, h = term.getSize()
- if not fs.exists ("/system/Users/"..user.."/lsprogram") then
- local data = fs.open ("/system/Users/"..user.."/lsprogram", "w")
- data.writeLine("Pmanager")
- data.writeLine("/Programs/PepekSoft/pmanager")
- data.writeLine("")
- data.writeLine("")
- data.writeLine("")
- data.writeLine("")
- data.writeLine("")
- data.writeLine()
- data.writeLine("")
- data.writeLine()
- data.writeLine("")
- data.writeLine()
- data.writeLine("Setting")
- data.writeLine("/setting")
- data.close ()
- end
- if fs.exists ("/system/Users/"..user.."/lsprogram") then
- local data = fs.open ("/system/Users/"..user.."/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 computerMode == 2 or computerMode == 0 then
- local myWindow = window.create(term.current(),1,8,17,19)
- myWindow.setBackgroundColor(colors.gray)
- myWindow.clear()
- else
- local nabidka = window.create(term.current(),1,h-12,w-34,h)
- nabidka.setBackgroundColor(colors.gray)
- nabidka.clear()
- end
- term.setCursorPos(1,h-1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lightGray)
- write " "
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos(15,h-1)
- write "->"
- term.setCursorPos(math.ceil((17-#user)/2),h-12)
- write (user)
- term.setCursorPos(2,h-9)
- write (menu1)
- term.setCursorPos(2,h-8)
- write (menu2)
- term.setCursorPos(2,h-7)
- write (menu3)
- term.setCursorPos(2,h-h-13)
- write (menu4)
- term.setCursorPos(2,h-5)
- write (menu5)
- term.setCursorPos(2,h-4)
- write (menu6)
- term.setCursorPos(2,h-3)
- write (menu7)
- term.setTextColor(colors.lightGray)
- term.setCursorPos(1,h-2)
- write "* Managment"
- term.setCursorPos(1,h-10)
- write "Menu"
- term.setCursorPos(1,h-1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.lightGray)
- write (lastprikaz)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos(2,h)
- write "Power"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x == 2 and y >= 2 and y <= h-12 and button == 1 then
- plocha ()
- elseif x == 1 and y == h-2 and button == 1 then
- local data = fs.open ("/system/RAM/setting/"..user.."/setdata", "w")
- data.writeLine ("setprograms")
- data.close ()
- shell.run("/setting")
- elseif x >= 1 and x <= 12 and y == h-1 and button == 1 then
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.white)
- term.setCursorPos(1,h-1)
- write " "
- term.setCursorPos(1,h-1)
- prikaz = read()
- lastprikaz = prikaz
- if prikaz == "version" then
- term.setCursorPos(1,h-1)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.white)
- lastprikaz = (verze)
- menu()
- else
- if not fs.exists("/system/RAM/command") then
- fs.delete("/system/RAM/command")
- end
- local prikazdoc = fs.open ("/system/RAM/command", "w")
- prikazdoc.writeLine (prikaz)
- prikazdoc.writeLine (verze)
- prikazdoc.close ()
- if not fs.exists("/system/api/commands") then
- cestaP = "/system/api/commands"
- kod = "r18V4xrG"
- downloading()
- end
- shell.run("/system/api/commands")
- end
- plocha()
- elseif x >= 1 and x <= 12 and y == h-9 and button == 1 then
- if menu1 == "" then
- plocha ()
- elseif path1 == ("/Programs/PepekSoft/pmanager") then
- if not fs.exists("/Programs/PepekSoft/pmanager") then
- cestaP = "/Programs/PepekSoft/pmanager"
- kod = "5eSpGpGa"
- downloading()
- end
- shell.run("/Programs/PepekSoft/pmanager")
- else
- path = menu1
- pathr = path1
- spustit()
- end
- elseif x >= 1 and x <= 12 and y == h-8 and button == 1 then
- if menu2 == "" then
- plocha ()
- else
- path = menu2
- pathr = path2
- spustit()
- end
- elseif x >= 1 and x <= 12 and y == h-7 and button == 1 then
- if menu3 == "" then
- plocha ()
- else
- path = menu3
- pathr = path3
- spustit()
- end
- elseif x >= 1 and x <= 12 and y == h-6 and button == 1 then
- if menu4 == "" then
- plocha ()
- else
- path = menu4
- pathr = path4
- spustit()
- end
- elseif x >= 1 and x <= 12 and y == h-5 and button == 1 then
- if menu5 == "" then
- plocha ()
- else
- path = menu5
- pathr = path5
- spustit()
- end
- elseif x >= 1 and x <= 12 and y == h-4 and button == 1 then
- if menu6 == "" then
- plocha ()
- else
- path = menu6
- pathr = path6
- spustit()
- end
- elseif x >= 1 and x <= 12 and y == h-3 and button == 1 then
- if menu7 == "" then
- plocha ()
- elseif path7 == ("/setting") then
- if not fs.exists ("/setting") then
- cestaP = "/setting"
- kod = "vxJjQzem"
- downloading()
- end
- shell.run("/setting")
- else
- path = menu7
- pathr = path7
- spustit()
- end
- elseif x >= 1 and x <= 6 and y == h and button == 1 then -- vypnout
- power()
- else
- plocha ()
- end
- end
- end
- function spustit()
- shell.run(pathr)
- end
- function power()
- term.setTextColor(colors.white)
- local myWindow = window.create(term.current(),2,h-1,8,h)
- myWindow.setBackgroundColor(colors.lightGray)
- myWindow.clear()
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos(2,h-6)
- write " "
- term.setCursorPos(2,h-5)
- write " Switch "
- term.setCursorPos(2,h-4)
- write " Log Out "
- term.setCursorPos(2,h-3)
- write " "
- term.setCursorPos(2,h-2)
- write " Sleep "
- term.setCursorPos(2,h-1)
- write " Restart "
- term.setCursorPos(2,h)
- write " Shutdown "
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if (x >= 1 and x <= 10 and y == h-2) and (button == 1 or button == 2)then
- spanek ()
- elseif (x >= 1 and x <= 10 and y == h-1) and (button == 1 or button == 2)then
- restart ()
- elseif (x >= 1 and x <= 10 and y == h) and (button == 1 or button == 2)then
- vypnout ()
- elseif (x >= 1 and x <= 10 and y == h-5) and (button == 1 or button == 2)then
- local data = fs.open ("/system/RAM/logout", "w")
- data.close ()
- shell.run("/startup")
- elseif (x >= 1 and x <= 10 and y == h-4) and (button == 1 or button == 2)then
- local data = fs.delete ("/system/RAM"..user)
- logout()
- else
- menu()
- end
- end
- desktop()
- end
- function spanek ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.black)
- term.clear()
- while true do
- local event, button, xPos, yPos = os.pullEvent("mouse_click")
- desktop ()
- end
- end
- function logout ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(w-28, h-12)
- prc "Logging out..."
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(w/2-5,h-1)
- write " Pepek"
- term.setCursorPos(w/2+3,h-1)
- write "Soft "
- term.setCursorPos(w/2+2,h-1)
- term.setTextColor(colors.lime)
- write "@"
- sleep (1)
- local data = fs.open ("/system/RAM/logout", "w")
- data.close ()
- shell.run("/startup")
- end
- function vypnout()
- if ServerMode then
- local stopserver = fs.open("/system/RAM/shutdown.pdr", "w")
- stopserver.close()
- end
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(w-28, h-12)
- prc "Shutting down..."
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(w/2-5,h-1)
- write " Pepek"
- term.setCursorPos(w/2+3,h-1)
- write "Soft "
- term.setCursorPos(w/2+2,h-1)
- term.setTextColor(colors.lime)
- write "@"
- sleep (2)
- local data = fs.open ("/system/RAM/vypnuto", "w")
- data.close ()
- term.setBackgroundColor(colors.black)
- term.clear()
- os.shutdown ()
- end
- function restart ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.black)
- term.clear()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(w-28, h-12)
- prc "Restarting..."
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(w/2-5,h-1)
- write " Pepek"
- term.setCursorPos(w/2+3,h-1)
- write "Soft "
- term.setCursorPos(w/2+2,h-1)
- term.setTextColor(colors.lime)
- write "@"
- sleep (1)
- local data = fs.open ("/system/RAM/vypnuto", "w")
- data.close ()
- term.setBackgroundColor(colors.black)
- term.clear()
- os.reboot ()
- end
- desktop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement