zahar0401

ReactOS Disk Image

Jul 30th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 66.86 KB | None | 0 0
  1. {
  2.   "F:.mbr",
  3.   "\"term.setBackgroundColor(colors.black)\\\
  4. shell.run(\\\"clear\\\")\\\
  5. shell.setAlias(\\\"modem\\\", \\\"/system32/modem\\\")\\\
  6. shell.setAlias(\\\"antimalware\\\", \\\"/system32/antimalware\\\")\\\
  7. shell.setAlias(\\\"copy\\\", \\\"/system32/copy\\\")\\\
  8. shell.setAlias(\\\"cp\\\", \\\"/system32/copy\\\")\\\
  9. shell.setAlias(\\\"move\\\", \\\"/system32/move\\\")\\\
  10. shell.setAlias(\\\"mv\\\", \\\"/system32/move\\\")\\\
  11. shell.setAlias(\\\"pastebin\\\", \\\"/system32/pastebin\\\")\\\
  12. shell.setAlias(\\\"edit\\\", \\\"/system32/edit\\\")\\\
  13. shell.setAlias(\\\"list\\\", \\\"/system32/list\\\")\\\
  14. shell.setAlias(\\\"ls\\\", \\\"/system32/list\\\")\\\
  15. shell.setAlias(\\\"dir\\\", \\\"/system32/list\\\")\\\
  16. shell.setAlias(\\\"mkdir\\\", \\\"/system32/mkdir\\\")\\\
  17. shell.setAlias(\\\"alias\\\", \\\"/.setalias\\\")\\\
  18. shell.setAlias(\\\"lua\\\", \\\"/system32/lua\\\")\\\
  19. shell.setAlias(\\\"rga\\\", \\\"/system32/rga\\\")\\\
  20. shell.setAlias(\\\"delete\\\", \\\"/system32/delete\\\")\\\
  21. shell.setAlias(\\\"rm\\\", \\\"/system32/delete\\\")\\\
  22. shell.setAlias(\\\"erase\\\", \\\"/system32/delete\\\")\\\
  23. shell.setAlias(\\\"del\\\", \\\"/system32/delete\\\")\\\
  24. shell.setAlias(\\\"shell\\\", \\\"/system32/cmd\\\")\\\
  25. shell.setAlias(\\\"sh\\\", \\\"/system32/cmd\\\")\\\
  26. shell.setAlias(\\\"startup\\\", \\\"/.mbr\\\")\\\
  27. shell.run(\\\"/system32/cmd\\\")\"",
  28.   "D:.rgaData",
  29.   "{\
  30.  \"F:active\",\
  31.  \"\\\"isActivated = true\\\"\",\
  32.  \"F:files\",\
  33.  \"\\\"list = {\\\\\\\"startup\\\\\\\", \\\\\\\"rga\\\\\\\", \\\\\\\"mbr\\\\\\\", \\\\\\\"system32\\\\\\\"}\\\\\\\
  34. listEdit = {\\\\\\\"rga\\\\\\\", \\\\\\\"system32\\\\\\\"}\\\"\",\
  35.  \"F:inactive\",\
  36.  \"\\\"isActivated = false\\\"\",\
  37. }",
  38.   "F:.rgaKey",
  39.   "\"{[1]=114232018,[2]=3320850722,[3]=1544527649,[4]=3315600456,[5]=1525621041,}\"",
  40.   "F:.setalias",
  41.   "\"printError(\\\"The alias program is unavailable in ReactOS.\\\")\\\
  42. printError(\\\"You may take a look at the RDK instead.\\\")\"",
  43.   "D:api",
  44.   "{\
  45.  \"F:SHA1\",\
  46.  \"\\\"-- SHA1\\\\\\\
  47. -- By KillaVanilla\\\\\\\
  48. \\\\\\\
  49. local function Preprocessing(msg)\\\\\\\
  50. \\\\9local msgCp = {}\\\\\\\
  51. \\\\9local lastPause = os.clock()\\\\\\\
  52. \\\\9for i=1, #msg do\\\\\\\
  53. \\\\9\\\\9msgCp[i] = msg[i]\\\\\\\
  54. \\\\9\\\\9if (os.clock() - lastPause) >= 2.90 then\\\\\\\
  55. \\\\9\\\\9\\\\9os.queueEvent(\\\\\\\"\\\\\\\")\\\\\\\
  56. \\\\9\\\\9\\\\9os.pullEvent(\\\\\\\"\\\\\\\")\\\\\\\
  57. \\\\9\\\\9\\\\9lastPause = os.clock()\\\\\\\
  58. \\\\9\\\\9end\\\\\\\
  59. \\\\9end\\\\\\\
  60. \\\\9local len = #msgCp*8\\\\\\\
  61. \\\\9local bits = #msgCp*8\\\\\\\
  62. \\\\9table.insert(msgCp, 0x80)\\\\\\\
  63. \\\\9while true do\\\\\\\
  64. \\\\9\\\\9if bits % 512 == 448 then\\\\\\\
  65. \\\\9\\\\9\\\\9break\\\\\\\
  66. \\\\9\\\\9else\\\\\\\
  67. \\\\9\\\\9\\\\9table.insert(msgCp, 0)\\\\\\\
  68. \\\\9\\\\9\\\\9bits = #msgCp*8\\\\\\\
  69. \\\\9\\\\9end\\\\\\\
  70. \\\\9end\\\\\\\
  71. \\\\9table.insert(msgCp, len)\\\\\\\
  72. \\\\9return msgCp\\\\\\\
  73. end\\\\\\\
  74. \\\\\\\
  75. local function breakMsg(message)\\\\\\\
  76. \\\\9local chunks = {}\\\\\\\
  77. \\\\9local chunk = 1\\\\\\\
  78. \\\\9for word=1, #message, 16 do\\\\\\\
  79. \\\\9\\\\9chunks[chunk] = {}\\\\\\\
  80. \\\\9\\\\9for i2=0, 15 do\\\\\\\
  81. \\\\9\\\\9\\\\9table.insert(chunks[chunk], message[word+i2] or 0)\\\\\\\
  82. \\\\9\\\\9end\\\\\\\
  83. \\\\9\\\\9chunk = chunk+1\\\\\\\
  84. \\\\9end\\\\\\\
  85. \\\\9return chunks\\\\\\\
  86. end\\\\\\\
  87. \\\\\\\
  88. function leftrotate(a, i)\\\\\\\
  89. \\\\9local bitmask = (2^i)-1\\\\\\\
  90. \\\\9local shiftOut = bit.band(a, bit.blshift(bitmask, 32-i))\\\\\\\
  91. \\\\9if bit.band(shiftOut, 0x80000000) > 0 then -- gotta work around the arithmetic right shift\\\\\\\
  92. \\\\9\\\\9--[[\\\\\\\
  93. \\\\9\\\\9shiftOut = bit.brshift(shiftOut, 1)\\\\\\\
  94. \\\\9\\\\9shiftOut = bit.band(shiftOut, 0x7FFFFFFF)\\\\\\\
  95. \\\\9\\\\9shiftOut = bit.brshift(shiftOut, 31-i)\\\\\\\
  96. \\\\9\\\\9]]\\\\\\\
  97. \\\\9\\\\9shiftOut = bit.band(bit.brshift(shiftOut, 32-i), bitmask)\\\\\\\
  98. \\\\9else\\\\\\\
  99. \\\\9\\\\9shiftOut = bit.brshift(shiftOut, 32-i)\\\\\\\
  100. \\\\9end\\\\\\\
  101. \\\\9local b = bit.band(bit.blshift(a, i), 0xFFFFFFFF)\\\\\\\
  102. \\\\9b = bit.bor(b, shiftOut)\\\\\\\
  103. \\\\9return (b  % (2^32))\\\\\\\
  104. end\\\\\\\
  105. \\\\\\\
  106. function digest(bytes, debugFile)\\\\\\\
  107. \\\\9bytes = Preprocessing(bytes)\\\\\\\
  108. \\\\9local chunks = breakMsg(bytes)\\\\\\\
  109. \\\\9local h = {}\\\\\\\
  110. \\\\9h[0] = 0x67452301\\\\\\\
  111. \\\\9h[1] = 0xEFCDAB89\\\\\\\
  112. \\\\9h[2] = 0x98BADCFE\\\\\\\
  113. \\\\9h[3] = 0x10325476\\\\\\\
  114. \\\\9h[4] = 0xC3D2E1F0\\\\\\\
  115. \\\\9local debug = false\\\\\\\
  116. \\\\9if debugFile then\\\\\\\
  117. \\\\9\\\\9debug = fs.open(debugFile, \\\\\\\"w\\\\\\\")\\\\\\\
  118. \\\\9end\\\\\\\
  119. \\\\9local pauseTimer1 = os.clock()\\\\\\\
  120. \\\\9for chunkN=1, #chunks do\\\\\\\
  121. \\\\9\\\\9local w = {}\\\\\\\
  122. \\\\9\\\\9for i=0, 15 do\\\\\\\
  123. \\\\9\\\\9\\\\9w[i] = chunks[chunkN][i+1]\\\\\\\
  124. \\\\9\\\\9end\\\\\\\
  125. \\\\9\\\\9local pauseTimer2 = os.clock()\\\\\\\
  126. \\\\9\\\\9for i=16, 79 do\\\\\\\
  127. \\\\9\\\\9\\\\9w[i] = bit.bxor( bit.bxor(w[i-3], w[i-8]), bit.bxor(w[i-14], w[i-16]) ) % (2^32)\\\\\\\
  128. \\\\9\\\\9\\\\9w[i] = leftrotate(w[i], 1)\\\\\\\
  129. \\\\9\\\\9\\\\9if (os.clock() - pauseTimer2) >= 2.5 then\\\\\\\
  130. \\\\9\\\\9\\\\9\\\\9os.queueEvent(\\\\\\\"\\\\\\\")\\\\\\\
  131. \\\\9\\\\9\\\\9\\\\9os.pullEvent(\\\\\\\"\\\\\\\")\\\\\\\
  132. \\\\9\\\\9\\\\9\\\\9pauseTimer2 = os.clock()\\\\\\\
  133. \\\\9\\\\9\\\\9end\\\\\\\
  134. \\\\9\\\\9end\\\\\\\
  135. \\\\9\\\\9local a = h[0]\\\\\\\
  136. \\\\9\\\\9local b = h[1]\\\\\\\
  137. \\\\9\\\\9local c = h[2]\\\\\\\
  138. \\\\9\\\\9local d = h[3]\\\\\\\
  139. \\\\9\\\\9local e = h[4]\\\\\\\
  140. \\\\9\\\\9local pauseTimer3 = os.clock()\\\\\\\
  141. \\\\9\\\\9for i=0, 79 do\\\\\\\
  142. \\\\9\\\\9\\\\9local f = 0\\\\\\\
  143. \\\\9\\\\9\\\\9local k = 0\\\\\\\
  144. \\\\9\\\\9\\\\9if (i >= 0) and (i <= 19) then\\\\\\\
  145. \\\\9\\\\9\\\\9\\\\9f = bit.bor(bit.band(a, c), bit.band(bit.bnot(b), d)) % (2^32)\\\\\\\
  146. \\\\9\\\\9\\\\9\\\\9k = 0x5A827999\\\\\\\
  147. \\\\9\\\\9\\\\9elseif (i >= 20) and (i <= 39) then\\\\\\\
  148. \\\\9\\\\9\\\\9\\\\9f = bit.bxor(b, bit.bxor(c, d)) % (2^32)\\\\\\\
  149. \\\\9\\\\9\\\\9\\\\9k = 0x6ED9EBA1\\\\\\\
  150. \\\\9\\\\9\\\\9elseif (i >= 40) and (i <= 59) then\\\\\\\
  151. \\\\9\\\\9\\\\9\\\\9f = bit.bor(bit.band(b, c), bit.bor(bit.band(b, d), bit.band(c, d))) % (2^32)\\\\\\\
  152. \\\\9\\\\9\\\\9\\\\9k = 0x8F1BBCDC\\\\\\\
  153. \\\\9\\\\9\\\\9elseif (i >= 60) and (i <= 79) then\\\\\\\
  154. \\\\9\\\\9\\\\9\\\\9f = bit.bxor(b, bit.bxor(c, d)) % (2^32)\\\\\\\
  155. \\\\9\\\\9\\\\9\\\\9k = 0xCA62C1D6\\\\\\\
  156. \\\\9\\\\9\\\\9end\\\\\\\
  157. \\\\9\\\\9\\\\9local temp = (leftrotate(a, 5)+f+e+k+w[i]) % (2^32)\\\\\\\
  158. \\\\9\\\\9\\\\9e = d\\\\\\\
  159. \\\\9\\\\9\\\\9d = c\\\\\\\
  160. \\\\9\\\\9\\\\9c = leftrotate(b, 30)\\\\\\\
  161. \\\\9\\\\9\\\\9b = a\\\\\\\
  162. \\\\9\\\\9\\\\9a = temp\\\\\\\
  163. \\\\9\\\\9\\\\9if (os.clock() - pauseTimer3) >= 2.80 then\\\\\\\
  164. \\\\9\\\\9\\\\9\\\\9os.queueEvent(\\\\\\\"\\\\\\\")\\\\\\\
  165. \\\\9\\\\9\\\\9\\\\9os.pullEvent(\\\\\\\"\\\\\\\")\\\\\\\
  166. \\\\9\\\\9\\\\9\\\\9pauseTimer3 = os.clock()\\\\\\\
  167. \\\\9\\\\9\\\\9end\\\\\\\
  168. \\\\9\\\\9end\\\\\\\
  169. \\\\9\\\\9h[0] = (h[0]+a) % (2^32)\\\\\\\
  170. \\\\9\\\\9h[1] = (h[1]+b) % (2^32)\\\\\\\
  171. \\\\9\\\\9h[2] = (h[2]+c) % (2^32)\\\\\\\
  172. \\\\9\\\\9h[3] = (h[3]+d) % (2^32)\\\\\\\
  173. \\\\9\\\\9h[4] = (h[4]+e) % (2^32)\\\\\\\
  174. \\\\9\\\\9if debug then\\\\\\\
  175. \\\\9\\\\9\\\\9debug.writeLine(chunkN..\\\\\\\": \\\\\\\"..string.format(\\\\\\\"%X\\\\\\\", h[0])..\\\\\\\"|\\\\\\\"..string.format(\\\\\\\"%X\\\\\\\", h[1])..\\\\\\\"|\\\\\\\"..string.format(\\\\\\\"%X\\\\\\\", h[2])..\\\\\\\"|\\\\\\\"..string.format(\\\\\\\"%X\\\\\\\", h[3])..\\\\\\\"|\\\\\\\"..string.format(\\\\\\\"%X\\\\\\\", h[4]))\\\\\\\
  176. \\\\9\\\\9end\\\\\\\
  177. \\\\9\\\\9if (os.clock() - pauseTimer1) >= 2.80 then\\\\\\\
  178. \\\\9\\\\9\\\\9os.queueEvent(\\\\\\\"\\\\\\\")\\\\\\\
  179. \\\\9\\\\9\\\\9os.pullEvent(\\\\\\\"\\\\\\\")\\\\\\\
  180. \\\\9\\\\9\\\\9pauseTimer1 = os.clock()\\\\\\\
  181. \\\\9\\\\9end\\\\\\\
  182. \\\\9end\\\\\\\
  183. \\\\9if debug then\\\\\\\
  184. \\\\9\\\\9debug.close()\\\\\\\
  185. \\\\9end\\\\\\\
  186. \\\\9local hash = {}\\\\\\\
  187. \\\\9for i=0, 4 do\\\\\\\
  188. \\\\9\\\\9table.insert(hash, h[i])\\\\\\\
  189. \\\\9end\\\\\\\
  190. \\\\9return hash\\\\\\\
  191. end\\\\\\\
  192. \\\\\\\
  193. function digestStr(str, debugFile)\\\\\\\
  194. \\\\9local msg = {}\\\\\\\
  195. \\\\9for i=1, #str do\\\\\\\
  196. \\\\9\\\\9msg[i] = string.byte(str, i, i)\\\\\\\
  197. \\\\9end\\\\\\\
  198. \\\\9return digest(msg, debugFile)\\\\\\\
  199. end\\\\\\\
  200. \\\\\\\
  201. function digest2str(d)\\\\\\\
  202. \\\\9local str = \\\\\\\"\\\\\\\"\\\\\\\
  203. \\\\9for i=1, #d do\\\\\\\
  204. \\\\9\\\\9str = str..string.format(\\\\\\\"%X\\\\\\\", d[i])\\\\\\\
  205. \\\\9end\\\\\\\
  206. \\\\9return str\\\\\\\
  207. end\\\\\\\
  208. \\\\\\\
  209. function digest2bytes(d)\\\\\\\
  210. \\\\9local bytes = {}\\\\\\\
  211. \\\\9for i=1, #d do\\\\\\\
  212. \\\\9\\\\9table.insert(bytes, bit.band(bit.brshift(bit.band(d[i], 0xFF000000), 24), 0xFF))\\\\\\\
  213. \\\\9\\\\9table.insert(bytes, bit.band(bit.brshift(bit.band(d[i], 0xFF0000), 16), 0xFF))\\\\\\\
  214. \\\\9\\\\9table.insert(bytes, bit.band(bit.brshift(bit.band(d[i], 0xFF00), 8), 0xFF))\\\\\\\
  215. \\\\9\\\\9table.insert(bytes, bit.band(d[i], 0xFF))\\\\\\\
  216. \\\\9end\\\\\\\
  217. \\\\9return bytes\\\\\\\
  218. end\\\"\",\
  219.  \"F:menu\",\
  220.  \"\\\"--MenuAPI by 1Ridav\\\\\\\
  221. --Modified for Debian ComputerCraft by MelnikovSM\\\\\\\
  222. local function mprint(array, this, s1, s2, x, y)\\\\\\\
  223.   for i = 1, #array do\\\\\\\
  224.      term.setCursorPos(x, y)\\\\\\\
  225.      --Check if option selected\\\\\\\
  226.      if i == this then \\\\\\\
  227.      --Option selected   \\\\\\\
  228.         write(s1)\\\\\\\
  229.      else \\\\\\\
  230.      --Option NOT selected\\\\\\\
  231.         write(s2)\\\\\\\
  232.      end\\\\\\\
  233.      --Print the string\\\\\\\
  234.      print(array[i])\\\\\\\
  235.      y = y + 1 \\\\\\\
  236.   end\\\\\\\
  237. end\\\\\\\
  238. \\\\\\\
  239. function CreateMenu(array, state1, state2, pos_x, pos_y)\\\\\\\
  240.   local select = 1\\\\\\\
  241.   local x, y = term.getCursorPos()\\\\\\\
  242.   \\\\\\\
  243.   while true do\\\\\\\
  244.      term.setCursorPos(x, y)\\\\\\\
  245.      mprint(array, select, state1, state2, pos_x, pos_y)\\\\\\\
  246.      event, key = os.pullEvent(\\\\\\\"key\\\\\\\")\\\\\\\
  247.      --Enter\\\\\\\
  248.      if key == 28 then \\\\\\\
  249.         return select \\\\\\\
  250.      end\\\\\\\
  251.      \\\\\\\
  252.      if #array > 1 then\\\\\\\
  253.         --Arrow UP or W key\\\\\\\
  254.         if key == 200 or key == 17 then \\\\\\\
  255.      \\\\9\\\\9    select = select - 1 \\\\\\\
  256. \\\\9\\\\9\\\\9\\\\\\\
  257.            if select < 1 then \\\\\\\
  258.               select = #array \\\\\\\
  259.            end\\\\\\\
  260.         --Arrow Down or S key\\\\\\\
  261.         elseif key == 208 or key == 31 then \\\\\\\
  262.      \\\\9\\\\9    select = select + 1     \\\\\\\
  263.        \\\\9\\\\9\\\\9 if select > #array then select = 1 end\\\\\\\
  264.  \\\\9      end\\\\\\\
  265.      end   \\\\\\\
  266.   end\\\\\\\
  267. end\\\"\",\
  268. }",
  269.   "F:start",
  270.   "\"os.loadAPI(\\\"/api/menu\\\")\\\
  271. os.loadAPI(\\\"/.rgaData/rga\\\")\\\
  272. os.loadAPI(\\\"/.rgaData/files\\\")\\\
  273. \\\
  274. local function bootdonestartup()\\\
  275. shell.run(\\\"clear\\\")\\\
  276. term.setBackgroundColor(colors.cyan)\\\
  277. term.setTextColor(colors.white)\\\
  278. print(\\\"+----------------------------------------------+\\\")\\\
  279. print(\\\"|           ReactOS Boot Manager               |\\\")\\\
  280. print(\\\"|                                              |\\\")\\\
  281. print(\\\"|         Booting MBR, please wait             |\\\")\\\
  282. print(\\\"|                                              |\\\")\\\
  283. print(\\\"|                                              |\\\")\\\
  284. print(\\\"|                                              |\\\")\\\
  285. print(\\\"|                                              |\\\")\\\
  286. print(\\\"|                                              |\\\")\\\
  287. print(\\\"|                                              |\\\")\\\
  288. print(\\\"+----------------------------------------------+\\\")\\\
  289. sleep(5)\\\
  290. shell.run(\\\"clear\\\")\\\
  291. if fs.exists(\\\"/.mbr\\\") then\\\
  292. shell.run(\\\"/.mbr\\\")\\\
  293. else\\\
  294. shell.run(\\\"clear\\\")\\\
  295. printError(\\\"ERROR: Boot file missing!\\\")\\\
  296. printError(\\\"Please insert another boot device\\\")\\\
  297. printError(\\\"and restart your PC using Ctrl+R\\\")\\\
  298. end\\\
  299. end\\\
  300. local function bootdonecd()\\\
  301. shell.run(\\\"clear\\\")\\\
  302. term.setBackgroundColor(colors.cyan)\\\
  303. term.setTextColor(colors.white)\\\
  304. print(\\\"+----------------------------------------------+\\\")\\\
  305. print(\\\"|           ReactOS Boot Manager               |\\\")\\\
  306. print(\\\"|                                              |\\\")\\\
  307. print(\\\"|           Booting from floppy.               |\\\")\\\
  308. print(\\\"|                                              |\\\")\\\
  309. print(\\\"|                                              |\\\")\\\
  310. print(\\\"|                                              |\\\")\\\
  311. print(\\\"|                                              |\\\")\\\
  312. print(\\\"|                                              |\\\")\\\
  313. print(\\\"|                                              |\\\")\\\
  314. print(\\\"|                                              |\\\")\\\
  315. print(\\\"+----------------------------------------------+\\\")\\\
  316. sleep(3)\\\
  317. os.reboot()\\\
  318. end\\\
  319. -- To prevent errors MenuAPI from DCC is used\\\
  320. local bootArray = {\\\"ReactOS v1.5\\\", \\\"Boot from floppy\\\", \\\"Shutdown\\\", \\\"Reboot\\\"}\\\
  321. term.setBackgroundColor(colors.cyan)\\\
  322. term.setTextColor(colors.white)\\\
  323. shell.run(\\\"clear\\\")\\\
  324. print(\\\"+----------------------------------------------+\\\")\\\
  325. print(\\\"            ReactOS Boot Manager                \\\")            \\\
  326. term.setCursorPos(1, 18)\\\
  327. print(\\\"                                                \\\")\\\
  328. print(\\\"+----------------------------------------------+\\\")        \\\
  329. local bootOption = menu.CreateMenu(bootArray, \\\"[ > ] \\\", \\\"[   ] \\\", 3, 4)\\\
  330. -- while true do -- Causes errors!\\\
  331. if bootOption == 1 then\\\
  332. bootdonestartup()\\\
  333. --[[\\\
  334. elseif bootOption == 2 then\\\
  335. term.setCursorPos(1,17)\\\
  336. printError(\\\"CraftOS boot record has been removed.\\\")\\\
  337. sleep(2)\\\
  338. os.reboot()\\\
  339. ]]--\\\
  340. elseif bootOption == 2 then\\\
  341. bootdonecd()\\\
  342. elseif bootOption == 3 then\\\
  343. os.shutdown()\\\
  344. elseif bootOption == 4 then\\\
  345. os.reboot()\\\
  346. --[[\\\
  347. elseif bootOption == 5 then\\\
  348. term.setCursorPos(1,17)\\\
  349. printError(\\\"ERROR: Unable to resolve bootCraftOS()\\\")\\\
  350. sleep(2)\\\
  351. shell.run(\\\"rom/programs/shell\\\")\\\
  352. ]]--\\\
  353. else -- If you manage to break this, you're a god in CC\\\
  354. shell.run(\\\"clear\\\")\\\
  355. printError(\\\"You ran into a serious bug with the Boot Manager!\\\")\\\
  356. printError(\\\"Reinstall your copy of ReactOS immediately!\\\")\\\
  357. printError(\\\"Press any key to enter CraftOS\\\")\\\
  358. os.pullEvent(\\\"key\\\")\\\
  359. shell.run(\\\"/rom/programs/shell\\\")\\\
  360. end      \\\
  361. -- end          \"",
  362.   "F:startup",
  363.   "\"if not SHA1 then\\\
  364. if not os.loadAPI(\\\"/disk/api/SHA1\\\") then\\\
  365.  error(\\\"could not load hashing algorithm (SHA1)\\\")\\\
  366. end\\\
  367. end\\\
  368. \\\
  369. shell.run(\\\"clear\\\")\\\
  370. write(\\\"Initializing ReactOS installer\\\")\\\
  371. textutils.slowPrint(\\\"...\\\")\\\
  372. \\\
  373. sleep(0.5)\\\
  374. shell.run(\\\"clear\\\")\\\
  375. print([[\\\
  376. ReactOS Installer\\\
  377. ===================================================\\\
  378. \\\
  379. Welcome to the ReactOS Installer.\\\
  380. This program will install ReactOS on your computer.\\\
  381. \\\
  382. Be advised: ReactOS includes measures to prevent\\\
  383. illegal use of the software. We are not responsible\\\
  384. for any damage done to your computer during\\\
  385. installation or usage of the software.\\\
  386. \\\
  387. Type 'I Agree' to continue.\\\
  388. \\\
  389. \\\
  390. ]])\\\
  391. local input = read()\\\
  392. if input == \\\"I Agree\\\" then\\\
  393. shell.run(\\\"clear\\\")\\\
  394. print(\\\"Copying filesystem\\\")\\\
  395. local dirs = {\\\"api\\\", \\\"system32\\\", \\\".rgaData\\\"}\\\
  396. for i=1,#dirs do\\\
  397. if fs.exists(\\\"/disk/\\\"..dirs[i]) then\\\
  398.  fs.copy(\\\"/disk/\\\"..dirs[i], \\\"/\\\"..dirs[i])\\\
  399.  print(\\\"Copied \\\"..dirs[i])\\\
  400. else\\\
  401.  error(\\\"Installation failed, files missing\\\")\\\
  402. end\\\
  403. end\\\
  404. fs.copy(\\\"/disk/start\\\", \\\"/startup\\\")\\\
  405. fs.copy(\\\"/disk/.mbr\\\", \\\"/.mbr\\\")\\\
  406. fs.copy(\\\"/disk/.setalias\\\", \\\"/.setalias\\\")\\\
  407. print(\\\"Please type in the registration key you got earlier.\\\")\\\
  408. print(\\\" \\\")\\\
  409. local in2 = read()\\\
  410. local dig = SHA1.digestStr(\\\"Reactor\\\")\\\
  411. while true do\\\
  412. if in2 == \\\"1436601872\\\" then\\\
  413.  print(\\\"Registration key accepted\\\")\\\
  414.  print(\\\"Updating registration data\\\")\\\
  415.  fs.delete(\\\"/.rgaData/inactive\\\")\\\
  416.  fs.move(\\\"/.rgaData/active\\\", \\\"/.rgaData/rga\\\")\\\
  417.  local text = textutils.serialize(SHA1.digestStr(\\\"ReactOS_GenuineKey\\\"))\\\
  418.  print(\\\"Writing system certificate\\\")\\\
  419.  fs.copy(\\\"/disk/.rgaKey\\\", \\\"/.rgaKey\\\")\\\
  420.  os.reboot()\\\
  421. -- elseif in2 == \\\"developer override: show license key\\\" then\\\
  422. --  print(dig[1])\\\
  423. --  return\\\
  424. else\\\
  425.  print(\\\"Registration key invalid. Trial mode is active\\\")\\\
  426.  fs.delete(\\\"/.rgaData/active\\\")\\\
  427.  fs.move(\\\"/.rgaData/inactive\\\", \\\"/.rgaData/rga\\\") \\\
  428.  local tb = textutils.serialize(SHA1.digestStr(\\\"ReactorOS\\\"))\\\
  429.  print(\\\"Writing system certificate\\\")\\\
  430.  local fb = fs.open(\\\"/.rgaKey\\\", \\\"w\\\")\\\
  431.  fb.write(tb)\\\
  432.  fb.close()\\\
  433.  os.reboot()\\\
  434. end\\\
  435. end\\\
  436. end\"",
  437.   "D:system32",
  438.   "{\
  439.  \"F:antimalware\",\
  440.  \"\\\"local defs = {\\\\\\\
  441. [\\\\\\\"File can broadcast data through RedNet\\\\\\\"] = \\\\\\\"rednet.broadcast\\\\\\\",\\\\\\\
  442. [\\\\\\\"File can use modems to transmit data\\\\\\\"] = \\\\\\\"modem.transmit\\\\\\\",\\\\\\\
  443. [\\\\\\\"File can run a program using a custom environment\\\\\\\"] = \\\\\\\"os.run\\\\\\\",\\\\\\\
  444. [\\\\\\\"File can resist force termination\\\\\\\"] = \\\\\\\"os.pullEvent = os.pullEventRaw\\\\\\\",\\\\\\\
  445. [\\\\\\\"File can call for events\\\\\\\"] = \\\\\\\"os.pullEvent\\\\\\\",\\\\\\\
  446. [\\\\\\\"File can queue events\\\\\\\"] = \\\\\\\"os.queueEvent\\\\\\\",\\\\\\\
  447. [\\\\\\\"File can call for raw events\\\\\\\"] = \\\\\\\"os.pullEventRaw\\\\\\\",\\\\\\\
  448. [\\\\\\\"File can set system path\\\\\\\"] = \\\\\\\"shell.setPath\\\\\\\",\\\\\\\
  449. [\\\\\\\"File can create coroutines\\\\\\\"] = \\\\\\\"coroutine.create\\\\\\\",\\\\\\\
  450. [\\\\\\\"File can run background functions\\\\\\\"] = \\\\\\\"parallel.waitForA\\\\\\\",\\\\\\\
  451. [\\\\\\\"File can resume coroutines\\\\\\\"] = \\\\\\\"coroutine.resume\\\\\\\",\\\\\\\
  452. [\\\\\\\"File can use HTTP API to receive data\\\\\\\"] = \\\\\\\"http.get\\\\\\\",\\\\\\\
  453. [\\\\\\\"File can change runtime environments\\\\\\\"] = \\\\\\\"setfenv\\\\\\\",\\\\\\\
  454. [\\\\\\\"File can set metatables\\\\\\\"] = \\\\\\\"setmetatable\\\\\\\",\\\\\\\
  455. }\\\\\\\
  456. \\\\\\\
  457. local err = {\\\\\\\
  458. [\\\\\\\"0x0001\\\\\\\"] = \\\\\\\"Unable to find target file\\\\\\\",\\\\\\\
  459. [\\\\\\\"0x0002\\\\\\\"] = \\\\\\\"Access to file denied\\\\\\\",\\\\\\\
  460. [\\\\\\\"0x0003\\\\\\\"] = \\\\\\\"ReactOS is not activated\\\\\\\",\\\\\\\
  461. }\\\\\\\
  462. \\\\\\\
  463. local amArgs = {...}\\\\\\\
  464. local file = nil\\\\\\\
  465. local contents = nil\\\\\\\
  466. local points = 0\\\\\\\
  467. \\\\\\\
  468. function check()\\\\\\\
  469. if not rga.isActivated then\\\\\\\
  470.  return false, \\\\\\\"0x0003\\\\\\\"\\\\\\\
  471. elseif #amArgs < 1 then\\\\\\\
  472.  return false, \\\\\\\"0x0001\\\\\\\"\\\\\\\
  473. else\\\\\\\
  474.  for _, val in pairs(files.listEdit) do\\\\\\\
  475.   if string.find(amArgs[1], val) then\\\\\\\
  476.    return false, \\\\\\\"0x0002\\\\\\\"\\\\\\\
  477.   else\\\\\\\
  478.    return true, nil\\\\\\\
  479.   end\\\\\\\
  480.  end\\\\\\\
  481. end\\\\\\\
  482. end\\\\\\\
  483. \\\\\\\
  484. function draw()\\\\\\\
  485. shell.run(\\\\\\\"clear\\\\\\\")\\\\\\\
  486. print(\\\\\\\"ReactOS AntiMalware\\\\\\\")\\\\\\\
  487. print(\\\\\\\"___________________________________________________\\\\\\\")\\\\\\\
  488. print(\\\\\\\" \\\\\\\")\\\\\\\
  489. end\\\\\\\
  490. \\\\\\\
  491. function scan()\\\\\\\
  492. print(\\\\\\\"Checking \\\\\\\"..amArgs[1])\\\\\\\
  493. if fs.exists(amArgs[1]) then\\\\\\\
  494.  file = fs.open(amArgs[1], \\\\\\\"r\\\\\\\")\\\\\\\
  495.  contents = file.readAll()\\\\\\\
  496.  file.close()\\\\\\\
  497.  for k, v in pairs(defs) do\\\\\\\
  498.   if string.find(contents, v) then\\\\\\\
  499.    printError(k)\\\\\\\
  500.    points = points + 1\\\\\\\
  501.   end\\\\\\\
  502.  end\\\\\\\
  503.  print(\\\\\\\"Done! Found \\\\\\\"..points..\\\\\\\" suspicious functions\\\\\\\")\\\\\\\
  504. else\\\\\\\
  505.  printError(\\\\\\\"File does not exist!\\\\\\\")\\\\\\\
  506.  return false, \\\\\\\"0x0001\\\\\\\"\\\\\\\
  507. end\\\\\\\
  508. end\\\\\\\
  509. \\\\\\\
  510. draw()\\\\\\\
  511. local result, error = check()\\\\\\\
  512. if result ~= true and error ~= nil then\\\\\\\
  513. for ke,va in pairs(err) do\\\\\\\
  514.  if ke == error then\\\\\\\
  515.   printError(ke..\\\\\\\": \\\\\\\"..va)\\\\\\\
  516.   return\\\\\\\
  517.  end\\\\\\\
  518. end\\\\\\\
  519. end\\\\\\\
  520. draw()\\\\\\\
  521. scan()\\\\\\\
  522. \\\"\",\
  523.  \"F:cmd\",\
  524.  \"\\\"\\\\\\\
  525. local parentShell = shell\\\\\\\
  526. \\\\\\\
  527. local bExit = false\\\\\\\
  528. local sDir = (parentShell and parentShell.dir()) or \\\\\\\"\\\\\\\"\\\\\\\
  529. local sPath = (parentShell and parentShell.path()) or \\\\\\\".:/rom/programs\\\\\\\"\\\\\\\
  530. local tAliases = (parentShell and parentShell.aliases()) or {}\\\\\\\
  531. local tProgramStack = {}\\\\\\\
  532. \\\\\\\
  533. local shell = {}\\\\\\\
  534. local tEnv = {\\\\\\\
  535. \\\\9[\\\\\\\"shell\\\\\\\"] = shell,\\\\\\\
  536. }\\\\\\\
  537. \\\\\\\
  538. -- Colours\\\\\\\
  539. local promptColour, textColour, bgColour\\\\\\\
  540. if term.isColour() then\\\\\\\
  541. \\\\9promptColour = colours.yellow\\\\\\\
  542. \\\\9textColour = colours.white\\\\\\\
  543. \\\\9bgColour = colours.black\\\\\\\
  544. else\\\\\\\
  545. \\\\9promptColour = colours.white\\\\\\\
  546. \\\\9textColour = colours.white\\\\\\\
  547. \\\\9bgColour = colours.black\\\\\\\
  548. end\\\\\\\
  549. \\\\\\\
  550. \\\\\\\
  551. local function run( _sCommand, ... )\\\\\\\
  552. \\\\9local sPath = shell.resolveProgram( _sCommand )\\\\\\\
  553. \\\\9if sPath ~= nil then\\\\\\\
  554. \\\\9\\\\9tProgramStack[#tProgramStack + 1] = sPath\\\\\\\
  555.   \\\\9\\\\9local result = os.run( tEnv, sPath, ... )\\\\\\\
  556. \\\\9\\\\9tProgramStack[#tProgramStack] = nil\\\\\\\
  557. \\\\9\\\\9return result\\\\\\\
  558.   \\\\9else\\\\\\\
  559.    \\\\9printError( \\\\\\\"No such program\\\\\\\" )\\\\\\\
  560.    \\\\9return false\\\\\\\
  561.    end\\\\\\\
  562. end\\\\\\\
  563. \\\\\\\
  564. local function runLine( _sLine )\\\\\\\
  565. \\\\9local tWords = {}\\\\\\\
  566. \\\\9for match in string.gmatch( _sLine, \\\\\\\"[^ \\\\\\\\t]+\\\\\\\" ) do\\\\\\\
  567. \\\\9\\\\9table.insert( tWords, match )\\\\\\\
  568. \\\\9end\\\\\\\
  569. \\\\\\\
  570. \\\\9local sCommand = tWords[1]\\\\\\\
  571. \\\\9if sCommand then\\\\\\\
  572. \\\\9\\\\9return run( sCommand, unpack( tWords, 2 ) )\\\\\\\
  573. \\\\9end\\\\\\\
  574. \\\\9return false\\\\\\\
  575. end\\\\\\\
  576. \\\\\\\
  577. -- Install shell API\\\\\\\
  578. function shell.run( ... )\\\\\\\
  579. \\\\9return runLine( table.concat( { ... }, \\\\\\\" \\\\\\\" ) )\\\\\\\
  580. end\\\\\\\
  581. \\\\\\\
  582. function shell.exit()\\\\\\\
  583.    bExit = true\\\\\\\
  584. end\\\\\\\
  585. \\\\\\\
  586. function shell.dir()\\\\\\\
  587. \\\\9return sDir\\\\\\\
  588. end\\\\\\\
  589. \\\\\\\
  590. function shell.setDir( _sDir )\\\\\\\
  591. \\\\9sDir = _sDir\\\\\\\
  592. end\\\\\\\
  593. \\\\\\\
  594. function shell.path()\\\\\\\
  595. \\\\9return sPath\\\\\\\
  596. end\\\\\\\
  597. \\\\\\\
  598. function shell.setPath( _sPath )\\\\\\\
  599. \\\\9sPath = _sPath\\\\\\\
  600. end\\\\\\\
  601. \\\\\\\
  602. function shell.resolve( _sPath )\\\\\\\
  603. \\\\9local sStartChar = string.sub( _sPath, 1, 1 )\\\\\\\
  604. \\\\9if sStartChar == \\\\\\\"/\\\\\\\" or sStartChar == \\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\" then\\\\\\\
  605. \\\\9\\\\9return fs.combine( \\\\\\\"\\\\\\\", _sPath )\\\\\\\
  606. \\\\9else\\\\\\\
  607. \\\\9\\\\9return fs.combine( sDir, _sPath )\\\\\\\
  608. \\\\9end\\\\\\\
  609. end\\\\\\\
  610. \\\\\\\
  611. function shell.resolveProgram( _sCommand )\\\\\\\
  612. \\\\9-- Substitute aliases firsts\\\\\\\
  613. \\\\9if tAliases[ _sCommand ] ~= nil then\\\\\\\
  614. \\\\9\\\\9_sCommand = tAliases[ _sCommand ]\\\\\\\
  615. \\\\9end\\\\\\\
  616. \\\\\\\
  617.    -- If the path is a global path, use it directly\\\\\\\
  618.    local sStartChar = string.sub( _sCommand, 1, 1 )\\\\\\\
  619.    if sStartChar == \\\\\\\"/\\\\\\\" or sStartChar == \\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\" then\\\\\\\
  620.    \\\\9local sPath = fs.combine( \\\\\\\"\\\\\\\", _sCommand )\\\\\\\
  621.    \\\\9if fs.exists( sPath ) and not fs.isDir( sPath ) then\\\\\\\
  622. \\\\9\\\\9\\\\9return sPath\\\\\\\
  623.    \\\\9end\\\\\\\
  624. \\\\9\\\\9return nil\\\\\\\
  625.    end\\\\\\\
  626.    \\\\\\\
  627. \\\\9-- Otherwise, look on the path variable\\\\\\\
  628.    for sPath in string.gmatch(sPath, \\\\\\\"[^:]+\\\\\\\") do\\\\\\\
  629.    \\\\9sPath = fs.combine( shell.resolve( sPath ), _sCommand )\\\\\\\
  630.    \\\\9if fs.exists( sPath ) and not fs.isDir( sPath ) then\\\\\\\
  631. \\\\9\\\\9\\\\9return sPath\\\\\\\
  632.    \\\\9end\\\\\\\
  633.    end\\\\\\\
  634. \\\\9\\\\\\\
  635. \\\\9-- Not found\\\\\\\
  636. \\\\9return nil\\\\\\\
  637. end\\\\\\\
  638. \\\\\\\
  639. function shell.programs( _bIncludeHidden )\\\\\\\
  640. \\\\9local tItems = {}\\\\\\\
  641. \\\\9\\\\\\\
  642. \\\\9-- Add programs from the path\\\\\\\
  643.    for sPath in string.gmatch(sPath, \\\\\\\"[^:]+\\\\\\\") do\\\\\\\
  644.    \\\\9sPath = shell.resolve( sPath )\\\\\\\
  645. \\\\9\\\\9if fs.isDir( sPath ) then\\\\\\\
  646. \\\\9\\\\9\\\\9local tList = fs.list( sPath )\\\\\\\
  647. \\\\9\\\\9\\\\9for n,sFile in pairs( tList ) do\\\\\\\
  648. \\\\9\\\\9\\\\9\\\\9if not fs.isDir( fs.combine( sPath, sFile ) ) and\\\\\\\
  649. \\\\9\\\\9\\\\9\\\\9   (_bIncludeHidden or string.sub( sFile, 1, 1 ) ~= \\\\\\\".\\\\\\\") then\\\\\\\
  650. \\\\9\\\\9\\\\9\\\\9\\\\9tItems[ sFile ] = true\\\\\\\
  651. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  652. \\\\9\\\\9\\\\9end\\\\\\\
  653. \\\\9\\\\9end\\\\\\\
  654.    end\\\\9\\\\\\\
  655. \\\\\\\
  656. \\\\9-- Sort and return\\\\\\\
  657. \\\\9local tItemList = {}\\\\\\\
  658. \\\\9for sItem, b in pairs( tItems ) do\\\\\\\
  659. \\\\9\\\\9table.insert( tItemList, sItem )\\\\\\\
  660. \\\\9end\\\\\\\
  661. \\\\9table.sort( tItemList )\\\\\\\
  662. \\\\9return tItemList\\\\\\\
  663. end\\\\\\\
  664. \\\\\\\
  665. function shell.getRunningProgram()\\\\\\\
  666. \\\\9if #tProgramStack > 0 then\\\\\\\
  667. \\\\9\\\\9return tProgramStack[#tProgramStack]\\\\\\\
  668. \\\\9end\\\\\\\
  669. \\\\9return nil\\\\\\\
  670. end\\\\\\\
  671. \\\\\\\
  672. function shell.setAlias( _sCommand, _sProgram )\\\\\\\
  673. \\\\9tAliases[ _sCommand ] = _sProgram\\\\\\\
  674. end\\\\\\\
  675. \\\\\\\
  676. function shell.clearAlias( _sCommand )\\\\\\\
  677. \\\\9tAliases[ _sCommand ] = nil\\\\\\\
  678. end\\\\\\\
  679. \\\\\\\
  680. function shell.aliases()\\\\\\\
  681. \\\\9-- Add aliases\\\\\\\
  682. \\\\9local tCopy = {}\\\\\\\
  683. \\\\9for sAlias, sCommand in pairs( tAliases ) do\\\\\\\
  684. \\\\9\\\\9tCopy[sAlias] = sCommand\\\\\\\
  685. \\\\9end\\\\\\\
  686. \\\\9return tCopy\\\\\\\
  687. end\\\\\\\
  688. \\\\9\\\\\\\
  689. term.setBackgroundColor( bgColour )\\\\\\\
  690. term.setTextColour( promptColour )\\\\\\\
  691. print( \\\\\\\"ReactOS NT v2.4\\\\\\\" )\\\\\\\
  692. term.setTextColour( textColour )\\\\\\\
  693. \\\\\\\
  694. -- If this is the toplevel shell, run the startup programs\\\\\\\
  695. if parentShell == nil then\\\\\\\
  696. \\\\9-- Run the startup from the ROM first\\\\\\\
  697. \\\\9local sRomStartup = shell.resolveProgram( \\\\\\\"/rom/startup\\\\\\\" )\\\\\\\
  698. \\\\9if sRomStartup then\\\\\\\
  699. \\\\9\\\\9shell.run( sRomStartup )\\\\\\\
  700. \\\\9end\\\\\\\
  701. \\\\9\\\\\\\
  702. \\\\9-- Then run the user created startup, from the disks or the root\\\\\\\
  703. \\\\9local sUserStartup = shell.resolveProgram( \\\\\\\"/startup\\\\\\\" )\\\\\\\
  704. \\\\9for n,sSide in pairs( redstone.getSides() ) do\\\\\\\
  705. \\\\9\\\\9if disk.isPresent( sSide ) and disk.hasData( sSide ) then\\\\\\\
  706. \\\\9\\\\9\\\\9local sDiskStartup = shell.resolveProgram( fs.combine(disk.getMountPath( sSide ), \\\\\\\"startup\\\\\\\") )\\\\\\\
  707. \\\\9\\\\9\\\\9if sDiskStartup then\\\\\\\
  708. \\\\9\\\\9\\\\9\\\\9sUserStartup = sDiskStartup\\\\\\\
  709. \\\\9\\\\9\\\\9\\\\9break\\\\\\\
  710. \\\\9\\\\9\\\\9end\\\\\\\
  711. \\\\9\\\\9end\\\\\\\
  712. \\\\9end\\\\\\\
  713. \\\\9\\\\\\\
  714. \\\\9if sUserStartup then\\\\\\\
  715. \\\\9\\\\9shell.run( sUserStartup )\\\\\\\
  716. \\\\9end\\\\\\\
  717. end\\\\\\\
  718. \\\\\\\
  719. -- Run any programs passed in as arguments\\\\\\\
  720. local tArgs = { ... }\\\\\\\
  721. if #tArgs > 0 then\\\\\\\
  722. \\\\9shell.run( ... )\\\\\\\
  723. end\\\\\\\
  724. \\\\\\\
  725. -- Read commands and execute them\\\\\\\
  726. local tCommandHistory = {}\\\\\\\
  727. while not bExit do\\\\\\\
  728. \\\\9term.setBackgroundColor( bgColour )\\\\\\\
  729. \\\\9term.setTextColour( promptColour )\\\\\\\
  730. \\\\9write( shell.dir() .. \\\\\\\"> \\\\\\\" )\\\\\\\
  731. \\\\9term.setTextColour( textColour )\\\\\\\
  732. \\\\\\\
  733. \\\\9local sLine = read( nil, tCommandHistory )\\\\\\\
  734. if string.find(sLine, \\\\\\\"rom/programs/\\\\\\\") then\\\\\\\
  735.  printError(\\\\\\\"Access denied\\\\\\\")\\\\\\\
  736.  return\\\\\\\
  737. end\\\\\\\
  738. \\\\9table.insert( tCommandHistory, sLine )\\\\\\\
  739. \\\\9runLine( sLine )\\\\\\\
  740. end\\\\\\\
  741. \\\\\\\
  742. -- If this is the toplevel shell, run the shutdown program\\\\\\\
  743. if parentShell == nil then\\\\\\\
  744. \\\\9if shell.resolveProgram( \\\\\\\"shutdown\\\\\\\" ) then\\\\\\\
  745. \\\\9\\\\9shell.run( \\\\\\\"shutdown\\\\\\\" )\\\\\\\
  746. \\\\9end\\\\\\\
  747. \\\\9os.shutdown() -- just in case\\\\\\\
  748. end\\\"\",\
  749.  \"F:copy\",\
  750.  \"\\\"\\\\\\\
  751. local tArgs = { ... }\\\\\\\
  752. if #tArgs < 2 then\\\\\\\
  753. \\\\9print( \\\\\\\"Usage: cp <source> <destination>\\\\\\\" )\\\\\\\
  754. \\\\9return\\\\\\\
  755. end\\\\\\\
  756. \\\\\\\
  757. local sSource = shell.resolve( tArgs[1] )\\\\\\\
  758. local sDest = shell.resolve( tArgs[2] )\\\\\\\
  759. if fs.exists( sDest ) and fs.isDir( sDest ) then\\\\\\\
  760. \\\\9sDest = fs.combine( sDest, fs.getName(sSource) )\\\\\\\
  761. end\\\\\\\
  762. \\\\\\\
  763. for _, value in pairs(files.list) do\\\\\\\
  764. if string.find(sSource, value) then\\\\\\\
  765.  error(\\\\\\\"access to system files is denied\\\\\\\")\\\\\\\
  766. end\\\\\\\
  767. end\\\\\\\
  768. \\\\\\\
  769. fs.copy( sSource, sDest )\\\"\",\
  770.  \"F:delete\",\
  771.  \"\\\"\\\\\\\
  772. local tArgs = { ... }\\\\\\\
  773. if #tArgs < 1 then\\\\\\\
  774. \\\\9print( \\\\\\\"Usage: rm <path>\\\\\\\" )\\\\\\\
  775. \\\\9return\\\\\\\
  776. end\\\\\\\
  777. \\\\\\\
  778. local sNewPath = shell.resolve( tArgs[1] )\\\\\\\
  779. \\\\\\\
  780. for _, value in pairs(files.list) do\\\\\\\
  781. if string.find(sNewPath, value) then\\\\\\\
  782.  error(\\\\\\\"cannot remove system files\\\\\\\")\\\\\\\
  783. end\\\\\\\
  784. end\\\\\\\
  785. \\\\\\\
  786. fs.delete( sNewPath )\\\"\",\
  787.  \"F:edit\",\
  788.  \"\\\"local tArgs = { ... }\\\\\\\
  789. if #tArgs == 0 then\\\\\\\
  790. \\\\9printError( \\\\\\\"Usage: edit <path>\\\\\\\" )\\\\\\\
  791. \\\\9return\\\\\\\
  792. end\\\\\\\
  793. \\\\\\\
  794. local sPath = shell.resolve( tArgs[1] )\\\\\\\
  795. local bReadOnly = fs.isReadOnly( sPath )\\\\\\\
  796. if fs.exists( sPath ) and fs.isDir( sPath ) then\\\\\\\
  797. \\\\9printError( \\\\\\\"KodiCo Editor cannot edit this directory.\\\\\\\" )\\\\\\\
  798. \\\\9return\\\\\\\
  799. elseif string.find( sPath, \\\\\\\"startup\\\\\\\" ) and rga.isActivated == false then\\\\\\\
  800. printError(\\\\\\\"Access to startup files is denied.\\\\\\\")\\\\\\\
  801. printError(\\\\\\\"Please register your copy of ReactOS.\\\\\\\")\\\\\\\
  802. return\\\\\\\
  803. else\\\\\\\
  804. for _, value in pairs(files.listEdit) do\\\\\\\
  805.  if string.find( sPath, value ) then\\\\\\\
  806.   printError(\\\\\\\"Access to system files is denied.\\\\\\\")\\\\\\\
  807.   return\\\\\\\
  808.  end\\\\\\\
  809. end\\\\\\\
  810. end\\\\\\\
  811. \\\\\\\
  812. local x,y = 1,1\\\\\\\
  813. local w,h = term.getSize()\\\\\\\
  814. local scrollX, scrollY = 0,0\\\\\\\
  815. \\\\\\\
  816. local tLines = {}\\\\\\\
  817. local bRunning = true\\\\\\\
  818. \\\\\\\
  819. local highlightColour, keywordColour, commentColour, textColour, bgColour\\\\\\\
  820. if term.isColour() then\\\\\\\
  821. \\\\9bgColour = colours.black\\\\\\\
  822. \\\\9textColour = colours.white\\\\\\\
  823. \\\\9highlightColour = colours.red\\\\\\\
  824. \\\\9keywordColour = colours.yellow\\\\\\\
  825. \\\\9commentColour = colours.lime\\\\\\\
  826. \\\\9stringColour = colours.blue\\\\\\\
  827. else\\\\\\\
  828. \\\\9bgColour = colours.black\\\\\\\
  829. \\\\9textColour = colours.white\\\\\\\
  830. \\\\9highlightColour = colours.white\\\\\\\
  831. \\\\9keywordColour = colours.white\\\\\\\
  832. \\\\9commentColour = colours.white\\\\\\\
  833. \\\\9stringColour = colours.white\\\\\\\
  834. end\\\\\\\
  835. \\\\\\\
  836. local bMenu = false\\\\\\\
  837. local nMenuItem = 1\\\\\\\
  838. local tMenuItems = {\\\\\\\"Save\\\\\\\", \\\\\\\"Exit\\\\\\\", \\\\\\\"Print\\\\\\\"}\\\\\\\
  839. local sStatus = \\\\\\\"Press CTRL to access editor menu.\\\\\\\"\\\\\\\
  840. \\\\\\\
  841. local function load(_sPath)\\\\\\\
  842. \\\\9tLines = {}\\\\\\\
  843. \\\\9if fs.exists( _sPath ) then\\\\\\\
  844. \\\\9\\\\9local file = io.open( _sPath, \\\\\\\"r\\\\\\\" )\\\\\\\
  845. \\\\9\\\\9local sLine = file:read()\\\\\\\
  846. \\\\9\\\\9while sLine do\\\\\\\
  847. \\\\9\\\\9\\\\9table.insert( tLines, sLine )\\\\\\\
  848. \\\\9\\\\9\\\\9sLine = file:read()\\\\\\\
  849. \\\\9\\\\9end\\\\\\\
  850. \\\\9\\\\9file:close()\\\\\\\
  851. \\\\9end\\\\\\\
  852. \\\\9\\\\\\\
  853. \\\\9if #tLines == 0 then\\\\\\\
  854. \\\\9\\\\9table.insert( tLines, \\\\\\\"\\\\\\\" )\\\\\\\
  855. \\\\9end\\\\\\\
  856. end\\\\\\\
  857. \\\\\\\
  858. local function save( _sPath )\\\\\\\
  859. \\\\9-- Create intervening folder\\\\\\\
  860. \\\\9local sDir = sPath:sub(1, sPath:len() - fs.getName(sPath):len() )\\\\\\\
  861. \\\\9if not fs.exists( sDir ) then\\\\\\\
  862. \\\\9\\\\9fs.makeDir( sDir )\\\\\\\
  863. \\\\9end\\\\\\\
  864. \\\\\\\
  865. \\\\9-- Save\\\\\\\
  866. \\\\9local file = nil\\\\\\\
  867. \\\\9local function innerSave()\\\\\\\
  868. \\\\9\\\\9file = fs.open( _sPath, \\\\\\\"w\\\\\\\" )\\\\\\\
  869. \\\\9\\\\9if file then\\\\\\\
  870. \\\\9\\\\9\\\\9for n, sLine in ipairs( tLines ) do\\\\\\\
  871. \\\\9\\\\9\\\\9\\\\9file.write( sLine .. \\\\\\\"\\\\\\\\n\\\\\\\" )\\\\\\\
  872. \\\\9\\\\9\\\\9end\\\\\\\
  873. \\\\9\\\\9else\\\\\\\
  874. \\\\9\\\\9\\\\9error( \\\\\\\"Failed to open \\\\\\\".._sPath )\\\\\\\
  875. \\\\9\\\\9end\\\\\\\
  876. \\\\9end\\\\\\\
  877. \\\\9\\\\\\\
  878. \\\\9local ok = pcall( innerSave )\\\\\\\
  879. \\\\9if file then \\\\\\\
  880. \\\\9\\\\9file.close()\\\\\\\
  881. \\\\9end\\\\\\\
  882. \\\\9return ok\\\\\\\
  883. end\\\\\\\
  884. \\\\\\\
  885. local tKeywords = {\\\\\\\
  886. \\\\9[\\\\\\\"and\\\\\\\"] = true,\\\\\\\
  887. \\\\9[\\\\\\\"break\\\\\\\"] = true,\\\\\\\
  888. \\\\9[\\\\\\\"do\\\\\\\"] = true,\\\\\\\
  889. \\\\9[\\\\\\\"else\\\\\\\"] = true,\\\\\\\
  890. \\\\9[\\\\\\\"elseif\\\\\\\"] = true,\\\\\\\
  891. \\\\9[\\\\\\\"end\\\\\\\"] = true,\\\\\\\
  892. \\\\9[\\\\\\\"false\\\\\\\"] = true,\\\\\\\
  893. \\\\9[\\\\\\\"for\\\\\\\"] = true,\\\\\\\
  894. \\\\9[\\\\\\\"function\\\\\\\"] = true,\\\\\\\
  895. \\\\9[\\\\\\\"if\\\\\\\"] = true,\\\\\\\
  896. \\\\9[\\\\\\\"in\\\\\\\"] = true,\\\\\\\
  897. \\\\9[\\\\\\\"local\\\\\\\"] = true,\\\\\\\
  898. \\\\9[\\\\\\\"nil\\\\\\\"] = true,\\\\\\\
  899. \\\\9[\\\\\\\"not\\\\\\\"] = true,\\\\\\\
  900. \\\\9[\\\\\\\"or\\\\\\\"] = true,\\\\\\\
  901. \\\\9[\\\\\\\"repeat\\\\\\\"] = true,\\\\\\\
  902. \\\\9[\\\\\\\"return\\\\\\\"] = true,\\\\\\\
  903. \\\\9[\\\\\\\"then\\\\\\\"] = true,\\\\\\\
  904. \\\\9[\\\\\\\"true\\\\\\\"] = true,\\\\\\\
  905. \\\\9[\\\\\\\"until\\\\\\\"]= true,\\\\\\\
  906. \\\\9[\\\\\\\"while\\\\\\\"] = true,\\\\\\\
  907. [\\\\\\\"pairs\\\\\\\"] = true,\\\\\\\
  908. [\\\\\\\"ipairs\\\\\\\"] = true,\\\\\\\
  909. }\\\\\\\
  910. \\\\\\\
  911. local function tryWrite( sLine, regex, colour )\\\\\\\
  912. \\\\9local match = string.match( sLine, regex )\\\\\\\
  913. \\\\9if match then\\\\\\\
  914. \\\\9\\\\9if type(colour) == \\\\\\\"number\\\\\\\" then\\\\\\\
  915. \\\\9\\\\9\\\\9term.setTextColour( colour )\\\\\\\
  916. \\\\9\\\\9else\\\\\\\
  917. \\\\9\\\\9\\\\9term.setTextColour( colour(match) )\\\\\\\
  918. \\\\9\\\\9end\\\\\\\
  919. \\\\9\\\\9term.write( match )\\\\\\\
  920. \\\\9\\\\9term.setTextColour( textColour )\\\\\\\
  921. \\\\9\\\\9return string.sub( sLine, string.len(match) + 1 )\\\\\\\
  922. \\\\9end\\\\\\\
  923. \\\\9return nil\\\\\\\
  924. end\\\\\\\
  925. \\\\\\\
  926. local function writeHighlighted( sLine )\\\\\\\
  927. \\\\9while string.len(sLine) > 0 do\\\\9\\\\\\\
  928. \\\\9\\\\9sLine = \\\\\\\
  929. \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^%-%-%[%[.-%]%]\\\\\\\", commentColour ) or\\\\\\\
  930. \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^%-%-.*\\\\\\\", commentColour ) or\\\\\\\
  931. \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^\\\\\\\\\\\\\\\".-[^\\\\\\\\\\\\\\\\]\\\\\\\\\\\\\\\"\\\\\\\", stringColour ) or\\\\\\\
  932. \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^\\\\\\\\'.-[^\\\\\\\\\\\\\\\\]\\\\\\\\'\\\\\\\", stringColour ) or\\\\\\\
  933. \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^%[%[.-%]%]\\\\\\\", stringColour ) or\\\\\\\
  934. \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^[%w_]+\\\\\\\", function( match )\\\\\\\
  935. \\\\9\\\\9\\\\9\\\\9if tKeywords[ match ] then\\\\\\\
  936. \\\\9\\\\9\\\\9\\\\9\\\\9return keywordColour\\\\\\\
  937. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  938. \\\\9\\\\9\\\\9\\\\9return textColour\\\\\\\
  939. \\\\9\\\\9\\\\9end ) or\\\\\\\
  940. \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^[^%w_]\\\\\\\", textColour )\\\\\\\
  941. \\\\9end\\\\\\\
  942. end\\\\\\\
  943. \\\\\\\
  944. local function redrawText()\\\\\\\
  945. \\\\9for y=1,h-1 do\\\\\\\
  946. \\\\9\\\\9term.setCursorPos( 1 - scrollX, y )\\\\\\\
  947. \\\\9\\\\9term.clearLine()\\\\\\\
  948. \\\\\\\
  949. \\\\9\\\\9local sLine = tLines[ y + scrollY ]\\\\\\\
  950. \\\\9\\\\9if sLine ~= nil then\\\\\\\
  951. \\\\9\\\\9\\\\9writeHighlighted( sLine )\\\\\\\
  952. \\\\9\\\\9end\\\\\\\
  953. \\\\9end\\\\\\\
  954. \\\\9term.setCursorPos( x - scrollX, y - scrollY )\\\\\\\
  955. end\\\\\\\
  956. \\\\\\\
  957. local function redrawLine(_nY)\\\\\\\
  958. \\\\9local sLine = tLines[_nY]\\\\\\\
  959. \\\\9term.setCursorPos( 1 - scrollX, _nY - scrollY )\\\\\\\
  960. \\\\9term.clearLine()\\\\\\\
  961. \\\\9writeHighlighted( sLine )\\\\\\\
  962. \\\\9term.setCursorPos( x - scrollX, _nY - scrollY )\\\\\\\
  963. end\\\\\\\
  964. \\\\\\\
  965. local function setLeftStatus()\\\\\\\
  966. end\\\\\\\
  967. \\\\\\\
  968. local function redrawMenu()\\\\\\\
  969.    term.setCursorPos( 1, h )\\\\\\\
  970. \\\\9term.clearLine()\\\\\\\
  971. \\\\\\\
  972. \\\\9local sLeft, sRight\\\\\\\
  973. \\\\9local nLeftColour, nLeftHighlight1, nLeftHighlight2\\\\\\\
  974. \\\\9if bMenu then\\\\\\\
  975. \\\\9\\\\9local sMenu = \\\\\\\"\\\\\\\"\\\\\\\
  976. \\\\9\\\\9for n,sItem in ipairs( tMenuItems ) do\\\\\\\
  977. \\\\9\\\\9\\\\9if n == nMenuItem then\\\\\\\
  978. \\\\9\\\\9\\\\9\\\\9nLeftHighlight1 = sMenu:len() + 1\\\\\\\
  979. \\\\9\\\\9\\\\9\\\\9nLeftHighlight2 = sMenu:len() + sItem:len() + 2\\\\\\\
  980. \\\\9\\\\9\\\\9end\\\\\\\
  981. \\\\9\\\\9\\\\9sMenu = sMenu..\\\\\\\" \\\\\\\"..sItem..\\\\\\\" \\\\\\\"\\\\\\\
  982. \\\\9\\\\9end\\\\\\\
  983. \\\\9\\\\9sLeft = sMenu\\\\\\\
  984. \\\\9\\\\9nLeftColour = textColour\\\\\\\
  985. \\\\9else\\\\\\\
  986. \\\\9\\\\9sLeft = sStatus\\\\\\\
  987. \\\\9\\\\9nLeftColour = highlightColour\\\\\\\
  988. \\\\9end\\\\\\\
  989. \\\\9\\\\\\\
  990. \\\\9-- Left goes last so that it can overwrite the line numbers.\\\\\\\
  991. \\\\9sRight = \\\\\\\"Ln \\\\\\\"..y\\\\\\\
  992. \\\\9term.setTextColour( highlightColour )\\\\\\\
  993. \\\\9term.setCursorPos( w-sRight:len() + 1, h )\\\\\\\
  994. \\\\9term.write(sRight)\\\\\\\
  995. \\\\\\\
  996. \\\\9sRight = tostring(y)\\\\\\\
  997. \\\\9term.setTextColour( textColour )\\\\\\\
  998. \\\\9term.setCursorPos( w-sRight:len() + 1, h )\\\\\\\
  999. \\\\9term.write(sRight)\\\\\\\
  1000. \\\\\\\
  1001. \\\\9if sLeft then\\\\\\\
  1002. \\\\9\\\\9term.setCursorPos( 1, h )\\\\\\\
  1003. \\\\9\\\\9term.setTextColour( nLeftColour )\\\\\\\
  1004. \\\\9\\\\9term.write(sLeft)\\\\9\\\\9\\\\\\\
  1005. \\\\9\\\\9if nLeftHighlight1 then\\\\\\\
  1006. \\\\9\\\\9\\\\9term.setTextColour( highlightColour )\\\\\\\
  1007. \\\\9\\\\9\\\\9term.setCursorPos( nLeftHighlight1, h )\\\\\\\
  1008. \\\\9\\\\9\\\\9term.write( \\\\\\\"[\\\\\\\" )\\\\\\\
  1009. \\\\9\\\\9\\\\9term.setCursorPos( nLeftHighlight2, h )\\\\\\\
  1010. \\\\9\\\\9\\\\9term.write( \\\\\\\"]\\\\\\\" )\\\\\\\
  1011. \\\\9\\\\9end\\\\\\\
  1012. \\\\9\\\\9term.setTextColour( textColour )\\\\\\\
  1013. \\\\9end\\\\\\\
  1014. \\\\9\\\\\\\
  1015. \\\\9-- Cursor highlights selection\\\\\\\
  1016. \\\\9term.setCursorPos( x - scrollX, y - scrollY )\\\\\\\
  1017. end\\\\\\\
  1018. \\\\\\\
  1019. local tMenuFuncs = { \\\\\\\
  1020. \\\\9Save=function()\\\\\\\
  1021. \\\\9\\\\9if bReadOnly then\\\\\\\
  1022. \\\\9\\\\9\\\\9sStatus = \\\\\\\"Access denied\\\\\\\"\\\\\\\
  1023. \\\\9\\\\9else\\\\\\\
  1024. \\\\9\\\\9\\\\9local ok, err = save( sPath )\\\\\\\
  1025. \\\\9\\\\9\\\\9if ok then\\\\\\\
  1026. \\\\9\\\\9\\\\9\\\\9sStatus=\\\\\\\"Saved to \\\\\\\"..sPath\\\\\\\
  1027. \\\\9\\\\9\\\\9else\\\\\\\
  1028. \\\\9\\\\9\\\\9\\\\9sStatus=\\\\\\\"Error saving to \\\\\\\"..sPath\\\\\\\
  1029. \\\\9\\\\9\\\\9end\\\\\\\
  1030. \\\\9\\\\9end\\\\\\\
  1031. \\\\9\\\\9redrawMenu()\\\\\\\
  1032. \\\\9end,\\\\\\\
  1033. \\\\9Print=function()\\\\\\\
  1034. \\\\9\\\\9local sPrinterSide = nil\\\\\\\
  1035. \\\\9\\\\9for n,sSide in ipairs(rs.getSides()) do\\\\\\\
  1036. \\\\9\\\\9\\\\9if peripheral.isPresent(sSide) and peripheral.getType(sSide) == \\\\\\\"printer\\\\\\\" then\\\\\\\
  1037. \\\\9\\\\9\\\\9\\\\9sPrinterSide = sSide\\\\\\\
  1038. \\\\9\\\\9\\\\9\\\\9break\\\\\\\
  1039. \\\\9\\\\9\\\\9end\\\\\\\
  1040. \\\\9\\\\9end\\\\\\\
  1041. \\\\9\\\\9\\\\\\\
  1042. \\\\9\\\\9if not sPrinterSide then\\\\\\\
  1043. \\\\9\\\\9\\\\9sStatus = \\\\\\\"No printer attached\\\\\\\"\\\\\\\
  1044. \\\\9\\\\9\\\\9return\\\\\\\
  1045. \\\\9\\\\9end\\\\\\\
  1046. \\\\\\\
  1047. \\\\9\\\\9local nPage = 0\\\\\\\
  1048. \\\\9\\\\9local sName = fs.getName( sPath )\\\\\\\
  1049. \\\\9\\\\9local printer = peripheral.wrap(sPrinterSide)\\\\\\\
  1050. \\\\9\\\\9if printer.getInkLevel() < 1 then\\\\\\\
  1051. \\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer out of ink\\\\\\\"\\\\\\\
  1052. \\\\9\\\\9\\\\9return\\\\\\\
  1053. \\\\9\\\\9elseif printer.getPaperLevel() < 1 then\\\\\\\
  1054. \\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer out of paper\\\\\\\"\\\\\\\
  1055. \\\\9\\\\9\\\\9return\\\\\\\
  1056. \\\\9\\\\9end\\\\\\\
  1057. \\\\9\\\\9\\\\\\\
  1058. \\\\9\\\\9local terminal = {\\\\\\\
  1059. \\\\9\\\\9\\\\9getCursorPos = printer.getCursorPos,\\\\\\\
  1060. \\\\9\\\\9\\\\9setCursorPos = printer.setCursorPos,\\\\\\\
  1061. \\\\9\\\\9\\\\9getSize = printer.getPageSize,\\\\\\\
  1062. \\\\9\\\\9\\\\9write = printer.write,\\\\\\\
  1063. \\\\9\\\\9}\\\\\\\
  1064. \\\\9\\\\9terminal.scroll = function()\\\\\\\
  1065. \\\\9\\\\9\\\\9if nPage == 1 then\\\\\\\
  1066. \\\\9\\\\9\\\\9\\\\9printer.setPageTitle( sName..\\\\\\\" (page \\\\\\\"..nPage..\\\\\\\")\\\\\\\" )\\\\9\\\\9\\\\9\\\\\\\
  1067. \\\\9\\\\9\\\\9end\\\\\\\
  1068. \\\\9\\\\9\\\\9\\\\\\\
  1069. \\\\9\\\\9\\\\9while not printer.newPage()\\\\9do\\\\\\\
  1070. \\\\9\\\\9\\\\9\\\\9if printer.getInkLevel() < 1 then\\\\\\\
  1071. \\\\9\\\\9\\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer out of ink, please refill\\\\\\\"\\\\\\\
  1072. \\\\9\\\\9\\\\9\\\\9elseif printer.getPaperLevel() < 1 then\\\\\\\
  1073. \\\\9\\\\9\\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer out of paper, please refill\\\\\\\"\\\\\\\
  1074. \\\\9\\\\9\\\\9\\\\9else\\\\\\\
  1075. \\\\9\\\\9\\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer output tray full, please empty\\\\\\\"\\\\\\\
  1076. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1077. \\\\9\\\\\\\
  1078. \\\\9\\\\9\\\\9\\\\9term.restore()\\\\\\\
  1079. \\\\9\\\\9\\\\9\\\\9redrawMenu()\\\\\\\
  1080. \\\\9\\\\9\\\\9\\\\9term.redirect( terminal )\\\\\\\
  1081. \\\\9\\\\9\\\\9\\\\9\\\\\\\
  1082. \\\\9\\\\9\\\\9\\\\9local timer = os.startTimer(0.5)\\\\\\\
  1083. \\\\9\\\\9\\\\9\\\\9sleep(0.5)\\\\\\\
  1084. \\\\9\\\\9\\\\9end\\\\\\\
  1085. \\\\\\\
  1086. \\\\9\\\\9\\\\9nPage = nPage + 1\\\\\\\
  1087. \\\\9\\\\9\\\\9if nPage == 1 then\\\\\\\
  1088. \\\\9\\\\9\\\\9\\\\9printer.setPageTitle( sName )\\\\\\\
  1089. \\\\9\\\\9\\\\9else\\\\\\\
  1090. \\\\9\\\\9\\\\9\\\\9printer.setPageTitle( sName..\\\\\\\" (page \\\\\\\"..nPage..\\\\\\\")\\\\\\\" )\\\\\\\
  1091. \\\\9\\\\9\\\\9end\\\\\\\
  1092. \\\\9\\\\9end\\\\\\\
  1093. \\\\9\\\\9\\\\\\\
  1094. \\\\9\\\\9bMenu = false\\\\\\\
  1095. \\\\9\\\\9term.redirect( terminal )\\\\\\\
  1096. \\\\9\\\\9local ok, error = pcall( function()\\\\\\\
  1097. \\\\9\\\\9\\\\9term.scroll()\\\\\\\
  1098. \\\\9\\\\9\\\\9for n, sLine in ipairs( tLines ) do\\\\\\\
  1099. \\\\9\\\\9\\\\9\\\\9print( sLine )\\\\\\\
  1100. \\\\9\\\\9\\\\9end\\\\\\\
  1101. \\\\9\\\\9end )\\\\\\\
  1102. \\\\9\\\\9term.restore()\\\\\\\
  1103. \\\\9\\\\9if not ok then\\\\\\\
  1104. \\\\9\\\\9\\\\9print( error )\\\\\\\
  1105. \\\\9\\\\9end\\\\\\\
  1106. \\\\9\\\\9\\\\\\\
  1107. \\\\9\\\\9while not printer.endPage() do\\\\\\\
  1108. \\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer output tray full, please empty\\\\\\\"\\\\\\\
  1109. \\\\9\\\\9\\\\9redrawMenu()\\\\\\\
  1110. \\\\9\\\\9\\\\9sleep( 0.5 )\\\\\\\
  1111. \\\\9\\\\9end\\\\\\\
  1112. \\\\9\\\\9bMenu = true\\\\\\\
  1113. \\\\9\\\\9\\\\9\\\\\\\
  1114. \\\\9\\\\9if nPage > 1 then\\\\\\\
  1115. \\\\9\\\\9\\\\9sStatus = \\\\\\\"Printed \\\\\\\"..nPage..\\\\\\\" Pages\\\\\\\"\\\\\\\
  1116. \\\\9\\\\9else\\\\\\\
  1117. \\\\9\\\\9\\\\9sStatus = \\\\\\\"Printed 1 Page\\\\\\\"\\\\\\\
  1118. \\\\9\\\\9end\\\\\\\
  1119. \\\\9\\\\9redrawMenu()\\\\\\\
  1120. \\\\9end,\\\\\\\
  1121. \\\\9Exit=function()\\\\\\\
  1122. \\\\9\\\\9bRunning = false\\\\\\\
  1123. \\\\9end\\\\\\\
  1124. }\\\\\\\
  1125. \\\\\\\
  1126. local function doMenuItem( _n )\\\\\\\
  1127. \\\\9tMenuFuncs[tMenuItems[_n]]()\\\\\\\
  1128. \\\\9if bMenu then\\\\\\\
  1129. \\\\9\\\\9bMenu = false\\\\\\\
  1130. \\\\9\\\\9term.setCursorBlink( true )\\\\\\\
  1131. \\\\9end\\\\\\\
  1132. \\\\9redrawMenu()\\\\\\\
  1133. end\\\\\\\
  1134. \\\\\\\
  1135. local function setCursor( x, y )\\\\\\\
  1136. \\\\9local screenX = x - scrollX\\\\\\\
  1137. \\\\9local screenY = y - scrollY\\\\\\\
  1138. \\\\9\\\\\\\
  1139. \\\\9local bRedraw = false\\\\\\\
  1140. \\\\9if screenX < 1 then\\\\\\\
  1141. \\\\9\\\\9scrollX = x - 1\\\\\\\
  1142. \\\\9\\\\9screenX = 1\\\\\\\
  1143. \\\\9\\\\9bRedraw = true\\\\\\\
  1144. \\\\9elseif screenX > w then\\\\\\\
  1145. \\\\9\\\\9scrollX = x - w\\\\\\\
  1146. \\\\9\\\\9screenX = w\\\\\\\
  1147. \\\\9\\\\9bRedraw = true\\\\\\\
  1148. \\\\9end\\\\\\\
  1149. \\\\9\\\\\\\
  1150. \\\\9if screenY < 1 then\\\\\\\
  1151. \\\\9\\\\9scrollY = y - 1\\\\\\\
  1152. \\\\9\\\\9screenY = 1\\\\\\\
  1153. \\\\9\\\\9bRedraw = true\\\\\\\
  1154. \\\\9elseif screenY > h-1 then\\\\\\\
  1155. \\\\9\\\\9scrollY = y - (h-1)\\\\\\\
  1156. \\\\9\\\\9screenY = h-1\\\\\\\
  1157. \\\\9\\\\9bRedraw = true\\\\\\\
  1158. \\\\9end\\\\\\\
  1159. \\\\9\\\\\\\
  1160. \\\\9if bRedraw then\\\\\\\
  1161. \\\\9\\\\9redrawText()\\\\\\\
  1162. \\\\9end\\\\\\\
  1163. \\\\9term.setCursorPos( screenX, screenY )\\\\\\\
  1164. \\\\9\\\\\\\
  1165. \\\\9-- Statusbar now pertains to menu, it would probably be safe to redraw the menu on every key event.\\\\\\\
  1166. \\\\9redrawMenu()\\\\\\\
  1167. end\\\\\\\
  1168. \\\\\\\
  1169. -- Actual program functionality begins\\\\\\\
  1170. load(sPath)\\\\\\\
  1171. \\\\\\\
  1172. term.setBackgroundColour( bgColour )\\\\\\\
  1173. term.clear()\\\\\\\
  1174. term.setCursorPos(x,y)\\\\\\\
  1175. term.setCursorBlink( true )\\\\\\\
  1176. \\\\\\\
  1177. redrawText()\\\\\\\
  1178. redrawMenu()\\\\\\\
  1179. \\\\\\\
  1180. -- Handle input\\\\\\\
  1181. while bRunning do\\\\\\\
  1182. \\\\9local sEvent, param, param2, param3 = os.pullEvent()\\\\\\\
  1183. \\\\9if sEvent == \\\\\\\"key\\\\\\\" then\\\\\\\
  1184. \\\\9\\\\9if param == keys.up then\\\\\\\
  1185. \\\\9\\\\9\\\\9-- Up\\\\\\\
  1186. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1187. \\\\9\\\\9\\\\9\\\\9if y > 1 then\\\\\\\
  1188. \\\\9\\\\9\\\\9\\\\9\\\\9-- Move cursor up\\\\\\\
  1189. \\\\9\\\\9\\\\9\\\\9\\\\9y = y - 1\\\\\\\
  1190. \\\\9\\\\9\\\\9\\\\9\\\\9x = math.min( x, string.len( tLines[y] ) + 1 )\\\\\\\
  1191. \\\\9\\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1192. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1193. \\\\9\\\\9\\\\9end\\\\\\\
  1194. \\\\9\\\\9elseif param == keys.down then\\\\\\\
  1195. \\\\9\\\\9\\\\9-- Down\\\\\\\
  1196. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1197. \\\\9\\\\9\\\\9\\\\9-- Move cursor down\\\\\\\
  1198. \\\\9\\\\9\\\\9\\\\9if y < #tLines then\\\\\\\
  1199. \\\\9\\\\9\\\\9\\\\9\\\\9y = y + 1\\\\\\\
  1200. \\\\9\\\\9\\\\9\\\\9\\\\9x = math.min( x, string.len( tLines[y] ) + 1 )\\\\\\\
  1201. \\\\9\\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1202. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1203. \\\\9\\\\9\\\\9end\\\\\\\
  1204. \\\\9\\\\9elseif param == keys.tab then\\\\\\\
  1205. \\\\9\\\\9\\\\9-- Tab\\\\\\\
  1206. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1207. \\\\9\\\\9\\\\9\\\\9local sLine = tLines[y]\\\\\\\
  1208. \\\\\\\
  1209. \\\\9\\\\9\\\\9\\\\9-- Indent line\\\\\\\
  1210. \\\\9\\\\9\\\\9\\\\9-- IN CASE OF INSERT TAB IN PLACE:\\\\\\\
  1211. \\\\9\\\\9\\\\9\\\\9-- tLines[y] = string.sub(sLine,1,x-1) .. \\\\\\\"  \\\\\\\" .. string.sub(sLine,x)\\\\\\\
  1212. \\\\9\\\\9\\\\9\\\\9tLines[y]=\\\\\\\"  \\\\\\\"..tLines[y]\\\\\\\
  1213. \\\\9\\\\9\\\\9\\\\9x = x + 2\\\\\\\
  1214. \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1215. \\\\9\\\\9\\\\9\\\\9redrawLine(y)\\\\\\\
  1216. \\\\9\\\\9\\\\9end\\\\\\\
  1217. \\\\9\\\\9elseif param == keys.pageUp then\\\\\\\
  1218. \\\\9\\\\9\\\\9-- Page Up\\\\\\\
  1219. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1220. \\\\9\\\\9\\\\9\\\\9-- Move up a page\\\\\\\
  1221. \\\\9\\\\9\\\\9\\\\9local sx,sy=term.getSize()\\\\\\\
  1222. \\\\9\\\\9\\\\9\\\\9y=y-sy-1\\\\\\\
  1223. \\\\9\\\\9\\\\9\\\\9if y<1 then\\\\9y=1 end\\\\\\\
  1224. \\\\9\\\\9\\\\9\\\\9x = math.min( x, string.len( tLines[y] ) + 1 )\\\\\\\
  1225. \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1226. \\\\9\\\\9\\\\9end\\\\\\\
  1227. \\\\9\\\\9elseif param == keys.pageDown then\\\\\\\
  1228. \\\\9\\\\9\\\\9-- Page Down\\\\\\\
  1229. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1230. \\\\9\\\\9\\\\9\\\\9-- Move down a page\\\\\\\
  1231. \\\\9\\\\9\\\\9\\\\9local sx,sy=term.getSize()\\\\\\\
  1232. \\\\9\\\\9\\\\9\\\\9if y<#tLines-sy-1 then\\\\\\\
  1233. \\\\9\\\\9\\\\9\\\\9\\\\9y = y+sy-1\\\\\\\
  1234. \\\\9\\\\9\\\\9\\\\9else\\\\\\\
  1235. \\\\9\\\\9\\\\9\\\\9\\\\9y = #tLines\\\\\\\
  1236. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1237. \\\\9\\\\9\\\\9\\\\9x = math.min( x, string.len( tLines[y] ) + 1 )\\\\\\\
  1238. \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1239. \\\\9\\\\9\\\\9end\\\\\\\
  1240. \\\\9\\\\9elseif param == keys.home then\\\\\\\
  1241. \\\\9\\\\9\\\\9-- Home\\\\\\\
  1242. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1243. \\\\9\\\\9\\\\9\\\\9-- Move cursor to the beginning\\\\\\\
  1244. \\\\9\\\\9\\\\9\\\\9x=1\\\\\\\
  1245. \\\\9\\\\9\\\\9\\\\9setCursor(x,y)\\\\\\\
  1246. \\\\9\\\\9\\\\9end\\\\\\\
  1247. \\\\9\\\\9elseif param == keys[\\\\\\\"end\\\\\\\"] then\\\\\\\
  1248. \\\\9\\\\9\\\\9-- End\\\\\\\
  1249. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1250. \\\\9\\\\9\\\\9\\\\9-- Move cursor to the end\\\\\\\
  1251. \\\\9\\\\9\\\\9\\\\9x = string.len( tLines[y] ) + 1\\\\\\\
  1252. \\\\9\\\\9\\\\9\\\\9setCursor(x,y)\\\\\\\
  1253. \\\\9\\\\9\\\\9end\\\\\\\
  1254. \\\\9\\\\9elseif param == keys.left then\\\\\\\
  1255. \\\\9\\\\9\\\\9-- Left\\\\\\\
  1256. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1257. \\\\9\\\\9\\\\9\\\\9if x > 1 then\\\\\\\
  1258. \\\\9\\\\9\\\\9\\\\9\\\\9-- Move cursor left\\\\\\\
  1259. \\\\9\\\\9\\\\9\\\\9\\\\9x = x - 1\\\\\\\
  1260. \\\\9\\\\9\\\\9\\\\9elseif x==1 and y>1 then\\\\\\\
  1261. \\\\9\\\\9\\\\9\\\\9\\\\9x = string.len( tLines[y-1] ) + 1\\\\\\\
  1262. \\\\9\\\\9\\\\9\\\\9\\\\9y = y - 1\\\\\\\
  1263. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1264. \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1265. \\\\9\\\\9\\\\9else\\\\\\\
  1266. \\\\9\\\\9\\\\9\\\\9-- Move menu left\\\\\\\
  1267. \\\\9\\\\9\\\\9\\\\9nMenuItem = nMenuItem - 1\\\\\\\
  1268. \\\\9\\\\9\\\\9\\\\9if nMenuItem < 1 then\\\\\\\
  1269. \\\\9\\\\9\\\\9\\\\9\\\\9nMenuItem = #tMenuItems\\\\\\\
  1270. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1271. \\\\9\\\\9\\\\9\\\\9redrawMenu()\\\\\\\
  1272. \\\\9\\\\9\\\\9end\\\\\\\
  1273. \\\\9\\\\9elseif param == keys.right then\\\\\\\
  1274. \\\\9\\\\9\\\\9-- Right\\\\\\\
  1275. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1276. \\\\9\\\\9\\\\9\\\\9if x < string.len( tLines[y] ) + 1 then\\\\\\\
  1277. \\\\9\\\\9\\\\9\\\\9\\\\9-- Move cursor right\\\\\\\
  1278. \\\\9\\\\9\\\\9\\\\9\\\\9x = x + 1\\\\\\\
  1279. \\\\9\\\\9\\\\9\\\\9elseif x==string.len( tLines[y] ) + 1 and y<#tLines then\\\\\\\
  1280. \\\\9\\\\9\\\\9\\\\9\\\\9x = 1\\\\\\\
  1281. \\\\9\\\\9\\\\9\\\\9\\\\9y = y + 1\\\\\\\
  1282. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1283. \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1284. \\\\9\\\\9\\\\9else\\\\\\\
  1285. \\\\9\\\\9\\\\9\\\\9-- Move menu right\\\\\\\
  1286. \\\\9\\\\9\\\\9\\\\9nMenuItem = nMenuItem + 1\\\\\\\
  1287. \\\\9\\\\9\\\\9\\\\9if nMenuItem > #tMenuItems then\\\\\\\
  1288. \\\\9\\\\9\\\\9\\\\9\\\\9nMenuItem = 1\\\\\\\
  1289. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1290. \\\\9\\\\9\\\\9\\\\9redrawMenu()\\\\\\\
  1291. \\\\9\\\\9\\\\9end\\\\\\\
  1292. \\\\9\\\\9elseif param == keys.delete then\\\\\\\
  1293. \\\\9\\\\9\\\\9-- Delete\\\\\\\
  1294. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1295. \\\\9\\\\9\\\\9\\\\9if  x < string.len( tLines[y] ) + 1 then\\\\\\\
  1296. \\\\9\\\\9\\\\9\\\\9\\\\9local sLine = tLines[y]\\\\\\\
  1297. \\\\9\\\\9\\\\9\\\\9\\\\9tLines[y] = string.sub(sLine,1,x-1) .. string.sub(sLine,x+1)\\\\\\\
  1298. \\\\9\\\\9\\\\9\\\\9\\\\9redrawLine(y)\\\\\\\
  1299. \\\\9\\\\9\\\\9\\\\9elseif y<#tLines then\\\\\\\
  1300. \\\\9\\\\9\\\\9\\\\9\\\\9tLines[y] = tLines[y] .. tLines[y+1]\\\\\\\
  1301. \\\\9\\\\9\\\\9\\\\9\\\\9table.remove( tLines, y+1 )\\\\\\\
  1302. \\\\9\\\\9\\\\9\\\\9\\\\9redrawText()\\\\\\\
  1303. \\\\9\\\\9\\\\9\\\\9\\\\9redrawMenu()\\\\\\\
  1304. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1305. \\\\9\\\\9\\\\9end\\\\\\\
  1306. \\\\9\\\\9elseif param == keys.backspace then\\\\\\\
  1307. \\\\9\\\\9\\\\9-- Backspace\\\\\\\
  1308. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1309. \\\\9\\\\9\\\\9\\\\9if x > 1 then\\\\\\\
  1310. \\\\9\\\\9\\\\9\\\\9\\\\9-- Remove character\\\\\\\
  1311. \\\\9\\\\9\\\\9\\\\9\\\\9local sLine = tLines[y]\\\\\\\
  1312. \\\\9\\\\9\\\\9\\\\9\\\\9tLines[y] = string.sub(sLine,1,x-2) .. string.sub(sLine,x)\\\\\\\
  1313. \\\\9\\\\9\\\\9\\\\9\\\\9redrawLine(y)\\\\\\\
  1314. \\\\9\\\\9\\\\9\\\\\\\
  1315. \\\\9\\\\9\\\\9\\\\9\\\\9x = x - 1\\\\\\\
  1316. \\\\9\\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1317. \\\\9\\\\9\\\\9\\\\9elseif y > 1 then\\\\\\\
  1318. \\\\9\\\\9\\\\9\\\\9\\\\9-- Remove newline\\\\\\\
  1319. \\\\9\\\\9\\\\9\\\\9\\\\9local sPrevLen = string.len( tLines[y-1] )\\\\\\\
  1320. \\\\9\\\\9\\\\9\\\\9\\\\9tLines[y-1] = tLines[y-1] .. tLines[y]\\\\\\\
  1321. \\\\9\\\\9\\\\9\\\\9\\\\9table.remove( tLines, y )\\\\\\\
  1322. \\\\9\\\\9\\\\9\\\\9\\\\9redrawText()\\\\\\\
  1323. \\\\9\\\\9\\\\9\\\\9\\\\\\\
  1324. \\\\9\\\\9\\\\9\\\\9\\\\9x = sPrevLen + 1\\\\\\\
  1325. \\\\9\\\\9\\\\9\\\\9\\\\9y = y - 1\\\\\\\
  1326. \\\\9\\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1327. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1328. \\\\9\\\\9\\\\9end\\\\\\\
  1329. \\\\9\\\\9elseif param == keys.enter then\\\\\\\
  1330. \\\\9\\\\9\\\\9-- Enter\\\\\\\
  1331. \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
  1332. \\\\9\\\\9\\\\9\\\\9-- Newline\\\\\\\
  1333. \\\\9\\\\9\\\\9\\\\9local sLine = tLines[y]\\\\\\\
  1334. \\\\9\\\\9\\\\9\\\\9local _,spaces=string.find(sLine,\\\\\\\"^[ ]+\\\\\\\")\\\\\\\
  1335. \\\\9\\\\9\\\\9\\\\9if not spaces then\\\\\\\
  1336. \\\\9\\\\9\\\\9\\\\9\\\\9spaces=0\\\\\\\
  1337. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1338. \\\\9\\\\9\\\\9\\\\9tLines[y] = string.sub(sLine,1,x-1)\\\\\\\
  1339. \\\\9\\\\9\\\\9\\\\9table.insert( tLines, y+1, string.rep(' ',spaces)..string.sub(sLine,x) )\\\\\\\
  1340. \\\\9\\\\9\\\\9\\\\9redrawText()\\\\\\\
  1341. \\\\9\\\\9\\\\9\\\\\\\
  1342. \\\\9\\\\9\\\\9\\\\9x = spaces+1\\\\\\\
  1343. \\\\9\\\\9\\\\9\\\\9y = y + 1\\\\\\\
  1344. \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1345. \\\\9\\\\9\\\\9else\\\\\\\
  1346. \\\\9\\\\9\\\\9\\\\9-- Menu selection\\\\\\\
  1347. \\\\9\\\\9\\\\9\\\\9doMenuItem( nMenuItem )\\\\\\\
  1348. \\\\9\\\\9\\\\9end\\\\\\\
  1349. \\\\9\\\\9elseif param == keys.leftCtrl or param == keys.rightCtrl then\\\\\\\
  1350. \\\\9\\\\9\\\\9-- Menu toggle\\\\\\\
  1351. \\\\9\\\\9\\\\9bMenu = not bMenu\\\\\\\
  1352. \\\\9\\\\9\\\\9if bMenu then\\\\\\\
  1353. \\\\9\\\\9\\\\9\\\\9term.setCursorBlink( false )\\\\\\\
  1354. \\\\9\\\\9\\\\9\\\\9nMenuItem = 1\\\\\\\
  1355. \\\\9\\\\9\\\\9else\\\\\\\
  1356. \\\\9\\\\9\\\\9\\\\9term.setCursorBlink( true )\\\\\\\
  1357. \\\\9\\\\9\\\\9end\\\\\\\
  1358. \\\\9\\\\9\\\\9redrawMenu()\\\\\\\
  1359. \\\\9\\\\9end\\\\\\\
  1360. \\\\9\\\\9\\\\\\\
  1361. \\\\9elseif sEvent == \\\\\\\"char\\\\\\\" then\\\\\\\
  1362. \\\\9\\\\9if not bMenu then\\\\\\\
  1363. \\\\9\\\\9\\\\9-- Input text\\\\\\\
  1364. \\\\9\\\\9\\\\9local sLine = tLines[y]\\\\\\\
  1365. \\\\9\\\\9\\\\9tLines[y] = string.sub(sLine,1,x-1) .. param .. string.sub(sLine,x)\\\\\\\
  1366. \\\\9\\\\9\\\\9redrawLine(y)\\\\\\\
  1367. \\\\9\\\\9\\\\\\\
  1368. \\\\9\\\\9\\\\9x = x + string.len( param )\\\\\\\
  1369. \\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1370. \\\\9\\\\9else\\\\\\\
  1371. \\\\9\\\\9\\\\9-- Select menu items\\\\\\\
  1372. \\\\9\\\\9\\\\9for n,sMenuItem in ipairs( tMenuItems ) do\\\\\\\
  1373. \\\\9\\\\9\\\\9\\\\9if string.lower(string.sub(sMenuItem,1,1)) == string.lower(param) then\\\\\\\
  1374. \\\\9\\\\9\\\\9\\\\9\\\\9doMenuItem( n )\\\\\\\
  1375. \\\\9\\\\9\\\\9\\\\9\\\\9break\\\\\\\
  1376. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1377. \\\\9\\\\9\\\\9end\\\\\\\
  1378. \\\\9\\\\9end\\\\\\\
  1379. \\\\9\\\\9\\\\\\\
  1380. \\\\9elseif sEvent == \\\\\\\"mouse_click\\\\\\\" then\\\\\\\
  1381. \\\\9\\\\9if not bMenu then\\\\\\\
  1382. \\\\9\\\\9\\\\9if param == 1 then\\\\\\\
  1383. \\\\9\\\\9\\\\9\\\\9-- Left click\\\\\\\
  1384. \\\\9\\\\9\\\\9\\\\9local cx,cy = param2, param3\\\\\\\
  1385. \\\\9\\\\9\\\\9\\\\9if cy < h then\\\\\\\
  1386. \\\\9\\\\9\\\\9\\\\9\\\\9y = math.min( math.max( scrollY + cy, 1 ), #tLines )\\\\\\\
  1387. \\\\9\\\\9\\\\9\\\\9\\\\9x = math.min( math.max( scrollX + cx, 1 ), string.len( tLines[y] ) + 1 )\\\\\\\
  1388. \\\\9\\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
  1389. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1390. \\\\9\\\\9\\\\9end\\\\\\\
  1391. \\\\9\\\\9end\\\\\\\
  1392. \\\\9\\\\9\\\\\\\
  1393. \\\\9elseif sEvent == \\\\\\\"mouse_scroll\\\\\\\" then\\\\\\\
  1394. \\\\9\\\\9if not bMenu then\\\\\\\
  1395. \\\\9\\\\9\\\\9if param == -1 then\\\\\\\
  1396. \\\\9\\\\9\\\\9\\\\9-- Scroll up\\\\\\\
  1397. \\\\9\\\\9\\\\9\\\\9if scrollY > 0 then\\\\\\\
  1398. \\\\9\\\\9\\\\9\\\\9\\\\9-- Move cursor up\\\\\\\
  1399. \\\\9\\\\9\\\\9\\\\9\\\\9scrollY = scrollY - 1\\\\\\\
  1400. \\\\9\\\\9\\\\9\\\\9\\\\9redrawText()\\\\\\\
  1401. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1402. \\\\9\\\\9\\\\9\\\\\\\
  1403. \\\\9\\\\9\\\\9elseif param == 1 then\\\\\\\
  1404. \\\\9\\\\9\\\\9\\\\9-- Scroll down\\\\\\\
  1405. \\\\9\\\\9\\\\9\\\\9local nMaxScroll = #tLines - (h-1)\\\\\\\
  1406. \\\\9\\\\9\\\\9\\\\9if scrollY < nMaxScroll then\\\\\\\
  1407. \\\\9\\\\9\\\\9\\\\9\\\\9-- Move cursor down\\\\\\\
  1408. \\\\9\\\\9\\\\9\\\\9\\\\9scrollY = scrollY + 1\\\\\\\
  1409. \\\\9\\\\9\\\\9\\\\9\\\\9redrawText()\\\\\\\
  1410. \\\\9\\\\9\\\\9\\\\9end\\\\\\\
  1411. \\\\9\\\\9\\\\9\\\\9\\\\\\\
  1412. \\\\9\\\\9\\\\9end\\\\\\\
  1413. \\\\9\\\\9end\\\\\\\
  1414. \\\\9end\\\\\\\
  1415. end\\\\\\\
  1416. \\\\\\\
  1417. -- Cleanup\\\\\\\
  1418. term.clear()\\\\\\\
  1419. term.setCursorBlink( false )\\\\\\\
  1420. term.setCursorPos( 1, 1 )\\\"\",\
  1421.  \"F:list\",\
  1422.  \"\\\"\\\\\\\
  1423. local tArgs = { ... }\\\\\\\
  1424. \\\\\\\
  1425. -- Get all the files in the directory\\\\\\\
  1426. local sDir = shell.dir()\\\\\\\
  1427. if tArgs[1] ~= nil then\\\\\\\
  1428. \\\\9sDir = shell.resolve( tArgs[1] )\\\\\\\
  1429. end\\\\\\\
  1430. \\\\\\\
  1431. -- Sort into dirs/files, and calculate column count\\\\\\\
  1432. local tAll = fs.list( sDir )\\\\\\\
  1433. local tFiles = {}\\\\\\\
  1434. local tDirs = {}\\\\\\\
  1435. \\\\\\\
  1436. for n, sItem in pairs( tAll ) do\\\\\\\
  1437. \\\\9if string.sub( sItem, 1, 1 ) ~= \\\\\\\".\\\\\\\" then\\\\\\\
  1438. \\\\9\\\\9local sPath = fs.combine( sDir, sItem )\\\\\\\
  1439. \\\\9\\\\9if fs.isDir( sPath ) then\\\\\\\
  1440. \\\\9\\\\9\\\\9table.insert( tDirs, sItem )\\\\\\\
  1441. \\\\9\\\\9else\\\\\\\
  1442. \\\\9\\\\9\\\\9table.insert( tFiles, sItem )\\\\\\\
  1443. \\\\9\\\\9end\\\\\\\
  1444. \\\\9end\\\\\\\
  1445. end\\\\\\\
  1446. table.sort( tDirs )\\\\\\\
  1447. table.sort( tFiles )\\\\\\\
  1448. term.setTextColor(colors.cyan)\\\\\\\
  1449. print(\\\\\\\"Files Explorer:\\\\\\\")\\\\\\\
  1450. if term.isColour() then\\\\\\\
  1451. \\\\9textutils.pagedTabulate( colors.orange, tDirs, colours.red, tFiles )\\\\\\\
  1452. else\\\\\\\
  1453. \\\\9textutils.pagedTabulate( tDirs, tFiles )\\\\\\\
  1454. end\\\"\",\
  1455.  \"F:lua\",\
  1456.  \"\\\"\\\\\\\
  1457. local bRunning = true\\\\\\\
  1458. local tCommandHistory = {}\\\\\\\
  1459. local tEnv = {\\\\\\\
  1460. \\\\9[\\\\\\\"leave\\\\\\\"] = function()\\\\\\\
  1461. \\\\9\\\\9bRunning = false\\\\\\\
  1462. \\\\9end,\\\\\\\
  1463. [\\\\\\\"help\\\\\\\"] = function()\\\\\\\
  1464.  print([[\\\\\\\
  1465.  Welcome to the ReactOS Lua Prompt.\\\\\\\
  1466.  We hope you will find it useful for developing\\\\\\\
  1467.  your own ReactOS programs.\\\\\\\
  1468.  Be advised that the Lua Prompt itself is not\\\\\\\
  1469.  for running Lua programs - just type their\\\\\\\
  1470.  names in the command prompt to run them.\\\\\\\
  1471.  Also note that the ReactOS Lua Prompt is only\\\\\\\
  1472.  available in a valid, licensed copy of ReactOS.\\\\\\\
  1473.  \\\\\\\
  1474.  To exit, type leave() in the prompt.\\\\\\\
  1475.  ]])\\\\\\\
  1476. end,\\\\\\\
  1477. }\\\\\\\
  1478. \\\\\\\
  1479. if not rga.isActivated then\\\\\\\
  1480. error(\\\\\\\"ReactOS is not activated\\\\\\\")\\\\\\\
  1481. end\\\\\\\
  1482. \\\\\\\
  1483. setmetatable( tEnv, { __index = getfenv() } )\\\\\\\
  1484. \\\\\\\
  1485. if term.isColour() then\\\\\\\
  1486. \\\\9term.setTextColour( colours.yellow )\\\\\\\
  1487. end\\\\\\\
  1488. print( \\\\\\\"ReactOS Lua Prompt\\\\\\\" )\\\\\\\
  1489. term.setTextColour( colours.white )\\\\\\\
  1490. print( \\\\\\\"Type help() for help \\\\\\\")\\\\\\\
  1491. \\\\\\\
  1492. while bRunning do\\\\\\\
  1493. \\\\9--if term.isColour() then\\\\\\\
  1494. \\\\9--\\\\9term.setTextColour( colours.yellow )\\\\\\\
  1495. \\\\9--end\\\\\\\
  1496. \\\\9write( \\\\\\\"Lua >> \\\\\\\" )\\\\\\\
  1497. \\\\9--term.setTextColour( colours.white )\\\\\\\
  1498. \\\\9\\\\\\\
  1499. \\\\9local s = read( nil, tCommandHistory )\\\\\\\
  1500. \\\\9table.insert( tCommandHistory, s )\\\\\\\
  1501. \\\\9\\\\\\\
  1502. \\\\9local nForcePrint = 0\\\\\\\
  1503. \\\\9local func, e = loadstring( s, \\\\\\\"lua\\\\\\\" )\\\\\\\
  1504. \\\\9local func2, e2 = loadstring( \\\\\\\"return \\\\\\\"..s, \\\\\\\"lua\\\\\\\" )\\\\\\\
  1505. \\\\9if not func then\\\\\\\
  1506. \\\\9\\\\9if func2 then\\\\\\\
  1507. \\\\9\\\\9\\\\9func = func2\\\\\\\
  1508. \\\\9\\\\9\\\\9e = nil\\\\\\\
  1509. \\\\9\\\\9\\\\9nForcePrint = 1\\\\\\\
  1510. \\\\9\\\\9end\\\\\\\
  1511. \\\\9else\\\\\\\
  1512. \\\\9\\\\9if func2 then\\\\\\\
  1513. \\\\9\\\\9\\\\9func = func2\\\\\\\
  1514. \\\\9\\\\9end\\\\\\\
  1515. \\\\9end\\\\\\\
  1516. \\\\9\\\\\\\
  1517. \\\\9if func then\\\\\\\
  1518.        setfenv( func, tEnv )\\\\\\\
  1519.        local tResults = { pcall( function() return func() end ) }\\\\\\\
  1520.        if tResults[1] then\\\\\\\
  1521.        \\\\9local n = 1\\\\\\\
  1522.        \\\\9while (tResults[n + 1] ~= nil) or (n <= nForcePrint) do\\\\\\\
  1523.        \\\\9\\\\9print( tostring( tResults[n + 1] ) )\\\\\\\
  1524.        \\\\9\\\\9n = n + 1\\\\\\\
  1525.        \\\\9end\\\\\\\
  1526.        else\\\\\\\
  1527.        \\\\9printError( tResults[2] )\\\\\\\
  1528.        end\\\\\\\
  1529.    else\\\\\\\
  1530.    \\\\9printError( e )\\\\\\\
  1531.    end\\\\\\\
  1532.    \\\\\\\
  1533. end\\\"\",\
  1534.  \"F:mkdir\",\
  1535.  \"\\\"local tArgs = { ... }\\\\\\\
  1536. if #tArgs < 1 then\\\\\\\
  1537. \\\\9print( \\\\\\\"Usage: mkdir <path>\\\\\\\" )\\\\\\\
  1538. \\\\9return\\\\\\\
  1539. end\\\\\\\
  1540. \\\\\\\
  1541. local sNewDir = shell.resolve( tArgs[1] )\\\\\\\
  1542. fs.makeDir( sNewDir )\\\\\\\
  1543. print(\\\\\\\"New directory created! You can open it using\\\\\\\")\\\\\\\
  1544. print(\\\\\\\"cd \\\\\\\"..tArgs[1])\\\\\\\
  1545. \\\\\\\
  1546. \\\"\",\
  1547.  \"F:modem\",\
  1548.  \"\\\"local mArgs = {...}\\\\\\\
  1549. local help = \\\\\\\"modem <open/close/status/help>\\\\\\\"\\\\\\\
  1550. \\\\\\\
  1551. function autoOpen()\\\\\\\
  1552. for _, v in pairs(rs.getSides()) do\\\\\\\
  1553.  if peripheral.isPresent(v) and peripheral.getType(v) == \\\\\\\"modem\\\\\\\" then\\\\\\\
  1554.   if not rednet.isOpen(v) then\\\\\\\
  1555.    rednet.open(v)\\\\\\\
  1556.    print(\\\\\\\"Modem opened on \\\\\\\"..v..\\\\\\\" side\\\\\\\")\\\\\\\
  1557.   else\\\\\\\
  1558.    printError(\\\\\\\"Modem on \\\\\\\"..v..\\\\\\\" side already open\\\\\\\")\\\\\\\
  1559.   end\\\\\\\
  1560.  end\\\\\\\
  1561. end\\\\\\\
  1562. end\\\\\\\
  1563. \\\\\\\
  1564. function autoClose()\\\\\\\
  1565. for _, v in pairs(rs.getSides()) do\\\\\\\
  1566.  if peripheral.isPresent(v) and peripheral.getType(v) == \\\\\\\"modem\\\\\\\" then\\\\\\\
  1567.   if rednet.isOpen(v) then\\\\\\\
  1568.    rednet.close(v)\\\\\\\
  1569.    print(\\\\\\\"Modem closed on \\\\\\\"..v..\\\\\\\" side\\\\\\\")\\\\\\\
  1570.   else\\\\\\\
  1571.    printError(\\\\\\\"Modem on \\\\\\\"..v..\\\\\\\" side already closed\\\\\\\")\\\\\\\
  1572.   end\\\\\\\
  1573.  end\\\\\\\
  1574. end\\\\\\\
  1575. end\\\\\\\
  1576. \\\\\\\
  1577. function list()\\\\\\\
  1578. for _, v in pairs(rs.getSides()) do\\\\\\\
  1579.  if peripheral.isPresent(v) and peripheral.getType(v) == \\\\\\\"modem\\\\\\\" then\\\\\\\
  1580.   print(\\\\\\\"Modem detected on \\\\\\\"..v..\\\\\\\" side\\\\\\\")\\\\\\\
  1581.   if rednet.isOpen(v) then\\\\\\\
  1582.    print(\\\\\\\"Modem is open\\\\\\\")\\\\\\\
  1583.   elseif not rednet.isOpen(v) then\\\\\\\
  1584.    print(\\\\\\\"Modem is closed\\\\\\\")\\\\\\\
  1585.   end\\\\\\\
  1586.  end\\\\\\\
  1587. end\\\\\\\
  1588. end\\\\\\\
  1589. \\\\\\\
  1590. if #mArgs < 1 then\\\\\\\
  1591. print(help)\\\\\\\
  1592. else\\\\\\\
  1593. if mArgs[1] == \\\\\\\"open\\\\\\\" then\\\\\\\
  1594.  autoOpen()\\\\\\\
  1595. elseif mArgs[1] == \\\\\\\"close\\\\\\\" then\\\\\\\
  1596.  autoClose()\\\\\\\
  1597. elseif mArgs[1] == \\\\\\\"status\\\\\\\" then\\\\\\\
  1598.  list()\\\\\\\
  1599. elseif mArgs[1] == \\\\\\\"help\\\\\\\" then\\\\\\\
  1600.  print(help)\\\\\\\
  1601. end\\\\\\\
  1602. end\\\"\",\
  1603.  \"F:move\",\
  1604.  \"\\\"\\\\\\\
  1605. local tArgs = { ... }\\\\\\\
  1606. if #tArgs < 2 then\\\\\\\
  1607. \\\\9print( \\\\\\\"Usage: mv <source> <destination>\\\\\\\" )\\\\\\\
  1608. \\\\9return\\\\\\\
  1609. end\\\\\\\
  1610. \\\\\\\
  1611. local sSource = shell.resolve( tArgs[1] )\\\\\\\
  1612. local sDest = shell.resolve( tArgs[2] )\\\\\\\
  1613. if fs.exists( sDest ) and fs.isDir( sDest ) then\\\\\\\
  1614. \\\\9sDest = fs.combine( sDest, fs.getName(sSource) )\\\\\\\
  1615. end\\\\\\\
  1616. \\\\\\\
  1617. for _, value in pairs(files.list) do\\\\\\\
  1618. if string.find(sSource, value) or string.find(sDest, value) then\\\\\\\
  1619.  error(\\\\\\\"access to system files is denied\\\\\\\")\\\\\\\
  1620. end\\\\\\\
  1621. end\\\\\\\
  1622. \\\\\\\
  1623. fs.move( sSource, sDest )\\\"\",\
  1624.  \"F:pastebin\",\
  1625.  \"\\\"\\\\\\\
  1626. local function printUsage()\\\\\\\
  1627. \\\\9print( \\\\\\\"Usages:\\\\\\\" )\\\\\\\
  1628. \\\\9print( \\\\\\\"pastebin put <filename>\\\\\\\" )\\\\\\\
  1629. \\\\9print( \\\\\\\"pastebin get <code> <filename>\\\\\\\" )\\\\\\\
  1630. end\\\\\\\
  1631. \\\\\\\
  1632. local tArgs = { ... }\\\\\\\
  1633. if #tArgs < 2 then\\\\\\\
  1634. \\\\9printUsage()\\\\\\\
  1635.  \\\\9return\\\\\\\
  1636. end\\\\\\\
  1637. \\\\\\\
  1638. if not http then\\\\\\\
  1639. \\\\9print( \\\\\\\"Pastebin requires http API\\\\\\\" )\\\\\\\
  1640. \\\\9print( \\\\\\\"Set enableAPI_http to 1 in mod_ComputerCraft.cfg\\\\\\\" )\\\\\\\
  1641. \\\\9return\\\\\\\
  1642. end\\\\\\\
  1643. \\\\\\\
  1644. if not rga.isActivated then\\\\\\\
  1645. error(\\\\\\\"ReactOS is not activated\\\\\\\")\\\\\\\
  1646. end\\\\\\\
  1647. \\\\\\\
  1648. local sCommand = tArgs[1]\\\\\\\
  1649. if sCommand == \\\\\\\"put\\\\\\\" then\\\\\\\
  1650. \\\\9-- Upload a file to pastebin.com\\\\\\\
  1651. \\\\9-- Determine file to upload\\\\\\\
  1652. \\\\9local sFile = tArgs[2]\\\\\\\
  1653. \\\\9local sPath = shell.resolve( sFile )\\\\\\\
  1654. \\\\9if not fs.exists( sPath ) or fs.isDir( sPath ) then\\\\\\\
  1655. \\\\9\\\\9print( \\\\\\\"No such file\\\\\\\" )\\\\\\\
  1656. \\\\9\\\\9return\\\\\\\
  1657. \\\\9end\\\\\\\
  1658. \\\\9\\\\\\\
  1659. \\\\9-- Read in the file\\\\\\\
  1660. \\\\9local sName = fs.getName( sPath )\\\\\\\
  1661. \\\\9local file = fs.open( sPath, \\\\\\\"r\\\\\\\" )\\\\\\\
  1662. \\\\9local sText = file.readAll()\\\\\\\
  1663. \\\\9file.close()\\\\\\\
  1664. \\\\9\\\\\\\
  1665. \\\\9-- POST the contents to pastebin\\\\\\\
  1666. \\\\9write( \\\\\\\"Connecting to pastebin.com... \\\\\\\" )\\\\\\\
  1667. \\\\9local key = \\\\\\\"0ec2eb25b6166c0c27a394ae118ad829\\\\\\\"\\\\\\\
  1668. \\\\9local response = http.post(\\\\\\\
  1669. \\\\9\\\\9\\\\\\\"http://pastebin.com/api/api_post.php\\\\\\\", \\\\\\\
  1670. \\\\9\\\\9\\\\\\\"api_option=paste&\\\\\\\"..\\\\\\\
  1671. \\\\9\\\\9\\\\\\\"api_dev_key=\\\\\\\"..key..\\\\\\\"&\\\\\\\"..\\\\\\\
  1672. \\\\9\\\\9\\\\\\\"api_paste_format=lua&\\\\\\\"..\\\\\\\
  1673. \\\\9\\\\9\\\\\\\"api_paste_name=\\\\\\\"..textutils.urlEncode(sName)..\\\\\\\"&\\\\\\\"..\\\\\\\
  1674. \\\\9\\\\9\\\\\\\"api_paste_code=\\\\\\\"..textutils.urlEncode(sText)\\\\\\\
  1675. \\\\9\\\\9)\\\\\\\
  1676. \\\\9\\\\9\\\\\\\
  1677. \\\\9if response then\\\\\\\
  1678. \\\\9\\\\9print( \\\\\\\"Success.\\\\\\\" )\\\\\\\
  1679. \\\\9\\\\9\\\\\\\
  1680. \\\\9\\\\9local sResponse = response.readAll()\\\\\\\
  1681. \\\\9\\\\9response.close()\\\\\\\
  1682. \\\\9\\\\9\\\\9\\\\9\\\\\\\
  1683. \\\\9\\\\9local sCode = string.match( sResponse, \\\\\\\"[^/]+$\\\\\\\" )\\\\\\\
  1684. \\\\9\\\\9print( \\\\\\\"Uploaded as \\\\\\\"..sResponse )\\\\\\\
  1685. \\\\9\\\\9print( \\\\\\\"Run \\\\\\\\\\\\\\\"pastebin get \\\\\\\"..sCode..\\\\\\\"\\\\\\\\\\\\\\\" to download anywhere\\\\\\\" )\\\\\\\
  1686. \\\\\\\
  1687. \\\\9else\\\\\\\
  1688. \\\\9\\\\9print( \\\\\\\"Failed.\\\\\\\" )\\\\\\\
  1689. \\\\9end\\\\\\\
  1690. \\\\9\\\\\\\
  1691. elseif sCommand == \\\\\\\"get\\\\\\\" then\\\\\\\
  1692. \\\\9-- Download a file from pastebin.com\\\\\\\
  1693. \\\\9if #tArgs < 3 then\\\\\\\
  1694. \\\\9\\\\9printUsage()\\\\\\\
  1695. \\\\9\\\\9return\\\\\\\
  1696. \\\\9end\\\\\\\
  1697. \\\\\\\
  1698. \\\\9-- Determine file to download\\\\\\\
  1699. \\\\9local sCode = tArgs[2]\\\\\\\
  1700. \\\\9local sFile = tArgs[3]\\\\\\\
  1701. \\\\9local sPath = shell.resolve( sFile )\\\\\\\
  1702. \\\\9if fs.exists( sPath ) then\\\\\\\
  1703. \\\\9\\\\9print( \\\\\\\"File already exists\\\\\\\" )\\\\\\\
  1704. \\\\9\\\\9return\\\\\\\
  1705. \\\\9end\\\\\\\
  1706. \\\\9\\\\\\\
  1707. \\\\9-- GET the contents from pastebin\\\\\\\
  1708. \\\\9write( \\\\\\\"Connecting to pastebin.com... \\\\\\\" )\\\\\\\
  1709. \\\\9local response = http.get(\\\\\\\
  1710. \\\\9\\\\9\\\\\\\"http://pastebin.com/raw.php?i=\\\\\\\"..textutils.urlEncode( sCode )\\\\\\\
  1711. \\\\9\\\\9)\\\\\\\
  1712. \\\\9\\\\9\\\\\\\
  1713. \\\\9if response then\\\\\\\
  1714. \\\\9\\\\9print( \\\\\\\"Success.\\\\\\\" )\\\\\\\
  1715. \\\\9\\\\9\\\\\\\
  1716. \\\\9\\\\9local sResponse = response.readAll()\\\\\\\
  1717. \\\\9\\\\9response.close()\\\\\\\
  1718. \\\\9\\\\9\\\\\\\
  1719. \\\\9\\\\9local file = fs.open( sPath, \\\\\\\"w\\\\\\\" )\\\\\\\
  1720. \\\\9\\\\9file.write( sResponse )\\\\\\\
  1721. \\\\9\\\\9file.close()\\\\\\\
  1722. \\\\9\\\\9\\\\\\\
  1723. \\\\9\\\\9print( \\\\\\\"Downloaded as \\\\\\\"..sFile )\\\\\\\
  1724. \\\\9\\\\9\\\\\\\
  1725. \\\\9else\\\\\\\
  1726. \\\\9\\\\9print( \\\\\\\"Failed.\\\\\\\" )\\\\\\\
  1727. \\\\9end\\\\9\\\\\\\
  1728. \\\\\\\
  1729. else\\\\\\\
  1730. \\\\9printUsage()\\\\\\\
  1731. \\\\9return\\\\\\\
  1732. end\\\"\",\
  1733.  \"F:rga\",\
  1734.  \"\\\"if not SHA1 then\\\\\\\
  1735. if not os.loadAPI(\\\\\\\"/api/SHA1\\\\\\\") then\\\\\\\
  1736.  error(\\\\\\\"could not load hashing algorithm (SHA1)\\\\\\\")\\\\\\\
  1737. end\\\\\\\
  1738. end\\\\\\\
  1739. \\\\\\\
  1740. local text = textutils.serialize(SHA1.digestStr(\\\\\\\"ReactOS_GenuineKey\\\\\\\"))\\\\\\\
  1741. local hash = \\\\\\\" \\\\\\\"\\\\\\\
  1742. print(\\\\\\\"ReactOS Genuine Advantage\\\\\\\")\\\\\\\
  1743. print(\\\\\\\" \\\\\\\")\\\\\\\
  1744. print(\\\\\\\"Verifying system activation certificate\\\\\\\")\\\\\\\
  1745. local key = fs.open(\\\\\\\"/.rgaKey\\\\\\\", \\\\\\\"r\\\\\\\")\\\\\\\
  1746. hash = key.readAll()\\\\\\\
  1747. key.close()\\\\\\\
  1748. if hash == text then\\\\\\\
  1749. print(\\\\\\\"Your system is genuine!\\\\\\\")\\\\\\\
  1750. write(\\\\\\\"Do you want to update the RGA data [Y/N]? \\\\\\\")\\\\\\\
  1751. local ina = read()\\\\\\\
  1752. if ina == \\\\\\\"Y\\\\\\\" or ina == \\\\\\\"y\\\\\\\" then\\\\\\\
  1753.  os.unloadAPI(\\\\\\\"rga\\\\\\\")\\\\\\\
  1754.  local cert = fs.open(\\\\\\\"/.rgaData/rga\\\\\\\", \\\\\\\"w\\\\\\\")\\\\\\\
  1755.  cert.writeLine(\\\\\\\"isActivated = true\\\\\\\")\\\\\\\
  1756.  cert.close()\\\\\\\
  1757.  os.loadAPI(\\\\\\\"/.rgaData/rga\\\\\\\")\\\\\\\
  1758. else\\\\\\\
  1759.  print(\\\\\\\"Thank you.\\\\\\\")\\\\\\\
  1760. end\\\\\\\
  1761. else\\\\\\\
  1762. os.unloadAPI(\\\\\\\"rga\\\\\\\")\\\\\\\
  1763. local x = fs.open(\\\\\\\"/.rgaData/rga\\\\\\\", \\\\\\\"w\\\\\\\")\\\\\\\
  1764. x.writeLine(\\\\\\\"isActivated = false\\\\\\\")\\\\\\\
  1765. x.close()\\\\\\\
  1766. os.loadAPI(\\\\\\\"/.rgaData/rga\\\\\\\")\\\\\\\
  1767. printError([[\\\\\\\
  1768. This copy of ReactOS is not activated.\\\\\\\
  1769. Consider buying a valid, licensed copy.\\\\\\\
  1770. ]])\\\\\\\
  1771. end\\\"\",\
  1772.  \"F:test\",\
  1773.  \"\\\"print(\\\\\\\"Hello)\\\\\\\")\\\"\",\
  1774. }",
  1775. }
Advertisement
Add Comment
Please, Sign In to add comment