LazerAio

.ProgramMenu

Mar 1st, 2022 (edited)
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. local function viewBox(x,y,s,n)
  2. term.setBackgroundColor(colors.lightGray)
  3. term.setCursorPos(x,y)
  4. term.setCursorPos(x,y)
  5. print(n..(string.rep("-",string.len(s)-string.len(n))))
  6. term.setCursorPos(x,(y+1))
  7. print(s)
  8. term.setCursorPos(x, (y+2))
  9. print(s)
  10. term.setCursorPos(x, (y+3))
  11. print(s)
  12. term.setCursorPos(x, (y+4))
  13. print(s)
  14. term.setCursorPos(x, (y+4))
  15. print(s)
  16. term.setCursorPos(x, (y+5))
  17. print(string.rep("-",string.len(s)))
  18. end
  19. local function MAIN(device)
  20. viewBox(14,6," ","PM")
  21. term.setCursorPos(14,7)
  22. local temp = fs.list(device)
  23. local i = 1
  24. local j = 0
  25. local w = true
  26. while w do
  27. if (i-j) == 5 then
  28. j = j + 4
  29. viewBox(14,6," ","PM")
  30. end
  31. term.setCursorPos(14, (6+i-j))
  32. if fs.isDir(temp[i]) then
  33. if fs.isReadOnly(temp[i]) then
  34. term.setBackgroundColor(colors.red)
  35. print(i..". "..temp[i].." >>")
  36. else
  37. term.setTextColour(colors.green)
  38. print(i..". "..temp[i].." >>")
  39. end
  40. term.setBackgroundColor(colors.lightGray)
  41. else
  42. term.setTextColour(colors.white)
  43. print(i..". "..temp[i])
  44. end
  45. term.setTextColour(colors.white)
  46. sleep(0.25)
  47. i = i + 1
  48. if i == #temp then
  49. w = false
  50. end
  51. end
  52. sleep(0.5)
  53. viewBox(14,6," ","PM")
  54. term.setCursorPos(14,7)
  55. print("[C]MD [E]xit [S]hell")
  56. local w = true
  57. while w do
  58. term.setCursorPos(14,8)
  59. selection = read()
  60. if selection == "C" or selection == "C" then
  61. term.setCursorPos(20,9)
  62. shell.run(".CMD")
  63. break
  64. elseif selection == "S" or selection == "s" or selection == "" then
  65. shell.run("fg")
  66. break
  67. elseif selection == "E" or selection == "e" then
  68. break
  69. end
  70. end
  71. end
  72. local function DF(side)
  73. term.setCursorPos(14,7)
  74. print("Disk found on "..side.." side")
  75. term.setCursorPos(14,8)
  76. if fs.exists("disk/init") then
  77. print("Read? [Y/N]")
  78. term.setCursorPos(27, 8)
  79. if read() == "Y" then
  80. MAIN("disk")
  81. else
  82. MAIN("")
  83. end
  84. else
  85. sleep(1)
  86. term.setCursorPos(14,8)
  87. print("Disk is unformated")
  88. term.setCursorPos(14,9)
  89. print("Format? [Y/N]")
  90. term.setCursorPos(28,9)
  91. t = read()
  92. if t == "Y" or t == "y" then
  93. term.setCursorPos(14,8)
  94. print("Formating...")
  95. shell.run("bg","cp",".DFT","disk/init")
  96. else
  97. MAIN("")
  98. end
  99. end
  100. end
  101. DD = false
  102. viewBox(14,6," ","PM")
  103. if disk.isPresent("right") then
  104. DF("right")
  105. DD = true
  106. end
  107. if disk.isPresent("left") then
  108. DF("left")
  109. DD = true
  110. end
  111. if disk.isPresent("top") then
  112. DF("top")
  113. DD = true
  114. end
  115. if disk.isPresent("bottom") then
  116. DF("bottom")
  117. DD = true
  118. end
  119. if disk.isPresent("front") then
  120. DF("front")
  121. DD = true
  122. end
  123. if disk.isPresent("back") then
  124. DF("back")
  125. DD = true
  126. end
  127. if DD == false then
  128. MAIN("")
  129. end
  130.  
Add Comment
Please, Sign In to add comment