Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --last update 09.12.2016
- --SETTINGS--
- --Password for Guest = 0000
- -- MONITOR was CHANGED in monitor.cfg in line 1
- --optimal monitor size 5*4
- -- CawOS install this programs automatically:
- -- OS_API by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- -- Mail Client by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- -- NetChat by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- -- Download Manager by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- -- Programs in Download Manager:
- -- NpaintPro by NITROGENFINGERS http://pastebin.com/pzWSRqNF user: http://pastebin.com/u/nitrogenfingers
- -- Nitrosoft Games by NITROGENFINGERS http://pastebin.com/KZsuv1pc user: http://pastebin.com/u/nitrogenfingers
- -- File_manager by A GUEST ON FEB 26TH, 2013 http://pastebin.com/CTrCeDBt
- -- Big Reactor Control by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- -- Big Reactor Status by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- -- Bundled Cable Remote (for cable server) by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- -- LanteaCraft Gate Control (alpha) by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- -- Train Control (alpha) by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- -- Command Remote (alpha) by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- -- Radio Prog (openFM) by cyber_Ahn http://pastebin.com/u/cyber_Ahn
- --monitor file chek---
- local monitor_number = "monitor_1"
- local PeripheralsPlusPlus = false
- local found = fs.exists("config/monitor.cfg")
- if found == false then
- print("Input Monitor Number:")
- input = read()
- local file = fs.open("config/monitor.cfg","w")
- file.writeLine(input)
- file.writeLine("peripheralspluplus_off")
- file.writeLine("space")
- file.writeLine("clear")
- file.close()
- end
- --monitor set--
- file = fs.open("config/monitor.cfg","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- monitor_number = fileData[1]
- PeripheralsPlusPlus = fileData[2]
- wpName = fileData[4]
- if(PeripheralsPlusPlus == "peripheralspluplus_on") then
- PeripheralsPlusPlus = true
- end
- local mon = peripheral.wrap(monitor_number)
- local programs = {}
- local user = "guest"
- local start_a = 0
- --load installed programs--
- function getPrograms()
- fDir = shell.programs()
- programs = {}
- for i=1,#fDir do
- if(fDir[i] ~= "worm") and (fDir[i] ~= "type") and (fDir[i] ~= "time") and (fDir[i] ~= "startup") and (fDir[i] ~= "shutdown") and (fDir[i] ~= "shell") and (fDir[i] ~= "rename") and (fDir[i] ~= "redset") and (fDir[i] ~= "redpulse") and (fDir[i] ~= "redprobe") and (fDir[i] ~= "reboot") and (fDir[i] ~= "programs") and (fDir[i] ~= "pastebin") and (fDir[i] ~= "paint") and (fDir[i] ~= "move") and (fDir[i] ~= "monitor") and (fDir[i] ~= "mkdir") and (fDir[i] ~= "lua") and (fDir[i] ~= "list") and (fDir[i] ~= "label") and (fDir[i] ~= "id") and (fDir[i] ~= "help") and (fDir[i] ~= "hello") and (fDir[i] ~= "gps") and (fDir[i] ~= "exit") and (fDir[i] ~= "eject") and (fDir[i] ~= "edit") and (fDir[i] ~= "drive") and (fDir[i] ~= "dj") and (fDir[i] ~= "copy") and (fDir[i] ~= "clear") and (fDir[i] ~= "caAPI") and (fDir[i] ~= "apis") and (fDir[i] ~= "delete") and (fDir[i] ~= "cd") and (fDir[i] ~= "alias") and (fDir[i] ~= "adventure") and (fDir[i] ~= "Caw_OS") and (fDir[i] ~= "bg") and (fDir[i] ~= "fg") and (fDir[i] ~= "chat") and (fDir[i] ~= "multishell") and (fDir[i] ~= "redstone") and (fDir[i] ~= "repeat") and (fDir[i] ~= "sensor_plugin")then
- table.insert(programs, fDir[i])
- end
- end
- end
- --start program--
- function startP(namP)
- if (PeripheralsPlusPlus == true) then
- text = "Start program "..namP
- caAPI.chat(text)
- caAPI.sound(5,1)
- end
- shell.run("monitor",monitor_number,namP)
- end
- --menu--
- function menu(posx,posy)
- mon.setBackgroundColor(128)
- mon.setCursorPos(posx,posy)
- mon.write(" X")
- mon.setCursorPos(posx,(posy+1))
- mon.write(" Reboot ")
- mon.setCursorPos(posx,(posy+2))
- mon.write(" Shutdown ")
- mon.setCursorPos(posx,(posy+3))
- mon.write(" Logout ")
- mon.setCursorPos(posx,(posy+4))
- mon.write(" Uninstall")
- mon.setCursorPos(posx,(posy+5))
- mon.write(" Hardware ")
- mon.setCursorPos(posx,(posy+6))
- mon.write(" Wallpaper")
- mon.setCursorPos(posx,(posy+7))
- mon.write(" User ")
- mon.setCursorPos(posx,(posy+8))
- mon.write(" Autostart")
- mon.setCursorPos(posx,(posy+9))
- mon.write(" Del Autos")
- mon.setBackgroundColor(8)
- ix = false
- while ix == false do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x > posx and x < (posx+10) and y == posy then
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+1) then
- if (PeripheralsPlusPlus == true) then
- text = "Reboot PC"
- caAPI.chat(text)
- end
- if (PeripheralsPlusPlus == true) then
- caAPI.lamp(8)
- caAPI.sound(5,1)
- sleep(1)
- caAPI.lamp(32)
- caAPI.sound(6,1)
- sleep(1)
- caAPI.lamp(8)
- caAPI.sound(5,1)
- sleep(1)
- caAPI.lamp(1)
- caAPI.sound(6,1)
- end
- shell.run("clear")
- shell.run("reboot")
- end
- if x > posx and x < (posx+10) and y == (posy+2) then
- shell.run("clear")
- mon.setBackgroundColor(colors.black)
- shell.run("clear")
- mon.setBackgroundColor(colors.black)
- shell.run("clear")
- if (PeripheralsPlusPlus == true) then
- text = "Shutdown PC"
- caAPI.chat(text)
- end
- if (PeripheralsPlusPlus == true) then
- caAPI.lamp(8)
- caAPI.sound(5,1)
- sleep(1)
- caAPI.lamp(32)
- caAPI.sound(6,1)
- sleep(1)
- caAPI.lamp(8)
- caAPI.sound(5,1)
- sleep(1)
- caAPI.lamp(1)
- caAPI.sound(6,1)
- end
- shell.run("clear")
- shell.run("shutdown")
- end
- if x > posx and x < (posx+10) and y == (posy+4) then
- mon.setBackgroundColor(colors.black)
- mon.clear()
- if (PeripheralsPlusPlus == true) then
- text = "Unistall"
- caAPI.chat(text)
- end
- shell.run("rm","*")
- shell.run("shutdown")
- end
- if x > posx and x < (posx+10) and y == (posy+3) then
- login()
- end
- if x > posx and x < (posx+10) and y == (posy+5) then
- ix = true
- settings(1,1)
- end
- if x > posx and x < (posx+10) and y == (posy+6) then
- ix = true
- wallpaper_m((posx+11),(posy+6))
- end
- if x > posx and x < (posx+10) and y == (posy+7) then
- ix = true
- user_m((posx+11),(posy+7))
- end
- if x > posx and x < (posx+10) and y == (posy+8) then
- ix = true
- auto_s((posx+11),(posy+8))
- end
- if x > posx and x < (posx+10) and y == (posy+9) then
- ix = true
- auto_d()
- end
- end
- end
- end
- --delete autostart--
- function auto_d()
- local found = fs.exists("config/autostart.cfg")
- if found == true then
- shell.run("delete config/autostart.cfg")
- end
- shell.run("reboot")
- end
- --autostart--
- function auto_s(posx,posy)
- local found = fs.exists("config/autostart.cfg")
- if found == true then
- shell.run("delete config/autostart.cfg")
- end
- mon.setBackgroundColor(128)
- mon.setCursorPos(posx,posy)
- mon.write("Enter Username:")
- user_n = read()
- mon.setCursorPos(posx,(posy+1))
- mon.write("Enter Programname:")
- program_s = read()
- local file = fs.open("config/autostart.cfg","w")
- file.writeLine(user_n)
- file.writeLine(program_s)
- file.close()
- shell.run("reboot")
- end
- --user menu--
- function user_m(posx,posy)
- mon.setBackgroundColor(128)
- mon.setCursorPos(posx,posy)
- mon.write(" X")
- mon.setCursorPos(posx,(posy+1))
- mon.write(" Delete User")
- mon.setCursorPos(posx,(posy+2))
- mon.write(" Change PW ")
- iy = false
- while iy == false do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x > posx and x < (posx+10) and y == posy then
- iy = true
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+1) then
- iy = true
- deleteU(2,12)
- end
- if x > posx and x < (posx+10) and y == (posy+2) then
- iy = true
- changePW(2,12)
- end
- end
- end
- end
- --delete user menu--
- function deleteU(posx,posy)
- mon.setBackgroundColor(128)
- mon.setCursorPos(posx,posy)
- mon.write("Delete User: X")
- mon.setCursorPos(posx,(posy+1))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+2))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+3))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+4))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+5))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+6))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+7))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+8))
- mon.write(" ")
- file = fs.open("database/user.db","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- posyX = posy +2
- for iud=1,(#fileData) do
- dataU = caAPI.split(fileData[iud],"#")
- mon.setCursorPos(3,posyX)
- mon.write(dataU[1])
- posyX = posyX + 1
- end
- iy = false
- while iy == false do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x > posx and x < (posx+10) and y == posy then
- iy = true
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+2) then
- iy = true
- dleU(1)
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+3) then
- iy = true
- dleU(2)
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+4) then
- iy = true
- dleU(3)
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+5) then
- iy = true
- dleU(4)
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+6) then
- iy = true
- dleU(5)
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+7) then
- iy = true
- dleU(6)
- mainmenu(user)
- end
- end
- end
- end
- --delete user
- function dleU(num)
- file = fs.open("database/user.db","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- table.remove(fileData,num)
- local file = fs.open("database/user.db","w")
- for iux=1,#fileData do
- file.writeLine(fileData[iux])
- end
- file.close()
- end
- --change pw menu--
- function changePW(posx,posy)
- mon.setBackgroundColor(128)
- mon.setCursorPos(posx,posy)
- mon.write("Change Password: X")
- mon.setCursorPos(posx,(posy+1))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+2))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+3))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+4))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+5))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+6))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+7))
- mon.write(" ")
- mon.setCursorPos(posx,(posy+8))
- mon.write(" ")
- mon.setCursorPos((posx+1),(posy+3))
- mon.write("Enter new password")
- mon.setCursorPos((posx+1),(posy+4))
- nwpd1 = read("*")
- mon.setCursorPos((posx+1),(posy+5))
- mon.write("Enter password again")
- mon.setCursorPos((posx+1),(posy+6))
- nwpd2 = read("*")
- if nwpd1 == nwpd2 then
- mon.setCursorPos((posx+1),(posy+6))
- mon.write("Password changed")
- sleep(5)
- file = fs.open("database/user.db","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- for iux=1,#fileData do
- dataU = caAPI.split(fileData[iux],"#")
- if user == dataU[1] then
- table.remove(fileData,iux)
- end
- end
- local file = fs.open("database/user.db","w")
- for iux=1,#fileData do
- file.writeLine(fileData[iux])
- end
- file.writeLine(user.."#"..nwpd1)
- file.close()
- mainmenu(user)
- else
- changePW(posx,posy)
- end
- end
- --wallpaper menu--
- function wallpaper_m(posx,posy)
- mon.setBackgroundColor(128)
- mon.setCursorPos(posx,posy)
- mon.write(" X")
- mon.setCursorPos(posx,(posy+1))
- mon.write(" Pig ")
- mon.setCursorPos(posx,(posy+2))
- mon.write(" Steve ")
- mon.setCursorPos(posx,(posy+3))
- mon.write(" Crepper ")
- mon.setCursorPos(posx,(posy+4))
- mon.write(" Clear ")
- iy = false
- while iy == false do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x > posx and x < (posx+10) and y == posy then
- iy = true
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+1) then
- iy = true
- wpName = "pig"
- set_wp(wpName)
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+2) then
- iy = true
- wpName = "steve"
- set_wp(wpName)
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+3) then
- iy = true
- wpName = "creeper"
- set_wp(wpName)
- mainmenu(user)
- end
- if x > posx and x < (posx+10) and y == (posy+4) then
- iy = true
- wpName = "clear"
- set_wp(wpName)
- mainmenu(user)
- end
- end
- end
- end
- --set new wp
- function set_wp(wp_name)
- file = fs.open("config/monitor.cfg","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- num = 4
- table.remove(fileData,num)
- local file = fs.open("config/monitor.cfg","w")
- for iux=1,#fileData do
- file.writeLine(fileData[iux])
- end
- file.writeLine(wp_name)
- file.close()
- end
- --settings menu--
- function settings(posx,posy)
- mon.setBackgroundColor(128)
- for iuZ=1,26 do
- mon.setCursorPos(posx,iuZ)
- mon.write(" ")
- end
- mon.setCursorPos(50,1)
- mon.setBackgroundColor(colors.red)
- mon.setTextColor(colors.black)
- mon.write("X")
- mon.setBackgroundColor(colors.gray)
- mon.setTextColor(colors.white)
- mon.setCursorPos(1,1)
- mon.write("Hardware Settings")
- file = fs.open("config/monitor.cfg","r")
- local fileDataZ = {}
- local line = file.readLine()
- repeat
- table.insert(fileDataZ,line)
- line = file.readLine()
- until line == nil
- file.close()
- mon_nu = fileDataZ[1]
- per_nu = fileDataZ[2]
- rad_nu = fileDataZ[3]
- local per_st = false
- local found = fs.exists("config/per_plus_plus.cfg")
- if found == true then
- file = fs.open("config/per_plus_plus.cfg","r")
- local fileDataZZ = {}
- local line = file.readLine()
- repeat
- table.insert(fileDataZZ,line)
- line = file.readLine()
- until line == nil
- file.close()
- per_st = true
- spe_nu = fileDataZZ[1]
- cha_nu = fileDataZZ[2]
- not_nu = fileDataZZ[3]
- lam_nu = fileDataZZ[4]
- else
- spe_nu = "Please Reboot"
- cha_nu = "Please Reboot"
- not_nu = "Please Reboot"
- lam_nu = "Please Reboot"
- end
- mon.setCursorPos(3,3)
- mon.write("Monitor:")
- mon.setCursorPos(20,3)
- mon.write(mon_nu)
- mon.setCursorPos(3,5)
- mon.write("Computronics/Peripherals++")
- mon.setCursorPos(3,9)
- mon.write("Speaker:")
- mon.setCursorPos(20,9)
- mon.write(spe_nu)
- mon.setCursorPos(3,11)
- mon.write("Chat Box:")
- mon.setCursorPos(20,11)
- mon.write(cha_nu)
- mon.setCursorPos(3,13)
- mon.write("Iron Noteblock:")
- mon.setCursorPos(20,13)
- mon.write(not_nu)
- mon.setCursorPos(3,15)
- mon.write("Colorful Lamp:")
- mon.setCursorPos(20,15)
- mon.write(lam_nu)
- mon.setBackgroundColor(colors.blue)
- mon.setTextColor(colors.white)
- mon.setCursorPos(38,3)
- mon.write("Change")
- mon.setCursorPos(38,9)
- mon.write("Change")
- mon.setCursorPos(38,11)
- mon.write("Change")
- mon.setCursorPos(38,13)
- mon.write("Change")
- mon.setCursorPos(38,15)
- mon.write("Change")
- mon.setBackgroundColor(colors.white)
- if per_nu == "peripheralspluplus_off" then
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(38,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.blue)
- mon.setCursorPos(40,5)
- mon.write(" ")
- mon.setCursorPos(43,5)
- mon.write("OFF")
- else
- mon.setBackgroundColor(colors.blue)
- mon.setCursorPos(38,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(40,5)
- mon.write(" ")
- mon.setBackgroundColor(colors.blue)
- mon.setCursorPos(43,5)
- mon.write("ON")
- end
- iy = false
- while iy == false do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x == 50 and y == 1 then
- iy = true
- mainmenu(user)
- end
- if y == 3 then
- iy = true
- mon.setCursorPos(3,20)
- mon.write("Input Monitor Number:")
- mon.setCursorPos(3,21)
- input = read()
- set_sett_m(input,1)
- mon.setCursorPos(3,22)
- mon.write("Saved")
- sleep(5)
- settings(posx,posy)
- end
- if y == 5 then
- if per_nu == "peripheralspluplus_off" then
- set_sett_m("peripheralspluplus_on",2)
- settings(posx,posy)
- else
- set_sett_m("peripheralspluplus_off",2)
- settings(posx,posy)
- end
- end
- if y == 9 and per_st == true then
- iy = true
- mon.setCursorPos(3,20)
- mon.write("Input Speaker Number:")
- mon.setCursorPos(3,21)
- input = read()
- set_sett_p(input,1)
- mon.setCursorPos(3,22)
- mon.write("Saved")
- sleep(5)
- settings(posx,posy)
- end
- if y == 11 and per_st == true then
- iy = true
- mon.setCursorPos(3,20)
- mon.write("Input Chat Box Number:")
- mon.setCursorPos(3,21)
- input = read()
- set_sett_p(input,2)
- mon.setCursorPos(3,22)
- mon.write("Saved")
- sleep(5)
- settings(posx,posy)
- end
- if y == 13 and per_st == true then
- iy = true
- mon.setCursorPos(3,20)
- mon.write("Input Notebloack Number:")
- mon.setCursorPos(3,21)
- input = read()
- set_sett_p(input,3)
- mon.setCursorPos(3,22)
- mon.write("Saved")
- sleep(5)
- settings(posx,posy)
- end
- if y == 15 and per_st == true then
- iy = true
- mon.setCursorPos(3,20)
- mon.write("Input Lamp Number:")
- mon.setCursorPos(3,21)
- input = read()
- set_sett_p(input,4)
- mon.setCursorPos(3,22)
- mon.write("Saved")
- sleep(5)
- settings(posx,posy)
- end
- end
- end
- end
- --save sett m wp
- function set_sett_m(wp_name,num)
- file = fs.open("config/monitor.cfg","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- table.remove(fileData,num)
- table.insert(fileData,num,wp_name)
- local file = fs.open("config/monitor.cfg","w")
- for iux=1,#fileData do
- file.writeLine(fileData[iux])
- end
- file.close()
- end
- --save sett p wp
- function set_sett_p(wp_name,num)
- file = fs.open("config/per_plus_plus.cfg","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- table.remove(fileData,num)
- table.insert(fileData,num,wp_name)
- local file = fs.open("config/per_plus_plus.cfg","w")
- for iux=1,#fileData do
- file.writeLine(fileData[iux])
- end
- file.close()
- end
- --Bios--
- function bios()
- mon.clear()
- mon.setTextColor(1)
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setCursorPos(1,1)
- mon.setTextColor(colors.yellow)
- mon.write("caworks Modular Bios V.10")
- sleep(0.5)
- mon.setCursorPos(1,2)
- mon.setTextColor(colors.white)
- mon.write("2011 - 2013 caworks Software Inc")
- sleep(0.5)
- mon.setCursorPos(1,3)
- mon.write("Processor caCore 2,4 GHZ x4")
- sleep(0.5)
- mon.setCursorPos(1,4)
- mon.write("Memory Testing: ok 2096084K")
- sleep(0.5)
- mon.setCursorPos(1,5)
- mon.write("----------------------------------------")
- mon.setCursorPos(1,6)
- mon.write("IDE Channel 0: Master CW34342525 500GB")
- mon.setCursorPos(1,7)
- mon.write("IDE Channel 1: NONE")
- mon.setCursorPos(1,24)
- mon.write("Press F12 for Bios Setup")
- sleep(5)
- mon.clear()
- end
- --loading screen--
- function loadingscreen()
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("_")
- sleep(3)
- mon.clear()
- mon.setTextColor(1)
- mon.setBackgroundColor(8)
- mon.clear()
- bootlogo = paintutils.loadImage("images/bootlogo")
- paintutils.drawImage(bootlogo, 1, 1)
- mon.setTextColor(1)
- mon.setBackgroundColor(8)
- mon.setCursorPos(17,15)
- mon.write("CawOS Loading")
- mon.setCursorPos(18,16)
- mon.setBackgroundColor(colors.red)
- mon.write(textutils.slowWrite(" ",1))
- mon.setBackgroundColor(8)
- mon.setCursorPos(17,17)
- if (PeripheralsPlusPlus == true) then
- caAPI.lamp(8)
- caAPI.sound(5,1)
- sleep(1)
- caAPI.lamp(32)
- caAPI.sound(6,1)
- sleep(1)
- caAPI.lamp(8)
- caAPI.sound(5,1)
- sleep(1)
- caAPI.lamp(32)
- caAPI.sound(6,1)
- end
- mon.write("Loging in..")
- sleep(2)
- end
- --mainmenu screen(desktop)--
- function mainmenu(user)
- ix = false
- while ix == false do
- getPrograms()
- if wpName == "" or wpName == nil then
- wpName = "clear"
- end
- mon.setTextColor(colors.white)
- mon.clear()
- background = paintutils.loadImage("images/wallpaper/"..wpName)
- paintutils.drawImage(background, 1, 6)
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(2048)
- mon.write("Menu|"..user.." ")
- mon.setCursorPos(22,1)
- mon.write(caAPI.getTime())
- mon.setCursorPos(41,1)
- mon.write("CawOS v3.0")
- mon.setBackgroundColor(8)
- --draw icons--
- startposx = 2
- startposy = 3
- space = 12
- maxSymbols = 4
- for xa=1,#programs do
- if xa == 5 or xa == 9 or xa == 13 then
- startposy = (startposy + 6)
- startposx = 2
- end
- caAPI.icon(startposx,startposy)
- mon.setCursorPos(startposx,(startposy+4))
- mon.write(string.sub(programs[xa],0,9))
- startposx = (startposx + space)
- end
- local found = fs.exists("config/autostart.cfg")
- if found == true and start_a == 0 then
- sleep(3)
- file = fs.open("config/autostart.cfg","r")
- local fileDataA = {}
- local line = file.readLine()
- repeat
- table.insert(fileDataA,line)
- line = file.readLine()
- until line == nil
- file.close()
- name = fileDataA[2]
- mon.setCursorPos(1,26)
- start_a = 1
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- --touch--
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- posP = 0
- --line1--
- if x > 2 and x < 8 and y > 3 and y < 7 then
- posP = 1
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 14 and x < 20 and y > 3 and y < 7 then
- posP = 2
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 26 and x < 32 and y > 3 and y < 7 then
- posP = 3
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 38 and x < 44 and y > 3 and y < 7 then
- posP = 4
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- --line2--
- if x > 2 and x < 8 and y > 9 and y < 13 then
- posP = 5
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 14 and x < 20 and y > 9 and y < 13 then
- posP = 6
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 26 and x < 32 and y > 9 and y < 13 then
- posP = 7
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 38 and x < 44 and y > 9 and y < 13 then
- posP = 8
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- --line3--
- if x > 2 and x < 8 and y > 15 and y < 19 then
- posP = 9
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 14 and x < 20 and y > 15 and y < 19 then
- posP = 10
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 26 and x < 32 and y > 15 and y < 19 then
- posP = 11
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 38 and x < 44 and y > 15 and y < 19 then
- posP = 12
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- --line4--
- if x > 2 and x < 8 and y > 21 and y < 25 then
- posP = 13
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 14 and x < 20 and y > 21 and y < 25 then
- posP = 14
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 26 and x < 32 and y > 21 and y < 25 then
- posP = 15
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 38 and x < 44 and y > 21 and y < 25 then
- posP = 16
- name = programs[posP]
- if name ~= nil then
- mon.setCursorPos(1,26)
- mon.write("Start "..name.."...")
- sleep(5)
- startP(name)
- end
- end
- if x > 1 and x < 6 and y == 1 then
- xi = true
- menu(2,2)
- end
- end
- end
- end
- --login--
- function login()
- local found = fs.exists("database/user.db")
- if found == false then
- local file = fs.open("database/user.db","w")
- file.writeLine("Guest#0000")
- file.close()
- end
- local found = fs.exists("config/autostart.cfg")
- if found == true then
- file = fs.open("config/autostart.cfg","r")
- local fileDataA = {}
- local line = file.readLine()
- repeat
- table.insert(fileDataA,line)
- line = file.readLine()
- until line == nil
- file.close()
- user = fileDataA[1]
- mainmenu(user)
- end
- file = fs.open("database/user.db","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- mon.setBackgroundColor(colors.gray)
- local startdraw = 10
- for iud=1,(#fileData + 3) do
- mon.setCursorPos(14,startdraw)
- mon.write(" ")
- startdraw = startdraw + 1
- end
- mon.setCursorPos(15,(startdraw-1))
- mon.setTextColor(colors.red)
- mon.write("New User")
- mon.setCursorPos((15-1),startdraw)
- mon.setTextColor(colors.green)
- mon.write(" Sensor ")
- mon.setTextColor(colors.white)
- mon.setCursorPos(15,10)
- mon.write("User:")
- local startcursor = 11
- for iu=1,#fileData do
- mon.setCursorPos(15,startcursor)
- dataU = caAPI.split(fileData[iu],"#")
- mon.write(dataU[1])
- startcursor = startcursor + 1
- end
- mon.setBackgroundColor(8)
- mon.setBackgroundColor(8)
- --Input--
- local ixu = false
- while ixu == false do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- posU = 0
- if x > 15 and x < 30 and y == (startdraw-1) then
- ixu = true
- new_user()
- end
- if x > 15 and x < 30 and y == (startdraw) then
- ixu = true
- os.loadAPI("sensor_plugin")
- check_st = sensor_plugin.sensor()
- check_sp = caAPI.split(check_st,"#")
- check_st = check_sp[1]
- if check_st == "ok" then
- user = check_sp[2]
- mainmenu(user)
- else
- login()
- end
- end
- if x > 15 and x < 30 and y == 11 then
- posU = 1
- user = fileData[posU]
- if user ~= nil then
- dataU = caAPI.split(user,"#")
- user = dataU[1]
- pwd = dataU[2]
- mon.setCursorPos(14,7)
- mon.write(" ")
- mon.setCursorPos(14,7)
- mon.write("Password for "..user)
- mon.setCursorPos(14,8)
- mon.write(" ")
- mon.setCursorPos(14,8)
- local nwpw = read("*")
- if user ~= nil and nwpw == pwd then
- ixu = true
- mainmenu(user)
- sleep(2)
- else
- mon.setCursorPos(14,8)
- mon.write("Wrong PW!! Choose a User")
- login()
- end
- end
- end
- if x > 15 and x < 30 and y == 12 then
- posU = 2
- user = fileData[posU]
- if user ~= nil then
- dataU = caAPI.split(user,"#")
- user = dataU[1]
- pwd = dataU[2]
- mon.setCursorPos(14,7)
- mon.write(" ")
- mon.setCursorPos(14,7)
- mon.write("Password for "..user)
- mon.setCursorPos(14,8)
- mon.write(" ")
- mon.setCursorPos(14,8)
- local nwpw = read("*")
- if user ~= nil and nwpw == pwd then
- ixu = true
- mainmenu(user)
- sleep(2)
- else
- mon.setCursorPos(14,8)
- mon.write("Wrong PW!! Choose a User")
- login()
- end
- end
- end
- if x > 15 and x < 30 and y == 13 then
- posU = 3
- user = fileData[posU]
- if user ~= nil then
- dataU = caAPI.split(user,"#")
- user = dataU[1]
- pwd = dataU[2]
- mon.setCursorPos(14,7)
- mon.write(" ")
- mon.setCursorPos(14,7)
- mon.write("Password for "..user)
- mon.setCursorPos(14,8)
- mon.write(" ")
- mon.setCursorPos(14,8)
- local nwpw = read("*")
- if user ~= nil and nwpw == pwd then
- ixu = true
- mainmenu(user)
- sleep(2)
- else
- mon.setCursorPos(14,8)
- mon.write("Wrong PW!! Choose a User")
- login()
- end
- end
- end
- if x > 15 and x < 30 and y == 14 then
- posU = 4
- user = fileData[posU]
- if user ~= nil then
- dataU = caAPI.split(user,"#")
- user = dataU[1]
- pwd = dataU[2]
- mon.setCursorPos(14,7)
- mon.write(" ")
- mon.setCursorPos(14,7)
- mon.write("Password for "..user)
- mon.setCursorPos(14,8)
- mon.write(" ")
- mon.setCursorPos(14,8)
- local nwpw = read("*")
- if user ~= nil and nwpw == pwd then
- ixu = true
- mainmenu(user)
- sleep(2)
- else
- mon.setCursorPos(14,8)
- mon.write("Wrong PW!! Choose a User")
- login()
- end
- end
- end
- if x > 15 and x < 30 and y == 15 then
- posU = 5
- user = fileData[posU]
- if user ~= nil then
- pwd = dataU[2]
- mon.setCursorPos(14,7)
- mon.write(" ")
- mon.setCursorPos(14,7)
- mon.write("Password for "..user)
- mon.setCursorPos(14,8)
- mon.write(" ")
- mon.setCursorPos(14,8)
- local nwpw = read("*")
- if user ~= nil and nwpw == pwd then
- ixu = true
- mainmenu(user)
- sleep(2)
- else
- mon.setCursorPos(14,8)
- mon.write("Wrong PW!! Choose a User")
- login()
- end
- end
- end
- end
- end
- if (PeripheralsPlusPlus == true) then
- caAPI.sound(5,1)
- end
- end
- --new user--
- function new_user()
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.black)
- mon.setCursorPos(15,8)
- mon.write("New User:")
- mon.setCursorPos(15,9)
- local nwus = read()
- mon.setCursorPos(15,8)
- mon.write("Password")
- mon.setCursorPos(15,9)
- local nwpw = read("*")
- local file = fs.open("database/user.db","a")
- file.writeLine(nwus.."#"..nwpw)
- file.close()
- sleep(2)
- login()
- end
- --downlaod programs--
- function download()
- shell.run("mkdir images")
- shell.run("mkdir images/wallpaper")
- shell.run("mkdir config")
- shell.run("mkdir database")
- mon.clear()
- mon.setCursorPos(1,1)
- shell.run("delete caAPI")
- shell.run("pastebin get EDLdR1nF caAPI")
- shell.run("delete sensor_plugin")
- shell.run("pastebin get sUjKS14y sensor_plugin")
- shell.run("delete Email")
- shell.run("pastebin get 8SDMFXbE Email")
- shell.run("delete NetChat")
- shell.run("pastebin get CQfGf71b NetChat")
- shell.run("delete Download")
- shell.run("pastebin get BSE3VEzU Download")
- shell.run("delete images/bootlogo")
- shell.run("pastebin get 6TMaAkDt images/bootlogo")
- shell.run("delete images/icon")
- shell.run("pastebin get 8bpP81nj images/icon")
- shell.run("delete images/wallpaper/clear")
- shell.run("pastebin get n7VBnnB9 images/wallpaper/clear")
- shell.run("delete images/wallpaper/creeper")
- shell.run("pastebin get 6CGEBn0G images/wallpaper/creeper")
- shell.run("delete images/wallpaper/pig")
- shell.run("pastebin get SkDqceqX images/wallpaper/pig")
- shell.run("delete images/wallpaper/steve")
- shell.run("pastebin get Ln8J74df images/wallpaper/steve")
- sleep(5)
- --load API---
- os.loadAPI("caAPI")
- --ini peripheralPlusPlus--
- if (PeripheralsPlusPlus == true) then
- caAPI.ini_peripheralPlusPlus()
- end
- end
- --program--
- bios()
- download()
- rs.setBundledOutput("bottom",colors.black)
- loadingscreen()
- login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement