Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local login = 0
- local userI = ""
- local passI = ""
- local userO = ""
- local passO = ""
- local data = ""
- local user = 0
- local pass = ""
- local sDrive = nil
- local tArgs = { ... }
- local nastaveni={barva=colors.blue}
- local f=fs.open("system/.core/colors","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- local f=fs.open("system/.core/textcol","r")
- local tnt=f.readAll()
- f.close()
- local text=textutils.unserialize(tnt)
- fs.delete ("/system/.core/Build")
- local na=fs.open("/system/.core/Build","w")
- na.writeLine ("Verua Basic")
- na.writeLine ("1540")
- na.close ()
- data = fs.open ("/system/.core/Build", "r")
- verze = data.readLine ()
- build = data.readLine ()
- data.close ()
- if not fs.exists ("/system/.core/lsprogram") then
- local data = fs.open ("/system/.core/lsprogram", "w")
- data.writeLine("Firewolf")
- data.writeLine("/system/api/internet")
- data.writeLine("FileX")
- data.writeLine("/system/programs/FileX")
- data.writeLine("")
- data.writeLine()
- data.writeLine("")
- data.writeLine()
- data.writeLine("")
- data.writeLine()
- data.writeLine("")
- data.writeLine()
- data.writeLine("Setting")
- data.writeLine("/system/programs/setting")
- data.close ()
- end
- if fs.exists ("/system/.core/defuser") then
- local na=fs.open("/system/.core/defuser","r")
- user = na.readLine ()
- userI = user
- na.close()
- data = fs.open("/system/.ucet/"..userI.."/.data","r")
- user = data.readLine ()
- passI = data.readLine ()
- data.close()
- end
- if fs.exists ("/system/RAM/user") then
- data = fs.open ("/system/RAM/user", "r")
- user = data.readLine ()
- pass = data.readLine ()
- userI = user
- data.close ()
- end
- if not fs.exists ("/system/RAM/"..user) then
- data = fs. open ("/system/RAM/"..user, "w")
- data.close ()
- end
- local function prc(text, y)
- local w = term.getSize()
- local _, cy = term.getCursorPos()
- term.setCursorPos(math.ceil((w-#text)/2), y or cy)
- write(text)
- end
- function clear()
- term.clear()
- term.setBackgroundColor(colors.white)
- for i=1,w do
- for j=1,h do
- term.setCursorPos(i,j)
- write(" ")
- end
- end
- end
- function plocha ()
- data = fs.open ("/system/RAM/user", "r")
- user = data.readLine ()
- pass = data.readLine ()
- userI = user
- data.close ()
- local nastaveni={barva=colors.blue}
- local f=fs.open("system/.core/colors","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- local f=fs.open("system/.core/textcol","r")
- local tnt=f.readAll()
- f.close()
- local text=textutils.unserialize(tnt)
- if fs.exists ("/system/.ucet/"..user.."/bar.nfp") then
- local image = paintutils.loadImage("/system/.ucet/"..user.."/bar.nfp")
- term.setTextColor(text.barva)
- term.clear ()
- paintutils.drawImage(image, 2, 2)
- else
- local myWindow = window.create(term.current(),1,1,51,19)
- myWindow.setBackgroundColor(colors.cyan)
- myWindow.clear()
- end
- paintutils.drawLine(1, 1, 51, 1, nastaveni.barva)
- paintutils.drawLine(51, 1, 51, 19, nastaveni.barva)
- paintutils.drawLine(1, 1, 1, 19, nastaveni.barva)
- prc (verze.." "..build, 1)
- term.setCursorPos(1,2)
- term.setBackgroundColor(colors.lime)
- term.setTextColor(colors.white)
- print"M"
- print"e"
- print"n"
- print"u"
- print">"
- term.setBackgroundColor(colors.red)
- term.setCursorPos(1,18)
- print ">"
- term.setTextColor(text.barva)
- term.setBackgroundColor(nastaveni.barva)
- if #tArgs > 0 then
- sDrive = tostring( tArgs[1] )
- end
- local smodem = peripheral.find("modem")
- if not smodem then
- paintutils.drawPixel (51,1, colors.red)
- term.setBackgroundColor(nastaveni.barva)
- term.setCursorPos (42,1)
- print "No modem"
- else
- paintutils.drawPixel (51,1, colors.lime)
- term.setBackgroundColor(nastaveni.barva)
- term.setCursorPos (41,1)
- print "Connected"
- end
- if sDrive == nil then
- term.setCursorPos(2,1)
- term.setTextColor(text.barva)
- print( "ID "..os.getComputerID() )
- local label = os.getComputerLabel()
- if label then
- term.setCursorPos(2,2)
- term.setTextColor(text.barva)
- print( "Label \""..label.."\"" )
- end
- else
- local bData = disk.hasData( sDrive )
- if not bData then
- print( "No disk in drive "..sDrive )
- return
- end
- print( "The disk is #"..disk.getID( sDrive ) )
- local label = disk.getLabel( sDrive )
- if label then
- print( "The disk is labelled \""..label.."\"" )
- end
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x == 1 and y >= 2 and y <= 7 and button == 1 then
- menu ()
- elseif x == 1 and y == 18 and button == 1 then
- hotrezimy ()
- end
- end
- end
- function menu ()
- if fs.exists ("/system/.core/lsprogram") then
- local data = fs.open ("/system/.core/lsprogram", "r")
- menu1 = data.readLine ()
- path1 = data.readLine ()
- menu2 = data.readLine ()
- path2 = data.readLine ()
- menu3 = data.readLine ()
- path3 = data.readLine ()
- menu4 = data.readLine ()
- path4 = data.readLine ()
- menu5 = data.readLine ()
- path5 = data.readLine ()
- menu6 = data.readLine ()
- path6 = data.readLine ()
- menu7 = data.readLine ()
- path7 = data.readLine ()
- end
- local myWindow = window.create(term.current(),3,7,13,9)
- myWindow.setBackgroundColor(colors.gray)
- myWindow.clear()
- local myWindow = window.create(term.current(),2,6,13,9)
- myWindow.setBackgroundColor(colors.lime)
- myWindow.clear()
- local myWindow = window.create(term.current(),2,7,12,7)
- myWindow.setBackgroundColor(colors.white)
- myWindow.clear()
- term.setCursorPos(2,6)
- term.setBackgroundColor(colors.lime)
- print " Programs "
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(2,7)
- print (menu1)
- term.setCursorPos(2,8)
- print (menu2)
- term.setCursorPos(2,9)
- print (menu3)
- term.setCursorPos(2,10)
- print (menu4)
- term.setCursorPos(2,11)
- print (menu5)
- term.setCursorPos(2,12)
- print (menu6)
- term.setCursorPos(2,13)
- print (menu7)
- o=fs.open ("/system/RAM/setting", "w")
- o.writeLine (userI)
- o.writeLine (passI)
- o.close ()
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x == 2 and y >= 2 and y <= 7 and button == 1 then
- plocha ()
- elseif x >= 2 and x <= 12 and y == 7 and button == 1 then
- path = path1
- elseif x >= 2 and x <= 12 and y == 8 and button == 1 then
- path = path2
- elseif x >= 2 and x <= 12 and y == 9 and button == 1 then
- path = path3
- elseif x >= 2 and x <= 12 and y == 10 and button == 1 then
- path = path4
- elseif x >= 2 and x <= 12 and y == 11 and button == 1 then
- path = path5
- elseif x >= 2 and x <= 12 and y == 12 and button == 1 then
- path = path6
- elseif x >= 2 and x <= 12 and y == 13 and button == 1 then
- path = path7
- else
- plocha ()
- end
- spustit ()
- end
- end
- function spustit ()
- term.setBackgroundColor(colors.white)
- local image = paintutils.loadImage("/system/.core/logo.nft")
- term.setBackgroundColor(colors.white)
- term.setTextColor (colors.black)
- term.clear ()
- paintutils.drawImage(image, 12, 4)
- term.setBackgroundColor(colors.white)
- prc ("Loading program ...", 15)
- sleep (0.5)
- shell.run (path)
- end
- function hotrezimy ()
- local myWindow = window.create(term.current(),2,13,12,9)
- myWindow.setBackgroundColor(colors.gray)
- myWindow.clear()
- local myWindow = window.create(term.current(),2,12,11,19)
- myWindow.setBackgroundColor(colors.lime)
- myWindow.clear()
- local myWindow = window.create(term.current(),2,13,10,6)
- myWindow.setBackgroundColor(colors.white)
- myWindow.clear()
- term.setCursorPos(2,12)
- term.setBackgroundColor(colors.lime)
- print " Modes"
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(2,13)
- print (user)
- term.setCursorPos(2,14)
- print "Commander"
- paintutils.drawLine(2, 15, 11, 15, colors.lightGray)
- term.setCursorPos(2,15)
- print "Sleep"
- paintutils.drawLine(2, 16, 11, 16, colors.lightBlue)
- term.setCursorPos(2,16)
- print "Log Off"
- paintutils.drawLine(2, 17, 11, 17, colors.yellow)
- term.setCursorPos(2,17)
- print "Restart"
- paintutils.drawLine(2, 18, 11, 18, colors.red)
- term.setCursorPos(2,18)
- print "Shut down"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if x == 1 and y == 18 and button == 1 then
- plocha ()
- elseif x >= 2 and x <= 11 and y == 14 and button == 1 then
- term.setBackgroundColor(colors.black)
- term.clear ()
- term.setCursorPos(1,1)
- shell.run ("/system/api/commander")
- elseif x >= 2 and x <= 11 and y == 15 and button == 1 then
- spanek ()
- elseif x >= 2 and x <= 11 and y == 16 and button == 1 then
- odhlasit ()
- elseif x >= 2 and x <= 11 and y == 17 and button == 1 then
- restart ()
- elseif x >= 2 and x <= 11 and y == 18 and button == 1 then
- vypnout ()
- else
- plocha ()
- end
- end
- 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")
- plocha ()
- end
- end
- function vypnout ()
- fs.delete ("system/RAM")
- 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(23, 7)
- prc "Shutting down..."
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- sleep (2)
- os.shutdown ()
- end
- function odhlasit ()
- fs.delete ("/system/RAM/user")
- 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(23, 7)
- prc "Loging off..."
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- sleep (2)
- heslo ()
- end
- function restart ()
- fs.delete ("system/RAM")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(23, 7)
- prc "Restarting..."
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- sleep (1)
- os.reboot ()
- end
- plocha ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement