SHOW:
|
|
- or go back to the newest paste.
| 1 | - | os.loadAPI("userinfo")
|
| 1 | + | ver = 5 |
| 2 | ||
| 3 | - | function drawScreen(tableScreen) |
| 3 | + | function drawScreen(staticScreen, tableScreen) |
| 4 | - | user = userinfo.getUser() |
| 4 | + | |
| 5 | rkeyp = true | |
| 6 | cselected = 1 | |
| 7 | num = 1 | |
| 8 | static = true | |
| 9 | ||
| 10 | while running == true do | |
| 11 | term.clear() | |
| 12 | term.setCursorPos(1, 1) | |
| 13 | ||
| 14 | screenX, screenY = term.getSize() | |
| 15 | ||
| 16 | rkeyp = true | |
| 17 | isPrint = true | |
| 18 | num = 1 | |
| 19 | static = true | |
| 20 | staticNum = 1 | |
| 21 | - | print("JenisOS V0.1")
|
| 21 | + | |
| 22 | - | print("Logged in as "..user)
|
| 22 | + | while static == true do |
| 23 | line = staticScreen[staticNum] | |
| 24 | if line ~= nil then | |
| 25 | print(line) | |
| 26 | staticNum = staticNum + 1 | |
| 27 | else | |
| 28 | static = false | |
| 29 | end | |
| 30 | end | |
| 31 | ||
| 32 | num = 1 | |
| 33 | print(" ")
| |
| 34 | ||
| 35 | while isPrint == true do | |
| 36 | line = tableScreen[num] | |
| 37 | if line ~= nil and num ~= cselected then | |
| 38 | print(line) | |
| 39 | - | event, param = os.pullEvent("key")
|
| 39 | + | |
| 40 | - | if param == 200 then |
| 40 | + | |
| 41 | - | cselected = cselected - 1 |
| 41 | + | |
| 42 | - | if cselected <= 0 then |
| 42 | + | |
| 43 | - | cselected = num - 1 |
| 43 | + | |
| 44 | isPrint = false | |
| 45 | - | rkeyp = false |
| 45 | + | |
| 46 | - | elseif param == 208 then |
| 46 | + | |
| 47 | - | cselected = cselected + 1 |
| 47 | + | |
| 48 | - | if cselected >= num then |
| 48 | + | |
| 49 | - | cselected = 1 |
| 49 | + | breaker = os.startTimer(1) |
| 50 | event = {os.pullEvent()}
| |
| 51 | - | rkeyp = false |
| 51 | + | param = event[2] |
| 52 | - | elseif param == 28 then |
| 52 | + | if event[1] == "key" then |
| 53 | - | return cselected |
| 53 | + | if param == 200 then |
| 54 | - | elseif param == 15 then |
| 54 | + | cselected = cselected - 1 |
| 55 | - | return 999 |
| 55 | + | if cselected <= 0 then |
| 56 | cselected = num - 1 | |
| 57 | end | |
| 58 | rkeyp = false | |
| 59 | elseif param == 208 then | |
| 60 | cselected = cselected + 1 | |
| 61 | if cselected >= num then | |
| 62 | cselected = 1 | |
| 63 | end | |
| 64 | rkeyp = false | |
| 65 | elseif param == 28 then | |
| 66 | return cselected | |
| 67 | elseif param == 15 then | |
| 68 | return 999 | |
| 69 | end | |
| 70 | elseif event[1] == "mouse_click" then | |
| 71 | start = staticNum | |
| 72 | selectedNum = event[4] - start | |
| 73 | if selectedNum > 0 and selectedNum <= num then | |
| 74 | return selectedNum | |
| 75 | end | |
| 76 | end | |
| 77 | end | |
| 78 | end | |
| 79 | end | |
| 80 | ||
| 81 | function silentPastebin(target, path) | |
| 82 | if fs.exists(path) then | |
| 83 | return "Exists" | |
| 84 | end | |
| 85 | ||
| 86 | paste = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode(target))
| |
| 87 | ||
| 88 | if paste then | |
| 89 | text = paste.readAll() | |
| 90 | paste.close() | |
| 91 | ||
| 92 | file = fs.open(path, "w") | |
| 93 | file.write(text) | |
| 94 | file.close() | |
| 95 | ||
| 96 | return "Success" | |
| 97 | else | |
| 98 | return "Failed" | |
| 99 | end | |
| 100 | end | |
| 101 | ||
| 102 | function update(targetDir) | |
| 103 | info = http.get("http://pastebin.com/raw.php?i=7qyyZwiT")
| |
| 104 | ||
| 105 | check = info.readLine() | |
| 106 | version = info.readLine() | |
| 107 | pointer = info.readLine() | |
| 108 | info.close() | |
| 109 | ||
| 110 | info = nil | |
| 111 | ||
| 112 | if check == "Jenisis" then | |
| 113 | if version == ver then | |
| 114 | return "Up to date." | |
| 115 | else | |
| 116 | new = http.get("http://pastebin.com/raw.php?i="..pointer)
| |
| 117 | ||
| 118 | updateCopy = new.readAll() | |
| 119 | new.close() | |
| 120 | ||
| 121 | file = fs.open(targetDir, "w") | |
| 122 | file.write(updateCopy) | |
| 123 | file.close() | |
| 124 | ||
| 125 | print("Update Finished.")
| |
| 126 | end | |
| 127 | end | |
| 128 | end |