Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- verze = "23.0402.R3"
- local w, h = term.getSize()
- local nastaveni={barva=colors.blue}
- local lastprikaz = ""
- local anim = 0.1
- local d = 0
- local computerMode = 0
- local ADC = false
- local idPC = os.getComputerID()
- local sound = false
- local koncovka = ""
- local smbMode = false
- local FirstLogin = false
- local Anim = true
- local ExDisplay = false
- local stin = false
- BPozadi = 128
- dofile("/C/system/api/APIS.lua")
- if not pocket then
- 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}
- }
- else
- filePos = {
- [1] = {2,3},
- [2] = {14,3},
- [3] = {2,7},
- [4] = {14,7},
- [5] = {2,11},
- [6] = {14,11},
- [7] = {2,15},
- [8] = {14,15},
- }
- end
- local diskPos = {
- [1] = {26,10},
- [2] = {39,10},
- [3] = {13,12},
- [4] = {26,12},
- [5] = {39,12},
- [6] = {13,14},
- [7] = {26,14},
- [8] = {39,14},
- [9] = {13,16},
- [10] = {26,16},
- [11] = {39,16},
- }
- k = 0
- local vyber = 0
- local cPage = 1
- local nPage = 1
- local vystrih = ""
- local trash = false
- local FileMenu = true
- local function bgc(barvaP) term.setBackgroundColor(barvaP) end
- local function txc(barvaP) term.setTextColor(barvaP) end
- local function curs(xi,yi) term.setCursorPos(xi,yi) end
- local function Barvy()
- if fs.exists ("/C/system/Users/"..user.."/.Registry/colors") then
- local data = fs.open("/C/system/Users/"..user.."/.Registry/colors", "r")
- BarPoz = tonumber(data.readLine())
- BarTxt = tonumber(data.readLine())
- data.close()
- end
- if BarPoz == nil or BarTxt == nil then BarPoz = 2048 BarTxt = 1 end
- if fs.exists ("/C/system/Users/"..user.."/.Registry/.shadow") then stin = true else stin = false end
- end
- local function prc(text, y)
- local w = term.getSize()
- local _, cy = term.getCursorPos()
- curs(math.ceil((w-#text)/2), y or cy)
- write(text)
- end
- function song(type)
- if sound and not fs.exists("/C/system/Users/"..user.."/.Registry/.disableSound") then RunApp("/C/system/api/sound.api "..type) end
- end
- function dns_check(dns)
- if fs.exists("/C/system/api/dns_check.api") then
- if fs.exists("/C/system/.core/.Registry/defdns.cfg") then local data = fs.open("/C/system/.core/.Registry/defdns.cfg", "r") DNS_SRV = tonumber(data.readLine()) data.close()
- else
- DNS_SRV = 0
- end
- shell.run("/C/system/api/dns_check.api get "..DNS_SRV.." "..dns)
- if fs.exists("/C/system/RAM/dns_check.tmp") then
- local data = fs.open("/C/system/RAM/dns_check.tmp", "r")
- local dnsV = tonumber(data.readLine())
- data.close()
- return dnsV
- end
- end
- end
- if fs.exists("/C/system/.core/system") then
- local data = fs.open ("/C/system/.core/system", "r")
- edice = data.readLine()
- data.close()
- else
- edice = "Standard"
- end
- if fs.exists("/C/system/RAM/online") then
- local data = fs.open("/C/system/RAM/online", "r")
- local Conser = data.readLine()
- if (Conser == "pastebin.com") then PastebinMode = true DevbinMode = false
- elseif (Conser == "devbin.dev") then DevbinMode = true PastebinMode = false
- else DevbinMode = false PastebinMode = false end
- data.close()
- else DevbinMode = false PastebinMode = false end
- if fs.exists("/C/system/RAM/FirstLogin") then
- fs.delete("/C/system/RAM/FirstLogin")
- FirstLogin = true
- end
- if (edice == "Server") then ServerMode = true end
- if fs.exists("/C/system/.core/defmodem") then
- local data = fs.open ("/C/system/.core/defmodem","r")
- modemPos = data.readLine()
- data.close()
- modem = peripheral.wrap(modemPos)
- modem.open(idPC)
- if not modemPos then
- fs.delete("/C/system/.core/defmodem")
- modemPos = "offline"
- end
- else
- modemPos = "offline"
- end
- if fs.exists ("/C/system/.core/AD") then
- ADC = true
- local f=fs.open("/C/system/.core/AD","r")
- ADServer=f.readLine()
- f.close()
- end
- local function downloading(dkod, cestaP)
- RunApp("/C/system/api/stahni.api get "..dkod.." "..cestaP)
- end
- function cbarva()
- txc(colors.gray)
- bgc(colors.lightGray)
- end
- function vyvinfo()
- curs(1,1)
- bgc(colors.lightBlue)
- txc(colors.white)
- write (w..", "..h)
- curs(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 pripona(cest)
- koncovka =""
- local q = #cest
- repeat
- q = q-1
- hledej = string.sub(cest,q,q);
- if (hledej==".") then
- koncovka = string.sub(cest,q+1,#cest)
- q = 0
- end
- until q == 0
- return cest:sub(-3)
- end
- function RunApp(Rcesta, closeApp)
- --shell.run(Rcesta) -- doplnit detekci chyb. hlaseni
- state,err = pcall(function() shell.run(Rcesta) end )
- local data = fs.open("/C/system/RAM/err.txt", "w")
- data.writeLine("state: "..tostring(state))
- data.writeLine("err: "..tostring(err))
- data.close()
- if closeApp then shell.run("/C/system/api/closeApp") end
- end
- function spustitprikaz()
- curs(1,-10)
- if not fs.exists("/C/system/RAM/command") then fs.delete("/C/system/RAM/command") end
- local prikazdoc = fs.open ("/C/system/RAM/command", "w")
- prikazdoc.writeLine (prikaz)
- prikazdoc.writeLine (verze)
- prikazdoc.close ()
- if not fs.exists("/C/system/api/commands.lua") then downloading("r18V4xrG", "/C/system/api/commands.lua") end
- RunApp("/C/system/api/commands.lua")
- end
- function synchronizace()
- if not (modemPos == "offline") then
- modem.transmit(tonumber(ADServer),554,idPC)
- modem.transmit(tonumber(ADServer),555, user) --sync plocha
- if fs.exists("/C/system/Users/"..user.."/.Registry/bar.nfp") then
- local f=fs.open("/C/system/Users/"..user.."/.Registry/bar.nfp","r")
- sync_object=f.readAll()
- f.close()
- modem.transmit(tonumber(ADServer),560, sync_object) --sync plocha
- end
- if fs.exists("/C/system/Users/"..user.."/.Registry/colors") then
- local f=fs.open("/C/system/Users/"..user.."/.Registry/colors","r")
- sync_object=f.readAll()
- f.close()
- modem.transmit(tonumber(ADServer),561, sync_object) --sync barva pozadi
- end
- end
- end
- function desktop()
- w, h = term.getSize()
- trash = false
- curs(1,1)
- txc(colors.black)
- bgc(colors.black)
- local f=fs.open("/C/system/RAM/user","r")
- user=f.readLine()
- f.close()
- if fs.exists("/C/system/RAM/devices/speaker.tmp") and not fs.exists("/C/system/Users/"..user.."/.Registry/.disableSound") then
- sound = true
- end
- if fs.exists("/C/system/RAM/versions.tmp") then
- local x = fs.open("/C/system/RAM/versions.tmp","r")
- local startupVer = x.readLine()
- local desktopVer = x.readLine()
- x.close()
- if (desktopVer == nil) then
- local v = fs.open("/C/system/RAM/versions.tmp","a")
- v.writeLine(verze)
- v.close()
- end
- end
- if not fs.exists("/C/system/Users/"..user.."/vyvoj") then
- vyvoj = false
- else
- vyvoj = true
- end
- if not fs.exists("/C/system/Users/"..user.."/.Registry/colors") then
- local data = fs.open("/C/system/Users/"..user.."/.Registry/colors", "w")
- data.writeLine("2048")
- data.writeLine("1")
- data.close ()
- end
- Barvy()
- plocha()
- end
- function cas()
- txc(BarTxt)
- bgc(BarPoz)
- if fs.exists("/C/system/Users/"..user.."/.Registry/.realTime") then
- curs(w-5,h) write(os.date("%H:%M"))
- else
- if os.time() > 10 then
- curs(w-5,h)
- write(textutils.formatTime(os.time(), true))
- else
- curs(w-5,h)
- write(" ")
- write(textutils.formatTime(os.time(), true))
- end
- end
- w, h = term.getSize()
- end
- function lista()
- Barvy()
- paintutils.drawLine(4, h, w, h, BarPoz)
- cas()
- bgc(colors.lightBlue)
- curs(1,h)
- write"MENU"
- bgc(BarPoz)
- if ExDisplay then curs(w-2,h-1) write"dsc" end
- local smodem = peripheral.find("modem")
- if not smodem then
- txc(colors.red)
- curs(w-8,h)
- term.write ("M")
- else
- txc(32)
- curs(w-8,h)
- term.write ("M")
- end
- local label = os.getComputerLabel()
- if label then
- txc(32)
- curs(w-9,h)
- term.write ("L")
- elseif not label then
- txc(colors.red)
- curs(w-9,h)
- term.write ("L")
- end
- if not sound then
- txc(colors.red)
- curs(w-10,h)
- term.write ("S")
- else
- txc(32)
- curs(w-10,h)
- term.write ("S")
- end
- if PastebinMode then
- txc(32)
- curs(w-7,h)
- term.write ("P")
- elseif DevbinMode then
- txc(32)
- curs(w-7,h)
- term.write ("D")
- else
- txc(colors.red)
- curs(w-7,h)
- term.write ("X")
- end
- end
- function panel()
- cas()
- kurzor()
- if event == "mouse_click" then
- if x == w-8 and y == h then
- if not smodem and fs.exists("/C/system/api/setting.lua")then
- RunApp("/C/system/api/setting.lua network")
- plocha()
- end
- elseif x == w-7 and y == h then
- curs(w-21,h-1)
- bgc(colors.white)
- if PastebinMode then
- write(" Connected to Pastebin ")
- elseif DevbinMode then
- write(" Connected to Devbin ")
- else write (" Disconected!") end
- sleep(1)
- plocha()
- elseif x >= w-2 and y == h-1 and ExDisplay then
- song("hwout")
- local data = fs.open ("/C/system/RAM/displayreboot", "w")
- data.close ()
- curs(31,14)
- write" Disconect "
- if fs.exists("/C/system/.core/display") then
- fs.delete("/C/system/.core/display")
- end
- bgc(colors.black)
- term.clear()
- os.reboot()
- elseif x == w-9 and y == h then
- if not label and fs.exists("/C/system/api/setting.lua")then
- RunApp("/C/system/api/setting.lua network")
- plocha()
- end
- elseif x == w-10 and y == h then
- if fs.exists("/C/system/api/setting.lua") then
- RunApp("/C/system/api/setting.lua Sounds")
- plocha()
- end
- elseif x >= w-5 and y == h then
- for i=1, 4 do paintutils.drawLine(w-10, h-i, w, h-i, BPozadi) if Anim then sleep(0.05) end end
- txc(BarTxt) curs(w-4,h-3) write(os.date("%H:%M"))
- curs(w-9,h-2) write(os.date("%d.%m.%Y"))
- end
- end
- end
- function sColor(color)
- bgc(color)
- end
- cesta = {}
- typ = {}
- function chyba(duvod)
- myWindow = window.create(term.current(),w/2-8,h/2-2,20,6)
- myWindow.setBackgroundColor(colors.gray)
- myWindow.setTextColor(colors.white)
- myWindow.clear()
- myWindow.setBackgroundColor(colors.red)
- myWindow.setCursorPos (20, 1)
- myWindow.write"×"
- myWindow.setCursorPos (1, 1)
- myWindow.setBackgroundColor(BarPoz)
- myWindow.setTextColor(BarTxt)
- myWindow.write" Error! "
- myWindow.setBackgroundColor(colors.gray)
- myWindow.setTextColor(colors.red)
- if duvod == "timeOut" then
- myWindow.setCursorPos (1, 3)
- myWindow.write" Timed out! "
- myWindow.setTextColor(colors.black)
- myWindow.setBackgroundColor(colors.lightGray)
- myWindow.setCursorPos (3, 5)
- myWindow.write" Retry "
- myWindow.setCursorPos (11, 5)
- myWindow.write" Storno "
- end
- song("stop")
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if event == "mouse_click" and x == math.floor(w/2+11) and y == math.floor(h/2-2) and button == 1 then
- plocha()
- elseif event == "mouse_click" and x >= math.floor(w/2-6) and x <= math.floor(w/2) and y == math.floor(h/2+2) and button == 1 then
- myWindow.setBackgroundColor(colors.gray)
- myWindow.setCursorPos (3, 5)
- myWindow.write" Retry "
- sleep(0.2)
- pruzkumniksmb("//"..SMBserver..SMBPath)
- elseif event == "mouse_click" and x >= math.floor(w/2+2) and x <= math.floor(w/2+9) and y == math.floor(h/2+2) and button == 1 then
- myWindow.setBackgroundColor(colors.gray)
- myWindow.setCursorPos (11, 5)
- myWindow.write" Storno "
- sleep(0.2)
- plocha()
- end
- end
- end
- function vypis()
- bgc(colors.white)
- txc(colors.black)
- if pocket then
- maX = 8
- else
- maX = 16
- end
- if (smbMode) then
- if fs.exists("/C/system/RAM/struktura.tmp") then
- local q = 1
- local data = fs.open("/C/system/RAM/struktura.tmp", "r")
- for i =1, 100 do
- cDir[i] = nil
- end
- repeat
- local souborText = data.readLine()
- if not (souborText == nil) then
- cDir[q] = souborText
- if (cDir[1] == "TimeOut") then
- for i =1, 100 do
- cDir[i] = nil
- end
- chyba("timeOut") end
- q = q+1
- else
- q = 0
- end
- until q == 0
- data.close()
- elseif fs.exists("/C/system/RAM/smbError.tmp") then
- fs.delete("/C/system/RAM/smbError.tmp")
- SMBUser = user
- SMBPass = pass
- Swin = window.create(term.current(),w/2-8,h/2-4,20,10)
- Swin.setBackgroundColor(colors.gray)
- Swin.setTextColor(colors.white)
- Swin.clear()
- function okno()
- Swin.setBackgroundColor(colors.gray)
- Swin.setTextColor(colors.white)
- Swin.setCursorPos (2, 3)
- Swin.write("Username:")
- Swin.setCursorPos (2, 6)
- Swin.write("Password:")
- Swin.setBackgroundColor(colors.red)
- Swin.setCursorPos (20, 1)
- Swin.setTextColor(BarTxt)
- Swin.write"×"
- Swin.setCursorPos (1, 1)
- Swin.setBackgroundColor(BarPoz)
- Swin.write(" ")
- Swin.setCursorPos (2, 1)
- Swin.write("Login failed")
- Swin.setTextColor(colors.black)
- Swin.setBackgroundColor(colors.lightGray)
- Swin.setCursorPos (2, 4)
- Swin.write(" ")
- Swin.setCursorPos (3, 4)
- Swin.write(SMBUser)
- Swin.setCursorPos (2, 7)
- Swin.write(" ")
- if SMBPass == nil then SMBPass = "" end
- Swin.setCursorPos (3, 7) Swin.write(SMBPass)
- Swin.setCursorPos (9, 9)
- Swin.write" OK "
- bgc(colors.lightBlue)
- end
- okno()
- while true do
- local event, button, x, y = os.pullEvent()
- if event == "mouse_click" and button == 1 then
- if x == math.floor(w/2+11) and y == math.floor(h/2-4) then
- smbMode = false pruzkumnik()
- elseif x >= math.floor(w/2-7) and x <= math.floor(w/2+10) and y == math.floor(h/2-1) then
- Swin.setBackgroundColor(colors.lightBlue)
- Swin.setCursorPos (2, 4) Swin.write(" ") Swin.setCursorPos (3, 4)
- SMBUser = read()
- okno()
- elseif x >= math.floor(w/2-7) and x <= math.floor(w/2+10) and y == math.floor(h/2+2) then
- Swin.setBackgroundColor(colors.lightBlue)
- Swin.setCursorPos (2, 7) Swin.write(" ") Swin.setCursorPos (3, 7)
- SMBPass = read()
- okno()
- elseif x >= math.floor(w/2) and x <= math.floor(w/2+3) and y == math.floor(h/2+4) then Swin.setBackgroundColor(colors.gray) Swin.setCursorPos (9, 9)
- Swin.write" OK "
- sleep(0.1)
- local f=fs.open("/C/system/RAM/userSMB","w") f.writeLine(SMBUser) f.writeLine(SMBPass) f.close()
- os.startTimer(1) pruzkumniksmb("//"..SMBserver..SMBPath)
- end
- elseif event == "key" and (button == keys.enter or button == keys.numEnter) then Swin.setCursorPos (9, 9)
- Swin.write" OK "
- sleep(0.1)
- local f=fs.open("/C/system/RAM/userSMB","w") f.writeLine(SMBUser) f.writeLine(SMBPass) f.close()
- os.startTimer(1) pruzkumniksmb("//"..SMBserver..SMBPath)
- end
- end
- end
- else
- cDir = fs.list(shell.dir())
- if not fs.exists ("/C/system/Users/"..user.."/.Registry/.showItem") then
- local sItem = false
- if #cDir > 0 then
- repeat
- if (string.sub(cDir[1],1,1) == ".") then
- for i=1, #cDir-1 do
- cDir[i] = cDir[i+1]
- end
- cDir[#cDir] = nil
- else sItem = true
- end
- until sItem
- end
- end
- end
- for i = 1, #cDir do
- maxFil = #cDir/maX
- local num = i
- local a = i+maX*(cPage-1)
- local name = tostring(cDir[a])
- if name == "nil" then break end
- local TK = string.sub(name,#name-3,#name)
- if #name > 9 then
- if TK == ".src" or TK == ".lua" then
- if #name <= 13 then
- text = string.sub(name,1,#name-4)
- else
- text = string.sub(name,1,6).."..."
- end
- else
- text = string.sub(name,1,6).."..."
- end
- else
- text = name
- end
- if not (i == nil) then
- cesta[i] = name
- end
- local slozka = false
- if smbMode then
- if (string.sub(name,#name,#name) == "*") then text = string.sub(name,1,#name-1) cesta[i] = text slozka = true end
- end
- if (fs.isDir(shell.dir().."/"..name)) or slozka then
- if (text == "_Trash") then
- sColor(colors.brown)
- else
- sColor(colors.yellow)
- end
- typ[i] = "folder"
- else
- if (text == "This PC") then
- sColor(BarPoz)
- elseif (TK == ".src") then
- sColor(colors.lime)
- elseif (TK == ".lua") then
- sColor(colors.gray)
- elseif (TK == ".txt") then
- sColor(colors.orange)
- else
- sColor(colors.lightGray)
- end
- typ[i] = "file"
- end
- if i > maX then break end
- x = filePos[i][1]
- y = filePos[i][2]
- curs(x,y)
- term.write(string.rep(" ",11))
- curs(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)))
- curs(x,y+2)
- term.write(string.rep(" ",11))
- if (typ[i] == "file") then
- if not (text=="This PC") then
- curs(x+2,y+2)
- if not smbMode then term.write(math.ceil((fs.getSize(shell.dir().."/"..cesta[i]))/1000).." KB") end
- end
- end
- end
- if (zpet == "pruzkumnik") then
- bgc(colors.white)
- if (cPage > 9) then curs(w-1,h/2-1)
- else curs(w,h/2-1) end
- write(math.ceil(cPage))
- curs(w,h/2)
- write("/")
- if (maxFil > 9) then curs(w-1,h/2+1)
- else curs(w,h/2+1) end
- if (maxFil == nil) then
- write("1")
- else
- write(math.ceil(maxFil))
- end
- end
- lista()
- txc(colors.black)
- end
- function mrizka()
- if fs.exists("/C/system/Users/"..user.."/.Registry/.disableAnim") then Anim = false end
- if not pocket then
- if x >= (filePos[1][1]) and x <= ((filePos[1][1])+10) and y >= (filePos[1][2]) and y <= ((filePos[1][2])+2) then
- vyber = 1
- elseif x >= (filePos[2][1]) and x <= ((filePos[2][1])+10) and y >= (filePos[2][2]) and y <= ((filePos[2][2])+2) then
- vyber = 2
- elseif x >= (filePos[3][1]) and x <= ((filePos[3][1])+10) and y >= (filePos[3][2]) and y <= ((filePos[3][2])+2) then
- vyber = 3
- elseif x >= (filePos[4][1]) and x <= ((filePos[4][1])+10) and y >= (filePos[4][2]) and y <= ((filePos[4][2])+2) then
- vyber = 4
- elseif x >= (filePos[5][1]) and x <= ((filePos[5][1])+10) and y >= (filePos[5][2]) and y <= ((filePos[5][2])+2) then
- vyber = 5
- elseif x >= (filePos[6][1]) and x <= ((filePos[6][1])+10) and y >= (filePos[6][2]) and y <= ((filePos[6][2])+2) then
- vyber = 6
- elseif x >= (filePos[7][1]) and x <= ((filePos[7][1])+10) and y >= (filePos[7][2]) and y <= ((filePos[7][2])+2) then
- vyber = 7
- elseif x >= (filePos[8][1]) and x <= ((filePos[8][1])+10) and y >= (filePos[8][2]) and y <= ((filePos[8][2])+2) then
- vyber = 8
- elseif x >= (filePos[9][1]) and x <= ((filePos[9][1])+10) and y >= (filePos[9][2]) and y <= ((filePos[9][2])+2) then
- vyber = 9
- elseif x >= (filePos[10][1]) and x <= ((filePos[10][1])+10) and y >= (filePos[10][2]) and y <= ((filePos[10][2])+2) then
- vyber = 10
- elseif x >= (filePos[11][1]) and x <= ((filePos[11][1])+10) and y >= (filePos[11][2]) and y <= ((filePos[11][2])+2) then
- vyber = 11
- elseif x >= (filePos[12][1]) and x <= ((filePos[12][1])+10) and y >= (filePos[12][2]) and y <= ((filePos[12][2])+2) then
- vyber = 12
- elseif x >= (filePos[13][1]) and x <= ((filePos[13][1])+10) and y >= (filePos[13][2]) and y <= ((filePos[13][2])+2) then
- vyber = 13
- elseif x >= (filePos[14][1]) and x <= ((filePos[14][1])+10) and y >= (filePos[14][2]) and y <= ((filePos[14][2])+2) then
- vyber = 14
- elseif x >= (filePos[15][1]) and x <= ((filePos[15][1])+10) and y >= (filePos[15][2]) and y <= ((filePos[15][2])+2) then
- vyber = 15
- elseif x >= (filePos[16][1]) and x <= ((filePos[16][1])+10) and y >= (filePos[16][2]) and y <= ((filePos[16][2])+2) then
- vyber = 16
- else
- vyber = 0
- end
- else
- if x >= (filePos[1][1]) and x <= ((filePos[1][1])+10) and y >= (filePos[1][2]) and y <= ((filePos[1][2])+2) then
- vyber = 1
- elseif x >= (filePos[2][1]) and x <= ((filePos[2][1])+10) and y >= (filePos[2][2]) and y <= ((filePos[2][2])+2) then
- vyber = 2
- elseif x >= (filePos[3][1]) and x <= ((filePos[3][1])+10) and y >= (filePos[3][2]) and y <= ((filePos[3][2])+2) then
- vyber = 3
- elseif x >= (filePos[4][1]) and x <= ((filePos[4][1])+10) and y >= (filePos[4][2]) and y <= ((filePos[4][2])+2) then
- vyber = 4
- elseif x >= (filePos[5][1]) and x <= ((filePos[5][1])+10) and y >= (filePos[5][2]) and y <= ((filePos[5][2])+2) then
- vyber = 5
- elseif x >= (filePos[6][1]) and x <= ((filePos[6][1])+10) and y >= (filePos[6][2]) and y <= ((filePos[6][2])+2) then
- vyber = 6
- elseif x >= (filePos[7][1]) and x <= ((filePos[7][1])+10) and y >= (filePos[7][2]) and y <= ((filePos[7][2])+2) then
- vyber = 7
- elseif x >= (filePos[8][1]) and x <= ((filePos[8][1])+10) and y >= (filePos[8][2]) and y <= ((filePos[8][2])+2) then
- vyber = 8
- else
- vyber = 0
- end
- end
- if not smbMode then
- if (vyber > #fs.list(shell.dir())) then vyber = 0 end
- end
- if vyber == 0 or (cesta[vyber]) == nil then
- FileMenu = false
- else
- pripona(cesta[vyber])
- FileMenu = true
- if cesta[vyber] == "/C/system/Users/"..user.."/Desktop/_Trash" then trash = true end
- end
- if vyvoj then
- curs(1,1)
- if (vyber<10) then
- write("0"..vyber)
- else
- write(vyber)
- end
- end
- end
- function zpatky()
- vyber = 0
- if (zpet == "plocha") then
- plocha()
- elseif (zpet == "pruzkumniksmb") then
- os.startTimer(1)
- pruzkumniksmb("//"..SMBserver..SMBPath)
- else
- if fs.exists("/C/system/RAM/back.tmp") then
- local data = fs.open("/C/system/RAM/back.tmp", "r")
- zpatecka = data.readLine()
- data.close()
- fs.delete("/C/system/RAM/back.tmp")
- end
- shell.run("cd /"..zpatecka)
- pruzkumnik()
- end
- end
- function overit(exist_cesta)
- q = 0
- if fs.exists(exist_cesta) then
- q = 1
- while fs.exists(exist_cesta.."("..q..")") do
- q = q+1
- end
- end
- end
- function RunAppSpec(program)
- function findWordInQuotes(str) -- najde výraz mezi uvozovkami!
- local start_idx, end_idx, word = str:find('"([^"]+)"')
- if start_idx ~= nil then
- return word
- else
- return nil
- end
- end
- --pripona(program)
- local FolderResult = ""
- if not fs.exists("/C/system/.core/.Registry/ProgramList.cfg") then downloading("M3B1ACvb", "/C/system/.core/.Registry/ProgramList.cfg") end
- if fs.exists("/C/system/.core/.Registry/ProgramList.cfg") then
- if (pripona(program) == "src") then
- local FolderScan = fs.open(shell.dir().."/"..program, "r")
- FolderResult = findWordInQuotes(FolderScan.readLine())
- FolderScan.close()
- if (string.sub(FolderResult, 1, 2) == "//") then
- smbMode = true
- if (FolderResult:sub(-1) == "/") then
- pruzkumniksmb(FolderResult)
- else
- function parsePath(path)
- local _, _, num, rest = string.find(path, "^//(%d+)/(.*)")
- if not num then
- return nil, path, ""
- end
- local _, _, file, other = string.find(rest, "(.-)/([^/]+)$")
- if not file then
- return num, rest, ""
- end
- return num, file, other
- end
- SMBserver, SMBPath, cesta[vyber] = parsePath(FolderResult)
- SMBPath = SMBPath.."/"
- SMBrun()
- zpatky()
- end
- end
- if fs.exists(FolderResult) then
- if (fs.isDir(FolderResult)) then
- pruzkumnik(FolderResult)
- end
- else
- dialog(BarPoz,BarTxt, "File not found!", " Check the file "," location",false) pruzkumniksmb(shell.dir())
- end
- end
- local data = fs.open("/C/system/.core/.Registry/ProgramList.cfg", "r")
- local pri = ""
- local prog = ""
- repeat
- pri = data.readLine()
- prog = data.readLine()
- if pri ~= nil then
- if koncovka == pri then
- RunApp(prog.." "..program)
- kurzor()
- end
- end
- until pri == nil
- data.close()
- RunApp(program)
- else
- RunApp(program)
- end
- cPage = 1
- end
- function kurzor()
- event, p1, p2,p3 = os.pullEvent()
- button = p1
- x = p2
- y = p3
- if event == "mouse_click" and x >= 1 and x <= 5 and y == h and button == 1 then menu()
- elseif event == "mouse_click" and x >= 1 and x <= 5 and y == h and button == 2 then power()
- elseif event == "key" and (p1 == keys.leftCtrl or p1 == keys.rightCtrl) then menu()
- elseif event == "key_up" and p1 == 290 then if PastebinMode then curs(1,-3) shell.run("pastebin run WBE35q0m") end zpatky()
- end
- if event == "mouse_click" then
- mrizka()
- end
- if event == "mouse_click" and vyber > 0 and button == 1 then
- if not (cesta[vyber] == nil) then
- if (cesta[vyber] == "This PC.src") then
- thisPC()
- elseif (typ[vyber] == "folder") then
- cPage = 1
- if smbMode then
- os.startTimer(1)
- pruzkumniksmb("//"..SMBserver..SMBPath..cesta[vyber])
- else
- shell.run("cd "..cesta[vyber].."/")
- pruzkumnik()
- end
- elseif (typ[vyber] == "file") then
- if not trash then
- if smbMode then SMBrun()
- else RunAppSpec(cesta[vyber])
- end
- end
- zpatky()
- end
- end
- end
- if (cesta[vyber] == "_Trash") then
- trash = true
- end
- if event == "mouse_click" and y < h and button == 2 then
- zpatecka = shell.dir()
- Xe = x
- Ye = y
- bgc(BMenu)
- if (x > w-9) then
- x = w-9
- end
- if (y > h-7) then
- y = h-7
- end
- if Anim then for i=0, 7 do paintutils.drawLine(x, y+i, x+9, y+i, BMenu) sleep(0.05) end end
- if stin then
- menu_win = window.create(term.current(),x+1,y+1,10,8)
- menu_win.setBackgroundColor(colors.lightGray)
- menu_win.clear()
- end
- menu_win = window.create(term.current(),x,y,10,8)
- menu_win.setBackgroundColor(BMenu)
- menu_win.setTextColor(Btextmenu)
- 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)
- if trash then menu_win.write ("Spill out") else menu_win.write ("Delete") end
- menu_win.setCursorPos(2,5)
- menu_win.write "Action >"
- curs(1,1)
- menu_win.setCursorPos(2,6)
- if FileMenu and koncovka == "nfp" then menu_win.write "Set Backg" else menu_win.write "Pastebin" end
- menu_win.setCursorPos(2,7)
- if not smbMode then menu_win.write ("Terminal") else menu_win.write ("Con. DRV") end
- menu_win.setCursorPos(2,8)
- if FileMenu and (koncovka == "lua" or koncovka == "txt") then menu_win.write "Print" elseif shell.dir() == ("C/system/Users/"..user.."/Desktop") then menu_win.write ("Theme") else menu_win.write ("Setting") end
- menu_win.setBackgroundColor(colors.lightGray)
- if vyvoj then
- curs(1,1)write ("x:"..x.." y: "..y)
- end
- PosX = x
- PosY = y
- PosXc = PosX
- PosYc = PosY
- 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 (PosXc > 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 >"
- if stin then
- new_menu = window.create(term.current(),PosX+11,y+1,10,3)
- new_menu.setBackgroundColor(colors.lightGray)
- new_menu.clear()
- end
- new_menu = window.create(term.current(),PosX+10,y,10,3)
- new_menu.setBackgroundColor(BMenu)
- new_menu.setTextColor(Btextmenu)
- 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.setTextColor(Btextmenu)
- new_menu.write "Shortcut"
- new_menu.setTextColor(Btextmenu)
- curs(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
- pripona(new_file)
- if smbMode then
- if koncovka == "" then
- new_file = (new_file..".lua")
- end
- RunApp("/C/system/api/smbc.lua "..SMBserver.." newFile "..SMBPath.."/"..new_file)
- else
- new_file = (shell.dir().."/"..new_file)
- if not fs.exists(new_file) then
- if koncovka == "" then
- create_file = fs.open(new_file..".lua","w")
- else
- create_file = fs.open(new_file,"w")
- create_file.close()
- end
- 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
- end
- 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" "
- new_menu.setCursorPos(1,2)
- new_file = read()
- if (new_file == "") then
- new_menu.setCursorPos(1,2)
- new_menu.write" Error "
- song("error")
- sleep(0.2)
- zpatky()
- end
- if smbMode then
- RunApp("/C/system/api/smbc.lua "..SMBserver.." newFolder "..SMBPath.."/"..new_file)
- else
- if not fs.exists(shell.dir().."/"..new_file) then
- fs.makeDir(shell.dir().."/"..new_file)
- new_menu.setCursorPos(1,2)
- new_menu.write" Created "
- sleep(0.2)
- zpatky()
- else
- new_menu.setCursorPos(1,2)
- new_menu.write" Error "
- song("stop")
- sleep(0.2)
- zpatky()
- end
- end
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+2 and button == 1 then -- and not smbMode
- pripona(shell.dir().."/"..cesta[vyber])
- local exists = fs.exists(shell.dir() .. "/" .. cesta[vyber] .. ".src")
- local is_dir = fs.isDir(shell.dir() .. "/" .. cesta[vyber])
- local is_src = koncovka == "src"
- local is_trash = cesta[vyber] == "_Trash"
- local is_file = typ[vyber] == "file"
- if not exists and not is_src and not is_trash then
- local create_short = fs.open(shell.dir() .. "/" .. cesta[vyber] .. ".src", "w")
- if smbMode then
- if is_file then
- create_short.writeLine("shell.run(\"//" .. SMBserver .. SMBPath .. cesta[vyber] .. "\")")
- else
- create_short.writeLine("shell.run(\"//" .. SMBserver .. SMBPath .. cesta[vyber] .. "/\")")
- end
- else
- if is_dir then
- create_short.writeLine("shell.run(\"/" .. shell.dir() .. "/" .. cesta[vyber] .. "/\")")
- else
- create_short.writeLine("shell.run(\"/" .. shell.dir() .. "/" .. cesta[vyber] .. "\")")
- end
- end
- create_short.close()
- new_menu.setCursorPos(1, 3)
- new_menu.setBackgroundColor(colors.lightGray)
- new_menu.write(" Created ")
- sleep(0.2)
- zpatky()
- else
- new_menu.setCursorPos(1, 3)
- new_menu.setBackgroundColor(colors.lightGray)
- --song("error")
- new_menu.write(" Error! ")
- dialog(BarPoz,BarTxt, "Explorer", " The file"," already exists!",false)
- 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
- bgc(colors.lightGray)
- curs(PosX,y)
- write" Run "
- sleep(0.1)
- if not (cesta[vyber] == nil) and not trash then
- if (typ[vyber] == "file") then
- if smbMode then FromSMB = true SMBrun()
- else RunApp(cesta[vyber], true)
- end
- else plocha ()
- end
- end
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY and button == 2 then
- bgc(colors.lime)
- curs(PosX,y)
- write" Run "
- sleep(0.1)
- if not (cesta[vyber] == nil) then
- if (typ[vyber] == "file") then shell.openTab( cesta[vyber]) plocha() else plocha () end
- end
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+4 and button == 1 then
- if (PosXc > w-16) then
- PosX = w-26
- end
- menu_win.setCursorPos(1,5)
- menu_win.write "·Action >"
- if stin then
- new_menu = window.create(term.current(),PosX+11,y-1,8,4)
- new_menu.setBackgroundColor(colors.lightGray)
- new_menu.clear()
- end
- new_menu = window.create(term.current(),PosX+10,y-2,8,4)
- new_menu.setBackgroundColor(BMenu)
- new_menu.setTextColor(Btextmenu)
- 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"
- PosX = PosX+10
- 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 "
- if fs.exists("/C/system/RAM/cut/") then fs.delete("/C/system/RAM/cut/") end
- FromSMB = false
- if not (cesta[vyber] == nil) then
- if smbMode then FromSMB = true SMBcut() else fs.move("/"..shell.dir().."/"..cesta[vyber], "/C/system/RAM/cut/"..cesta[vyber]) end
- vystrih = cesta[vyber]
- sleep(0.1)
- end
- 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 "
- FromSMB = false
- if fs.exists("/C/system/RAM/cut/") then fs.delete("/C/system/RAM/cut/") end
- if not (cesta[vyber] == nil) then
- if smbMode then FromSMB = true SMBcopy() else fs.copy("/"..shell.dir().."/"..cesta[vyber], "/C/system/RAM/cut/"..cesta[vyber]) end
- vystrih = cesta[vyber]
- sleep(0.1)
- end
- 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 == "" or vystrih == nil) then
- if smbMode then
- SMBpaste()
- else
- overit("/"..shell.dir().."/"..vystrih)
- if (q<=0) then
- fs.move("/C/system/RAM/cut/"..vystrih, "/"..shell.dir().."/"..vystrih)
- else
- fs.move("/C/system/RAM/cut/"..vystrih, "/"..shell.dir().."/"..vystrih.."("..q..")")
- end
- fs.delete("/C/system/RAM/cut/")
- end
- end
- vystrih = ""
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+3 and button == 1 and not (cesta[vyber] == nil) then
- new_menu.setCursorPos(1,4)
- new_menu.write " "
- new_menu.setCursorPos(1,4)
- newName = read()
- pripona(cesta[vyber])
- oldKoncovka = "."..koncovka
- if koncovka == "" then
- fs.move("/"..shell.dir().."/"..cesta[vyber], "/"..shell.dir().."/"..newName)
- else
- pripona(newName)
- if koncovka == "" then
- fs.move("/"..shell.dir().."/"..cesta[vyber], "/"..shell.dir().."/"..newName..oldKoncovka)
- else
- fs.move("/"..shell.dir().."/"..cesta[vyber], "/"..shell.dir().."/"..newName)
- end
- end
- 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
- bgc(colors.lightGray)
- if FileMenu and koncovka == "nfp" then
- menu_win.setCursorPos(1,6)
- menu_win.write "·Set Backg"
- sleep(anim)
- local BarPath = "/C/system/Users/"..user.."/.Registry/bar.nfp"
- if fs.exists(BarPath) then fs.delete(BarPath) end
- if smbMode then
- RunApp("/C/system/api/smbc.lua "..SMBserver.." copy "..SMBPath..cesta[vyber].." "..BarPath)
- else
- RunApp("copy "..cesta[vyber].." "..BarPath)
- end
- else
- menu_win.setCursorPos(1,5)
- menu_win.write " Code "
- menu_win.setCursorPos(1,6)
- menu_win.write " "
- menu_win.setCursorPos(1,6)
- kod = read()
- menu_win.setCursorPos(1,5)
- menu_win.write " Name "
- menu_win.setCursorPos(1,6)
- menu_win.write " "
- menu_win.setCursorPos(1,6)
- newName = read()
- sleep(0.2)
- downloading(kod, tostring(newName))
- end
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+6 and button == 1 then
- menu_win.setCursorPos(1,7)
- if not smbMode then
- menu_win.write ("·Terminal ")
- sleep(anim)
- if not fs.exists("/C/system/api/commander.lua") then
- downloading("LY8cUArW", "/C/system/api/commander.lua")
- end
- RunApp("/C/system/api/commander.lua")
- else
- if (cesta[vyber] == nil and SMBPath == "/") then
- local data = fs.open("/C/system/Users/"..user.."/.Registry/siteMap/"..SMBserver, "w")
- data.writeLine(SMBserver)
- data.writeLine("/")
- menu_win.write ("·Connected ")
- end
- if (typ[vyber] == "folder") then
- local data = fs.open("/C/system/Users/"..user.."/.Registry/siteMap/"..cesta[vyber], "w")
- data.writeLine(SMBserver)
- data.writeLine(SMBPath..cesta[vyber])
- data.close()
- menu_win.write ("·Connected ")
- end
- end
- sleep(anim*2)
- zpatky()
- elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+7 and button == 1 then
- menu_win.setCursorPos(1,8)
- if FileMenu and (koncovka == "lua" or koncovka == "txt") then
- menu_win.write "·Print "
- sleep(0.2)
- x = Xe
- y = Ye
- mrizka()
- if not (cesta[vyber] == nil) then
- if (typ[vyber] == "file") then
- RunApp("/C/system/api/print.api "..shell.dir().."/"..cesta[vyber])
- else
- song("stop")
- end
- end
- elseif shell.dir() == ("C/system/Users/"..user.."/Desktop") then
- menu_win.write ("·Theme ")
- sleep(anim)
- RunApp("/C/system/api/setting.lua appearance")
- else
- menu_win.write ("·Setting ")
- sleep(anim)
- RunApp("/C/system/api/setting.lua system")
- end
- 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)
- if not (cesta[vyber] == nil) then
- if (trash) then
- fs.delete(shell.dir().."/"..cesta[vyber])
- menu_win.write "·Spill out"
- song("trash")
- trash = false
- sleep(0.1)
- plocha()
- else
- if smbMode then
- SMBdelete()
- else
- overit("/C/system/Users/"..user.."/Desktop/_Trash/"..cesta[vyber])
- if (q<=0) then
- fs.move("/"..shell.dir().."/"..cesta[vyber], "/C/system/Users/"..user.."/Desktop/_Trash/"..cesta[vyber])
- else
- fs.move("/"..shell.dir().."/"..cesta[vyber], "/C/system/Users/"..user.."/Desktop/_Trash/"..cesta[vyber].."("..q..")")
- end
- end
- menu_win.write "·Delete "
- sleep(0.1)
- end
- 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)
- x = Xe
- y = Ye
- mrizka()
- if not (cesta[vyber] == nil) then
- if (typ[vyber] == "file") then
- if smbMode then
- SMBopenEdit ()
- else
- RunApp("edit "..cesta[vyber])
- end
- elseif (typ[vyber] == "folder") then
- if smbMode then
- os.startTimer(1)
- pruzkumniksmb("//"..SMBserver..SMBPath..cesta[vyber])
- else
- pruzkumnik(typ[vyber])
- end
- end
- end
- zpatky()
- elseif event == "mouse_click" then
- trash = false
- zpatky()
- end
- end
- end
- end
- function logy(text)
- local data = fs.open("/log.txt", "w")
- data.writeLine(text)
- data.close()
- end
- function SMBnewFile(filename)
- RunApp("/C/system/api/smbc.lua "..SMBserver.." newFile "..SMBPath..filename)
- end
- function SMBnewFolder(foldername)
- RunApp("/C/system/api/smbc.lua "..SMBserver.." newFolder "..SMBPath..foldername)
- end
- function SMBrun ()
- RunApp("/C/system/api/smbc.lua "..SMBserver.." copy "..SMBPath..cesta[vyber].." /C/system/RAM/smbTemp/"..cesta[vyber])
- RunAppSpec("/C/system/RAM/smbTemp/"..cesta[vyber])
- RunApp("/C/system/api/smbc.lua "..SMBserver.." paste /C/system/RAM/smbTemp/"..cesta[vyber].." "..SMBPath..cesta[vyber])
- fs.delete(" /C/system/RAM/smbTemp")
- zpatky()
- end
- function SMBopenEdit ()
- RunApp("/C/system/api/smbc.lua "..SMBserver.." copy "..SMBPath..cesta[vyber].." /C/system/RAM/smbTemp/run.lua")
- RunApp("edit /C/system/RAM/smbTemp/run.lua")
- SMBdelete ()
- RunApp("/C/system/api/smbc.lua "..SMBserver.." paste /C/system/RAM/smbTemp/run.lua "..SMBPath..cesta[vyber])
- fs.delete(" /C/system/RAM/smbTemp/run.lua")
- zpatky()
- end
- function SMBdelete ()
- RunApp("/C/system/api/smbc.lua "..SMBserver.." delete "..SMBPath..cesta[vyber])
- end
- function SMBcopy()
- RunApp("/C/system/api/smbc.lua "..SMBserver.." copy "..SMBPath..cesta[vyber].." /C/system/RAM/cut/"..cesta[vyber])
- end
- function SMBcut()
- RunApp("/C/system/api/smbc.lua "..SMBserver.." cut "..SMBPath..cesta[vyber].." /C/system/RAM/cut/"..cesta[vyber])
- end
- function SMBpaste()
- RunApp("/C/system/api/smbc.lua "..SMBserver.." paste /C/system/RAM/cut/"..vystrih.." "..SMBPath..vystrih)
- end
- function pozadiexp()
- local myWindow = window.create(term.current(),1,1,w,h-1)
- myWindow.setBackgroundColor(colors.white)
- myWindow.clear()
- paintutils.drawLine(1, 1, w, 1, BarPoz)
- bgc(colors.lightBlue)
- txc(colors.black)
- curs (2,1)
- write" UP "
- curs (7,1)
- write" This PC "
- paintutils.drawPixel (w,3, BarPoz)
- curs (w,3)
- write"^"
- paintutils.drawPixel (w,h-4, BarPoz)
- curs (w,h-4)
- write"v"
- txc(BarTxt)
- paintutils.drawPixel (w,1, colors.red)
- curs (w,1)
- write "×"
- curs (19,1)
- bgc(BarPoz)
- txc(BarTxt)
- write (#fs.list(shell.dir()))
- if ((#fs.list(shell.dir())) == 1) then
- write " Item"
- else
- write " Items"
- end
- if vyvoj then
- curs(w, h/2)
- write(cPage)
- end
- end
- function pruzkumniksmb(smbcesta)
- if not (smbMode) then pruzkumnik() end
- if not fs.exists("/C/system/.core/defmodem") then song("stop")
- dialog(BarPoz,BarTxt, "Chyba site", "The modem is not ","configured!",false) smbMode = false plocha()
- elseif not fs.exists("/C/system/RAM/devices/modem.tmp") then song("stop")
- dialog(BarPoz,BarTxt, "Chyba site", "Modem not found!","",false) smbMode = false plocha()
- end
- if not fs.exists("/C/system/api/smbc.lua") then
- if PastebinMode then
- downloading("gQVYieMJ", "/C/system/api/smbc.lua")
- else
- RunApp("wget https://devbin.dev/raw/CAn5MlRD /C/system/api/smbc.lua")
- end
- end
- local q = 3
- local qmax = #smbcesta
- if not (string.sub(smbcesta,qmax,qmax) == "/") then smbcesta = (smbcesta.."/") qmax = #smbcesta end
- repeat
- hledej = string.sub(smbcesta,q,q);
- q = q+1
- if (hledej=="/") then
- SMBserver = string.sub(smbcesta,3,q-2)
- SMBserverT = SMBserver
- if tonumber(SMBserver) == nil then SMBserver = dns_check(SMBserver) end
- if SMBserver == nil then return end
- SMBPath = string.sub(smbcesta,q-1, qmax)
- RunApp("/C/system/api/smbc.lua "..SMBserver.." signature ".. SMBPath)
- q = qmax + 1
- end
- until q == qmax + 1
- zpet = "pruzkumniksmb"
- pozadiexp()
- song("folder")
- vypis()
- paintutils.drawLine(1, h-1, w, h-1, colors.lightGray)
- curs(1, h-1)
- write("//"..SMBserverT..SMBPath)
- lista()
- while true do
- if event == "timer" then os.startTimer(1) cas() end
- agentpruzkumnik()
- end
- end
- local function UPAccess()
- local testString = ""
- if smbMode then testString = ("//"..SMBserver..SMBPath) if testString == ("//"..SMBserver.."/") then pruzkumniksmb("//"..SMBserver) end else testString = "/"..shell.dir() end
- local q = #testString-1
- repeat
- hledej = string.sub(testString,q,q);
- q = q-1
- if (hledej=="/") then
- if smbMode then pruzkumniksmb(string.sub(testString,1,q+1)) else shell.run("cd "..string.sub(testString,1,q+1)) end
- q =0
- end
- until q == 0
- end
- function pruzkumnik(pru)
- zpatecka = shell.dir()
- if (pru == "") then
- pru = zpatecka
- if (pru == "/C/system/Users/"..user.."/Desktop/") then
- shell.run("cd /C/system/Users/"..user.."/Desktop/")
- desktop()
- end
- end
- if pru ~= nil then shell.run("cd "..pru) end
- if (smbMode) then pruzkumniksmb(smbcesta) end
- zpet = "pruzkumnik"
- pozadiexp()
- song("folder")
- vypis()
- paintutils.drawLine(1, h-1, w, h-1, colors.lightGray)
- curs(1, h-1)
- write("/"..shell.dir())
- lista()
- while true do
- if event == "timer" then os.startTimer(1) cas() end
- agentpruzkumnik()
- end
- end
- function agentpruzkumnik()
- kurzor()
- ------------------------------------------------------------------------------------- NEFUNGUJE
- if event == "mouse_scroll" and p1 == -1 then
- if (cPage >= 2) then
- cPage = cPage - 1
- pozadiexp()
- vypis()
- end
- elseif event == "mouse_scroll" and p1 == 1 then
- if (cPage <= maxFil) then
- cPage = cPage + 1
- pozadiexp()
- vypis()
- end
- elseif event == "mouse_click" and x == w and y == 1 and button == 1 then
- trash = false
- shell.run("cd /C/system/Users/"..user.."/Desktop/")
- cPage = 1
- desktop()
- elseif event == "key" and p1 == keys.q then
- trash = false
- shell.run("cd /C/system/Users/"..user.."/Desktop/")
- cPage = 1
- desktop()
- elseif event == "key" and p1 == keys.backspace then
- UPAccess()
- pruzkumnik()
- elseif event == "mouse_click" and x >= 2 and x<=5 and y == 1 and button == 1 then
- UPAccess()
- bgc(colors.lightGray)
- txc(colors.black)
- curs (2,1)
- write" UP "
- zpatecka = shell.dir()
- sleep(anim)
- pruzkumnik()
- elseif event == "mouse_click" and x >= 7 and x<=15 and y == 1 and button == 1 then
- bgc(colors.lightGray)
- txc(colors.black)
- curs (7,1)
- write" This PC "
- sleep(anim)
- thisPC()
- elseif event == "mouse_click" and x == w and y == 3 and button == 1 then
- if (cPage >= 2) then
- cPage = cPage - 1
- pozadiexp()
- vypis()
- end
- elseif event == "mouse_click" and x == w and y == h-4 and button == 1 then
- if (cPage <= maxFil) then
- cPage = cPage + 1
- pozadiexp()
- vypis()
- end
- elseif event == "mouse_click" and y == h-1 and button == 1 then
- paintutils.drawLine(1, h-1, w, h-1, colors.gray)
- txc(colors.white)
- curs(1, h-1)
- nova_cesta = read()
- if (string.sub(nova_cesta,1,2)=="//") then
- smbMode = true
- os.startTimer(1)
- pruzkumniksmb(nova_cesta)
- else
- smbMode = false
- shell.run("cd "..nova_cesta)
- pruzkumnik()
- end
- end
- end
- function diskCheck()
- repeat
- d = d + 1
- until not fs.exists("/disk"..d)
- d = d-1
- if d > 5 then d = 5 end
- for k = 2,d do
- x = diskPos[k][1]
- y = diskPos[k][2]
- curs (x,y)
- if k<10 then
- write(" Disk "..k..":/ ")
- else
- write(" Disk "..k..":/")
- end
- end
- return
- end
- function icona (px,py,bar,tbar, text) bgc(bar) txc(tbar) curs (px,py) write" " curs (px,py+1 ) write" " curs (px,py+2 ) write" " bgc(1) curs (px,py+3) write(text) end
- function openShareFolder(Sfolder)
- if fs.exists("/C/system/Users/"..user.."/.Registry/siteMap/"..Sfolder) then
- local data = fs.open("/C/system/Users/"..user.."/.Registry/siteMap/"..Sfolder, "r")
- SMBserver = data.readLine()
- SMBPath = data.readLine()
- data.close()
- smbMode=true
- pruzkumniksmb("//"..SMBserver..SMBPath)
- end
- end
- function thisPC()
- smbMode = false
- paintutils.drawLine(1, 1, w, 1, BarPoz)
- barW = window.create(term.current(),1,2,10,1)
- barW.setBackgroundColor(colors.gray)
- barW.clear()
- barW.setTextColor(1)
- barW.setCursorPos(2,1)
- barW.write"This PC >"
- paintutils.drawPixel (w,1, colors.red)
- txc(BarTxt)
- curs (w,1)
- write "×"
- local myWindow = window.create(term.current(),1,3,10,h-1) myWindow.setBackgroundColor(BarPoz) myWindow.clear()
- local myWindow = window.create(term.current(),11,2,w,h-1) myWindow.setBackgroundColor(colors.white) myWindow.clear()
- icona (13,3,8192,32768," Data ")
- if ServerMode then icona (23,3,2,32768," Svcs ") icona (33,3,16,32768," SrvF ") end
- txc(1) bgc(BarPoz) curs (1,5)
- write"- Setting"
- curs (1,7)
- write"- Desktop"
- curs (13,10)
- write" Disk C:/ "
- d = 0
- if fs.exists("/disk") then
- d = 1
- curs (26,10)
- write(" Disk 1:/ ")
- diskCheck()
- end
- bgc(1)
- txc(colors.black)
- curs(12,8)
- write("Devices and drivers ("..(1+d)..")")
- if fs.exists("/C/system/Users/"..user.."/.Registry/siteMap/") then
- cSfolder = fs.list("/C/system/Users/"..user.."/.Registry/siteMap/")
- SfolderPos = {
- [1] = {13,15},
- [2] = {21,15},
- [3] = {29,15},
- [4] = {37,15},
- [5] = {45,15},
- }
- if #cSfolder > 0 then
- curs(12,14)
- write("Network folders ("..#cSfolder..")")
- for i=1,5 do
- if cSfolder[i] ~= nil then icona (SfolderPos[i][1],SfolderPos[i][2],2,32768,cSfolder[i]) end
- end
- end
- end
- lista()
- while true do
- event, p1, p2,p3 = os.pullEvent()
- button = p1 x = p2 y = p3
- if event == "timer" then os.startTimer(1) cas() end
- if x == w and y == 1 and button == 1 then plocha ()
- elseif event == "key" and p1 == keys.q then plocha()
- elseif event == "mouse_click" and button == 1 then
- os.startTimer(1)
- if x >= 13 and x <= 18 and y >= 3 and y <= 5 then
- pruzkumnik("/C/system/Users/"..user)
- elseif x >= 23 and x <= 28 and y >= 3 and y <= 5 and ServerMode then
- pruzkumnik("/C/Service/")
- elseif x >= 33 and x <= 38 and y >= 3 and y <= 5 and ServerMode then
- pruzkumnik("/C/system/server")
- elseif x >= 1 and x <= 12 and y == h then
- menu ()
- elseif x >= 1 and x <= 10 and y == 5 then
- cbarva()
- curs (1,5)
- write"- Setting"
- sleep(0.1)
- RunApp("/C/setting")
- elseif x >= 1 and x <= 10 and y == 7 then
- cbarva()
- curs (1,7)
- write"- Desktop"
- sleep(0.1)
- plocha()
- elseif x >= 13 and x <= 23 and y == 10 then
- cbarva()
- curs (13,10)
- write" Disk C:/ "
- sleep(0.1)
- RunApp("cd /C")
- pruzkumnik()
- elseif x >= 10 and x <= w and y >= h/2 and y <= h-1 then
- if x >= 26 and x <= 36 and y == 10 then
- k = 1
- elseif x >= 39 and x <= 49 and y == 10 then
- k = 2
- elseif x >= 13 and x <= 23 and y == 12 then
- k = 3
- elseif x >= 26 and x <= 36 and y == 12 then
- k = 4
- elseif x >= 39 and x <= 49 and y == 12 then
- k = 5
- else
- thisPC()
- end
- elseif x >= 13 and x <= 18 and y >= 15 and y <= 17 then
- openShareFolder(cSfolder[1])
- os.reboot()
- elseif x >= 21 and x <= 26 and y >= 15 and y <= 17 then
- openShareFolder(cSfolder[2])
- elseif x >= 29 and x <= 35 and y >= 15 and y <= 17 then
- openShareFolder(cSfolder[3])
- elseif x >= 37 and x <= 43 and y >= 15 and y <= 17 then
- openShareFolder(cSfolder[4])
- elseif x >= 45 and x <= 50 and y >= 15 and y <= 17 then
- openShareFolder(cSfolder[5])
- end
- function seldisk()
- cbarva()
- x = diskPos[k][1]
- y = diskPos[k][2]
- curs (x,y)
- if k<10 then
- write(" Disk "..k..":/ ")
- else
- write(" Disk "..k..":/")
- end
- sleep(0.1)
- end
- if k==1 then
- if fs.exists("/disk") then
- seldisk()
- shell.run("cd /disk")
- pruzkumnik()
- end
- else
- if fs.exists("/disk"..k) then
- seldisk()
- shell.run("cd /disk"..k)
- pruzkumnik()
- end
- end
- else
- thisPC()
- end
- end
- end
- function whimage(Iuser)
- bgc(colors.lightBlue)
- term.clear()
- local data = fs.open("/C/system/Users/"..Iuser.."/.Registry/bar.nfp", "r")
- local i = 0
- local mw = 0
- local mh = {}
- repeat
- i = i+1
- mh[i] = data.readLine()
- until mh[i] == nil
- data.close()
- for i=1, #mh do if #mh[i] > mw then mw = #mh[i] end end
- local image = paintutils.loadImage("/C/system/Users/"..Iuser.."/.Registry/bar.nfp")
- w, h = term.getSize()
- paintutils.drawImage(image, w/2-mw/2+1, h/2-#mh/2+1)
- end
- function plocha()
- checkBarva()
- smbMode = false
- lista()
- zpet = "plocha"
- w, h = term.getSize()
- nPage = 1
- if fs.exists ("/C/system/Users/"..user.."/.Registry/.menuColor") then BMenu = (BarPoz) Btextmenu = (BarTxt) CCM = true else CCM = false BMenu = (colors.gray) Btextmenu = (colors.white) end
- if fs.exists ("/C/system/Users/"..user.."/.Registry/bar.nfp") then
- whimage(user)
- else
- if (h == 19) and (w == 51) then
- computerMode = 1
- bgc(colors.black)
- term.clear ()
- elseif ServerMode then
- computerMode = 1
- bgc(colors.cyan)
- term.clear ()
- elseif (h == 20) and (w == 26) then
- computerMode = 2
- bgc(colors.lightBlue)
- term.clear ()
- paintutils.drawImage(image, (w/2)-25, (h/2)-9)
- else
- computerMode = 0
- bgc(colors.lightBlue)
- term.clear ()
- end
- if fs.exists("/C/system/.core/display") then ExDisplay = true else ExDisplay = false end
- if ServerMode then
- local myWindow = window.create(term.current(),1,1,w,h)
- myWindow.setBackgroundColor(colors.cyan)
- myWindow.clear()
- myWindow.setTextColor(colors.white)
- myWindow.setCursorPos(w-19,h-1)
- myWindow.setBackgroundColor(colors.cyan)
- myWindow.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
- local colorPath = ("/C/system/Users/"..user.."/.Registry/.BackgroundColor")
- if fs.exists(colorPath) then
- local data =fs.open(colorPath, "r")
- myWindow.setBackgroundColor(tonumber(data.readAll()))
- data.close()
- else
- myWindow.setBackgroundColor(colors.black)
- end
- 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("/C/system/Users/"..user.."/Desktop/.folder") then
- local create_folder = fs.open("/C/system/Users/"..user.."/Desktop/.folder","w")
- create_folder.close()
- fs.delete("/C/system/Users/"..user.."/Desktop/.folder")
- end
- shell.run("cd /C/system/Users/"..user.."/Desktop/")
- if not fs.exists("/C/system/Users/"..user.."/Desktop/_Trash") then
- fs.makeDir("/C/system/Users/"..user.."/Desktop/_Trash")
- end
- vypis()
- while true do
- x,y = term.getSize()
- os.startTimer(1)
- if event == "mouse_click" then
- mrizka()
- end
- if ServerMode and fs.exists("/C/system/RAM/shutdown.pdr") then
- vypnout()
- end
- oldW = w
- oldH = h
- w, h = term.getSize()
- if oldW ~= w or oldH ~= h then
- plocha()
- end
- panel()
- end
- end
- function defaultMenu()
- local data = fs.open ("/C/system/Users/"..user.."/.Registry/lsprogram", "w")
- if ServerMode then
- data.writeLine("Server Manager")
- data.writeLine("/C/Programs/PepekSoft/smanager.lua")
- else
- data.writeLine("")
- data.writeLine("")
- end
- for i=1, 8 do
- data.writeLine("")
- end
- data.writeLine("Setting")
- data.writeLine("/C/system/api/setting.lua")
- data.close ()
- end
- local mName = {}
- local mPath = {}
- function changeMenu()
- local data = fs.open ("/C/system/Users/"..user.."/.Registry/lsprogram", "w")
- for i=1, 6 do
- data.writeLine(mName[i])
- data.writeLine(mPath[i])
- end
- data.close()
- end
- function downProg(name, path)
- if (name == "Server Manager") then
- downloading("z02yAN3M", path)
- elseif (name == "Setting") then
- downloading("vxJjQzem", path)
- elseif (name == "Program Manager") then
- downloading("5eSpGpGa", path)
- elseif (name == "Help") then
- downloading("LcUc1VTZ", path)
- end
- end
- function checkBarva()
- if fs.exists ("/C/system/Users/"..user.."/.Registry/.menuColor") then BPozadi = (BarPoz) Btext = (BarTxt) CCM = true else CCM = false BPozadi = (colors.gray) Btext = (colors.white) end
- end
- function menu()
- if fs.exists("/C/system/Users/"..user.."/.Registry/.disableAnim") then Anim = false end
- local function cmdAccess(pr)
- prikaz = pr
- nabidka.setBackgroundColor(colors.lightGray)
- nabidka.setTextColor(colors.white)
- shell.run("cd /C/")
- nabidka.setCursorPos(1,12)
- nabidka.write " "
- nabidka.setCursorPos(1,12)
- bgc(colors.lightGray)
- if prikaz == nil then prikaz = read() else write(lastprikaz) end
- lastprikaz = prikaz
- if prikaz == "version" then nabidka.setCursorPos(1,12) nabidka.setBackgroundColor(colors.lightGray) nabidka.setTextColor(colors.white) lastprikaz = (verze) menu()
- elseif prikaz == "explorer" then thisPC()
- elseif string.sub(prikaz,1,2) == "//" then smbMode = true os.startTimer(1) pruzkumniksmb(prikaz)
- elseif string.sub(prikaz,1,1) == "/" then shell.run("cd "..prikaz) pruzkumnik()
- elseif prikaz == "logout" then logout()
- else
- local data = fs.open("/C/system/RAM/back.tmp", "w")
- data.writeLine(zpatecka)
- data.close()
- spustitprikaz()
- end
- zpatky()
- end
- w, h = term.getSize()
- mNameNew =""
- mPathNew =""
- if not fs.exists ("/C/system/Users/"..user.."/.Registry/lsprogram") then defaultMenu() end
- customMenu = false
- checkBarva()
- if Anim then for i=1, 12 do paintutils.drawLine(1, h-i, 17, h-i, BPozadi) sleep(0.05) end end
- nabidka = window.create(term.current(),1,h-12,17,h)
- nabidka.setBackgroundColor(BPozadi)
- nabidka.clear()
- nabidka.setTextColor(Btext)
- nabidka.setCursorPos(17,12)
- nabidka.write ">"
- nabidka.setCursorPos(math.ceil((17-#user)/2),1)
- nabidka.write(user)
- nabidka.setCursorPos(2,13)
- nabidka.write "Power"
- if fs.exists ("/C/system/Users/"..user.."/.Registry/lsprogram") then
- local data = fs.open ("/C/system/Users/"..user.."/.Registry/lsprogram", "r")
- for i=1, 6 do
- mName[i] = data.readLine()
- mPath[i] = data.readLine()
- nabidka.setCursorPos(1,i+4)
- if fs.exists(mPath[i]) then
- nabidka.setTextColor(Btext)
- else
- nabidka.setTextColor(colors.red)
- end
- nabidka.write(mName[i])
- end
- data.close()
- else
- for i=1, 7 do
- mName[i] = ""
- mPath[i] = ""
- end
- end
- if not CCM then nabidka.setTextColor(colors.lightGray) else nabidka.setTextColor(Btext) end
- nabidka.setCursorPos(1,2)
- nabidka.write "-> This PC"
- nabidka.setCursorPos(1,11)
- nabidka.write "-> Managment"
- nabidka.setCursorPos(1,3)
- --nabidka.write "Apps >"
- nabidka.setCursorPos(1,12)
- nabidka.setBackgroundColor(colors.white)
- txc(colors.lightGray)
- nabidka.write " "
- nabidka.setCursorPos(1,12)
- nabidka.setBackgroundColor(colors.white)
- nabidka.setTextColor(colors.lightGray)
- nabidka.write (lastprikaz)
- nabidka.setBackgroundColor(colors.gray)
- while true do
- event, p1, p2,p3 = os.pullEvent()
- button = p1
- x = p2
- y = p3
- if event == "timer" then os.startTimer(1) cas() end
- if event == "mouse_click" and x >= 1 and x <= 17 and y >= h-8 and y <= h-3 then
- if x>8 then PosX = 8 else PosX = x end
- PosY = y
- y=(y-h)+9
- if (button == 1) and (#mName[y]>=1) then
- nabidka.setBackgroundColor(colors.lightGray)
- nabidka.setCursorPos(1,y+4)
- nabidka.write(" ")
- nabidka.setCursorPos(1,y+4)
- nabidka.setTextColor(colors.gray)
- nabidka.write(mName[y])
- sleep(anim)
- if not fs.exists(mPath[y]) then downProg(mName[y], mPath[y]) end
- RunApp(mPath[y])
- plocha()
- elseif (button == 2) then
- local nab_win = window.create(term.current(),PosX,PosY-1,10,3)
- nab_win.setBackgroundColor(colors.lightGray)
- nab_win.clear()
- nab_win.setCursorPos(2,1)
- nab_win.write"Rename"
- nab_win.setCursorPos(1,2)
- nab_win.write"Add/Change"
- nab_win.setCursorPos(2,3)
- nab_win.write"Delete"
- nab_win.setBackgroundColor(colors.lightBlue)
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if x >= PosX and x <= PosX+10 and y == PosY-1 and button == 1 then
- nab_win.setCursorPos(1,1)
- nab_win.write" Rename "
- sleep(anim)
- nab_win.setBackgroundColor(colors.lightGray)
- nab_win.setCursorPos(1,1)
- nab_win.write" New name "
- bgc(colors.lightBlue)
- txc(colors.black)
- curs(1,y+1)
- term.write " "
- curs(1,y+1)
- mNameNew = read()
- y=(y-h)+10
- if (#mNameNew >=1) then
- mName[y] = mNameNew
- changeMenu()
- end
- menu()
- elseif x >= PosX and x <= PosX+10 and y == PosY and button == 1 then
- nab_win.setCursorPos(1,2)
- nab_win.write"Add/Change"
- y=(y-h)+9
- if (#mName[y] <1) then
- nab_win.setBackgroundColor(colors.lightGray)
- nab_win.setCursorPos(1,1)
- nab_win.write" New Name "
- bgc(colors.lightBlue)
- txc(colors.black)
- curs(1,PosY)
- term.write " "
- curs(1,PosY)
- mNameNew = read()
- end
- nab_win.setBackgroundColor(colors.lightGray)
- nab_win.setCursorPos(1,1)
- nab_win.write" New Path "
- bgc(colors.lightBlue)
- txc(colors.black)
- curs(1,PosY)
- term.write "/ "
- curs(2,PosY)
- mPathNew = "/"..read()
- if (#mPathNew > 1) then
- mPath[y] = mPathNew
- changeMenu()
- end
- if (#mNameNew > 1) then
- mName[y] = mNameNew
- changeMenu()
- end
- sleep(anim)
- menu()
- elseif x >= PosX and x <= PosX+10 and y == PosY+1 and button == 1 then
- nab_win.setCursorPos(1,3)
- nab_win.write" Delete "
- sleep(anim)
- y=(y-h)+9
- mPath[y] = ""
- mName[y] = ""
- changeMenu()
- menu()
- else
- menu()
- end
- end
- end
- menu()
- elseif event == "mouse_click" and x >= 1 and x <= 6 and y == h and button == 1 then -- vypnout
- nabidka.setTextColor(colors.lightGray)
- nabidka.setCursorPos(2,13)
- nabidka.write "Power"
- sleep(anim)
- power()
- elseif event == "mouse_click" and x >= 1 and x <= 17 and y == h-2 and button == 1 then
- cbarva()
- curs(1,h-2)
- write "-> Managment "
- sleep(anim)
- RunApp("/C/setting")
- zpatky()
- elseif event == "mouse_click" and x >= 1 and x <= 17 and y == h-11 and button == 1 then
- cbarva()
- curs(1,h-11)
- write "-> This PC "
- sleep(0.1)
- thisPC()
- --elseif event == "mouse_click" and x >= 1 and x <= 17 and y == h-10 and button == 1 then
- -- cbarva()
- -- curs(1,h-10)
- --write "Apps >"
- --sleep(0.1)
- --aplikace()
- --APIS.Aplikace()
- --plocha()
- elseif event == "mouse_click" and x >= 1 and x <= 17 and y == h-11 and button == 2 then
- cbarva()
- curs(1,h-11)
- write "-> This PC "
- sleep(0.1)
- local tp = fs.open("/C/system/Users/"..user.."/Desktop/This PC.src", "w")
- tp.close()
- plocha()
- elseif event == "mouse_click" and x >= 1 and x <= 16 and y == h-1 and button == 1 then cmdAccess()
- elseif event == "mouse_click" and x == 17 and y == h-1 and button == 1 then cmdAccess(lastprikaz)
- elseif event == "key" then cmdAccess()
- elseif event == "mouse_click" then zpatky()
- end
- end
- end
- function aplikace()
- checkBarva()
- local aDir = {}
- local apDir = {}
- local ap = 0
- if fs.exists("/C/Programs/") then
- aDir = fs.list("/C/Programs/")
- for i=1,#aDir do
- if not fs.isDir("/C/Programs/"..aDir[i]) then
- if string.sub(aDir[i],1) ~= "." then
- local cislo = string.find(aDir[i],".",-5)
- ap= ap+1
- apDir[ap] = (string.sub(aDir[i],1,cislo) )
- end
- end
- end
- else return
- end
- local AppW = window.create(term.current(),18,(h-10)-((#apDir+1)/2),14,#apDir+3)
- AppW.setBackgroundColor(BPozadi)
- AppW.setTextColor(Btext)
- AppW.clear()
- AppW.setCursorPos(2,1)
- AppW.write("Applications")
- for i=1, #apDir do
- AppW.setCursorPos(2,i+2)
- AppW.write(apDir[i])
- end
- AppW.setCursorPos(2,#apDir+3)
- AppW.write("Store")
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if event == "mouse_click" and button == 1 then
- plocha()
- end
- end
- end
- function power()
- txc(colors.white)
- local myWindow = window.create(term.current(),2,h-1,8,h)
- myWindow.setBackgroundColor(colors.lightGray)
- myWindow.clear()
- bgc(colors.lightGray)
- curs(2,h-6)
- write " "
- curs(2,h-5)
- write " Switch "
- curs(2,h-4)
- write " Log Out "
- curs(2,h-3)
- write " "
- curs(2,h-2)
- write " Sleep "
- curs(2,h-1)
- write " Restart "
- curs(2,h)
- write " Shutdown "
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- 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
- if ADC then
- synchronizace()
- end
- local data = fs.open ("/C/system/RAM/logout", "w")
- song("logout")
- data.close ()
- error()
- elseif (x >= 1 and x <= 10 and y == h-4) and (button == 1 or button == 2)then
- fs.delete ("/C/system/RAM"..user)
- logout()
- else
- menu()
- end
- end
- desktop()
- end
- function spanek ()
- bgc(colors.lightGray)
- term.clear()
- sleep (0.1)
- bgc(colors.gray)
- term.clear()
- sleep (0.1)
- bgc(colors.black)
- txc(colors.black)
- term.clear()
- while true do
- local event, button, xPos, yPos = os.pullEvent()
- desktop ()
- end
- end
- function logout ()
- bgc(colors.lightGray)
- term.clear()
- sleep (0.1)
- bgc(colors.gray)
- term.clear()
- sleep (0.1)
- bgc(colors.white)
- txc(colors.black)
- term.clear()
- curs(w-28, h-12)
- prc "Logging out..."
- bgc(colors.white)
- txc(colors.blue)
- curs(w/2-5,h-1)
- write " Pepek"
- curs(w/2+3,h-1)
- write "Soft "
- curs(w/2+2,h-1)
- txc(colors.lime)
- write "@"
- song("shutdown")
- sleep (0.5)
- local data = fs.open ("/C/system/RAM/logout", "w")
- data.close ()
- error()
- end
- function vypnout()
- RunApp("/startup.lua shutdown")
- end
- function restart()
- RunApp("/startup.lua reboot")
- end
- desktop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement