View difference between Paste ID: nMFs8z0r and ASViy4rD
SHOW: | | - or go back to the newest paste.
1
shell.run("delete startup")
2
shell.run("pastebin get nbXu8ZJu startup")
3
os.pullEvent = os.pullEventRaw
4
5
local w,h = term.getSize()
6
7
function printCentered( y,s )
8
   local x = math.floor((w - string.len(s)) / 2)
9
   term.setCursorPos(x,y)
10
   term.clearLine()
11
   term.write( s )
12
end
13
14
local nOption = 1
15
16
local function drawMenu()
17
   term.clear()
18-
   term.write("Impending OS Alpha // ")
18+
19
   term.write("Cat OS 0.2.1 ALPHA ")
20
term.setCursorPos(1,2)
21
shell.run("id")
22
23
   term.setCursorPos(w-11,1)
24
   if nOption == 1 then
25
   term.write("Command")
26-
   term.write("Programs")
26+
27
   term.write("Files")
28
elseif nOption == 3 then
29
   term.write("Shutdown")
30
elseif nOption == 4 then
31
   term.write("Uninstall")
32
else
33
end
34
35
end
36
37
--GUI
38
term.clear()
39
local function drawFrontend()
40-
   printCentered( math.floor(h/2) - 2, "Start Menu" )
40+
41
   printCentered( math.floor(h/2) - 2, "Cat OS Main Menu" )
42-
   printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[ Command  ]") or "Command" )
42+
43-
   printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[ Programs ]") or "Programs" )
43+
   printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[  Command  ]") or "Command" )
44-
   printCentered( math.floor(h/2) + 2, ((nOption == 3) and "[ Shutdown ]") or "Shutdown" )
44+
   printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[   Files   ]") or "Files" )
45-
   printCentered( math.floor(h/2) + 3, ((nOption == 4) and "[ Uninstall]") or " Uninstall" )
45+
   printCentered( math.floor(h/2) + 2, ((nOption == 3) and "[ Shutdown  ]") or "Shutdown" )
46
   printCentered( math.floor(h/2) + 3, ((nOption == 4) and "[ Uninstall ]") or "Uninstall" )
47
   printCentered( math.floor(h/2) + 4, "")
48
end
49
50
--Display
51
drawMenu()
52
drawFrontend()
53
54
while true do
55
 local e,p = os.pullEvent()
56
 if e == "key" then
57
  local key = p
58
  if key == 17 or key == 200 then
59
60
   if nOption > 1 then
61
    nOption = nOption - 1
62
    drawMenu()
63
    drawFrontend()
64
   end
65
  elseif key == 31 or key == 208 then
66
  if nOption < 4 then
67
  nOption = nOption + 1
68
  drawMenu()
69
  drawFrontend()
70
end
71
elseif key == 28 then
72
    --End should not be here!!
73
break
74
end --End should be here!!
75
end
76
end
77
term.clear()
78
79
--Conditions
80-
shell.run("ios/.command")
80+
81
shell.run(".os/command")
82-
shell.run("ios/.programs")
82+
83
shell.run(".os/files")
84
elseif nOption == 3 then
85
os.shutdown()
86-
shell.run("ios/.UninstallDialog")
86+
87
shell.run("delete .os")
88
shell.run("delete startup")
89
shell.run("delete .recover")
90
shell.run("delete .safemode")
91
shell.run("delete .update")
92
os.reboot()
93
else
94
print("Error this is not supposed to happen error code 001")
95
end