Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- mon = peripheral.wrap("right")
- printer = peripheral.wrap("left")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- function beginn()
- if fs.exists("jobsFile") == false then
- jobs = {}
- jobs[1] = {Name = "Muster", Job = "Unterstuetzen", CArt = "UU-Matter", CSize = "Stack / Jahr", PW = "dontDel"}
- cFile = fs.open("jobsFile","w")
- cFile.write(textutils.serialize(jobs))
- cFile.close()
- else
- grFile = fs.open("jobsFile","r")
- jobs = textutils.unserialize(grFile.readAll())
- grFile.close()
- end
- beginn1()
- end
- gx , gy = term.getSize()
- gmx, gmy = mon.getSize()
- function save()
- shell.run("delete jobsFile")
- qsFile = fs.open("jobsFile","w")
- qsFile.write(textutils.serialize(jobs))
- qsFile.close()
- end
- function delJob()
- shell.run("clear")
- for jb = 1 , table.maxn(jobs),1 do
- print("[" .. jb .. "] " .. jobs[jb].Name)
- end
- print("Zum loeschen zahl ausweahlen")
- num = io.read()
- if num > table.maxn(jobs) then
- print("Kein Jobeintrag vorhanden unter dieser Nummer")
- sleep(2)
- beginn()
- else
- print("Bitte Password zum loeschen eingeben")
- delpw = io.read()
- if delpw == jobs[num].PW then
- table.remove(jobs,num)
- print("Job geloescht")
- save()
- else
- print("Password wurde falsch eingegben")
- sleep(2)
- beginn()
- end
- end
- end
- function newJob()
- shell.run("clear")
- term.setCursorPos(2,2)
- print("Bitte Namen eingeben")
- term.setCursorPos(2,3)
- name = io.read()
- shell.run("clear")
- term.setCursorPos(2,2)
- print("Bitte Auftrag eingeben")
- term.setCursorPos(2,3)
- job = io.read()
- shell.run("clear")
- term.setCursorPos(2,2)
- print("Bitte Bezahlungsart eingeben")
- term.setCursorPos(2,3)
- cur = io.read()
- shell.run("clear")
- term.setCursorPos(2,2)
- print("Bitte Anzahl eingeben")
- term.setCursorPos(2,3)
- csize = io.read()
- shell.run("clear")
- term.setCursorPos(2,2)
- print("Bitte Password eingeben.")
- print("Wird zum Loeschen benoetigt")
- term.setCursorPos(2,4)
- pw = io.read()
- term.setCursorPos(2,2)
- print("Sind Sie sich mit den Daten sicher ? [Y/N]")
- evt, key2 = os.pullEvent("char")
- key2 = string.lower(key2)
- if key2 == "y" then
- table.insert(jobs, {Name = name, Job = job, CArt = cur, CSize = csize, PW = pw})
- save()
- print("Daten gespeichert")
- sleep(0.5)
- elseif key2 == "n" then
- print("Daten NICHT gespeichert")
- beginn()
- else
- print("Daten nicht gespeichert")
- beginn()
- end
- end
- function beginn1()
- shell.run("clear")
- term.setCursorPos(gx/2 - 15,2)
- print("Willkommen bei Muzze77 JobOMat")
- term.setCursorPos(1,4)
- print("Bitte eine Aktion waehlen")
- print("[N] Um neuen Job zu erstellen")
- print("[D] Um Job zu loeschen")
- print("[E] Um Job anzunehmen")
- evt, key = os.pullEvent("char")
- key = string.lower(key)
- if key == "n" then
- newJob()
- elseif key == "d" then
- delJob()
- elseif key == "e" then
- end
- end
- function listMonJobs()
- v = 1
- while endvar ~= 0 do
- mon.clear()
- mon.setCursorPos(2,2)
- if v == table.maxn(jobs) + 1 then
- v = 1
- end
- mon.write("Job Nr : " .. v)
- mon.setCursorPos(2,3)
- mon.write("Auftraggeber : " .. jobs[v].Name)
- mon.setCursorPos(2,4)
- mon.write("Auftrag : " .. jobs[v].Job)
- mon.setCursorPos(2,5)
- mon.write("Bezahlungsart : " .. jobs[v].CArt)
- mon.setCursorPos(2,6)
- mon.write("Bezahlung : " .. jobs[v].CSize)
- v = v + 1
- evt, side, x , y = os.pullEvent("monitor_touch")
- end
- end
- while true do
- parallel.waitForAny(beginn,listMonJobs)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement