Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "F:.mbr",
- "\"term.setBackgroundColor(colors.black)\\\
- shell.run(\\\"clear\\\")\\\
- shell.setAlias(\\\"modem\\\", \\\"/system32/modem\\\")\\\
- shell.setAlias(\\\"antimalware\\\", \\\"/system32/antimalware\\\")\\\
- shell.setAlias(\\\"copy\\\", \\\"/system32/copy\\\")\\\
- shell.setAlias(\\\"cp\\\", \\\"/system32/copy\\\")\\\
- shell.setAlias(\\\"move\\\", \\\"/system32/move\\\")\\\
- shell.setAlias(\\\"mv\\\", \\\"/system32/move\\\")\\\
- shell.setAlias(\\\"pastebin\\\", \\\"/system32/pastebin\\\")\\\
- shell.setAlias(\\\"edit\\\", \\\"/system32/edit\\\")\\\
- shell.setAlias(\\\"list\\\", \\\"/system32/list\\\")\\\
- shell.setAlias(\\\"ls\\\", \\\"/system32/list\\\")\\\
- shell.setAlias(\\\"dir\\\", \\\"/system32/list\\\")\\\
- shell.setAlias(\\\"mkdir\\\", \\\"/system32/mkdir\\\")\\\
- shell.setAlias(\\\"alias\\\", \\\"/.setalias\\\")\\\
- shell.setAlias(\\\"lua\\\", \\\"/system32/lua\\\")\\\
- shell.setAlias(\\\"rga\\\", \\\"/system32/rga\\\")\\\
- shell.setAlias(\\\"delete\\\", \\\"/system32/delete\\\")\\\
- shell.setAlias(\\\"rm\\\", \\\"/system32/delete\\\")\\\
- shell.setAlias(\\\"erase\\\", \\\"/system32/delete\\\")\\\
- shell.setAlias(\\\"del\\\", \\\"/system32/delete\\\")\\\
- shell.setAlias(\\\"shell\\\", \\\"/system32/cmd\\\")\\\
- shell.setAlias(\\\"sh\\\", \\\"/system32/cmd\\\")\\\
- shell.setAlias(\\\"startup\\\", \\\"/.mbr\\\")\\\
- shell.run(\\\"/system32/cmd\\\")\"",
- "D:.rgaData",
- "{\
- \"F:active\",\
- \"\\\"isActivated = true\\\"\",\
- \"F:files\",\
- \"\\\"list = {\\\\\\\"startup\\\\\\\", \\\\\\\"rga\\\\\\\", \\\\\\\"mbr\\\\\\\", \\\\\\\"system32\\\\\\\"}\\\\\\\
- listEdit = {\\\\\\\"rga\\\\\\\", \\\\\\\"system32\\\\\\\"}\\\"\",\
- \"F:inactive\",\
- \"\\\"isActivated = false\\\"\",\
- }",
- "F:.rgaKey",
- "\"{[1]=114232018,[2]=3320850722,[3]=1544527649,[4]=3315600456,[5]=1525621041,}\"",
- "F:.setalias",
- "\"printError(\\\"The alias program is unavailable in ReactOS.\\\")\\\
- printError(\\\"You may take a look at the RDK instead.\\\")\"",
- "D:api",
- "{\
- \"F:SHA1\",\
- \"\\\"-- SHA1\\\\\\\
- -- By KillaVanilla\\\\\\\
- \\\\\\\
- local function Preprocessing(msg)\\\\\\\
- \\\\9local msgCp = {}\\\\\\\
- \\\\9local lastPause = os.clock()\\\\\\\
- \\\\9for i=1, #msg do\\\\\\\
- \\\\9\\\\9msgCp[i] = msg[i]\\\\\\\
- \\\\9\\\\9if (os.clock() - lastPause) >= 2.90 then\\\\\\\
- \\\\9\\\\9\\\\9os.queueEvent(\\\\\\\"\\\\\\\")\\\\\\\
- \\\\9\\\\9\\\\9os.pullEvent(\\\\\\\"\\\\\\\")\\\\\\\
- \\\\9\\\\9\\\\9lastPause = os.clock()\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9end\\\\\\\
- \\\\9local len = #msgCp*8\\\\\\\
- \\\\9local bits = #msgCp*8\\\\\\\
- \\\\9table.insert(msgCp, 0x80)\\\\\\\
- \\\\9while true do\\\\\\\
- \\\\9\\\\9if bits % 512 == 448 then\\\\\\\
- \\\\9\\\\9\\\\9break\\\\\\\
- \\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9table.insert(msgCp, 0)\\\\\\\
- \\\\9\\\\9\\\\9bits = #msgCp*8\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9end\\\\\\\
- \\\\9table.insert(msgCp, len)\\\\\\\
- \\\\9return msgCp\\\\\\\
- end\\\\\\\
- \\\\\\\
- local function breakMsg(message)\\\\\\\
- \\\\9local chunks = {}\\\\\\\
- \\\\9local chunk = 1\\\\\\\
- \\\\9for word=1, #message, 16 do\\\\\\\
- \\\\9\\\\9chunks[chunk] = {}\\\\\\\
- \\\\9\\\\9for i2=0, 15 do\\\\\\\
- \\\\9\\\\9\\\\9table.insert(chunks[chunk], message[word+i2] or 0)\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9chunk = chunk+1\\\\\\\
- \\\\9end\\\\\\\
- \\\\9return chunks\\\\\\\
- end\\\\\\\
- \\\\\\\
- function leftrotate(a, i)\\\\\\\
- \\\\9local bitmask = (2^i)-1\\\\\\\
- \\\\9local shiftOut = bit.band(a, bit.blshift(bitmask, 32-i))\\\\\\\
- \\\\9if bit.band(shiftOut, 0x80000000) > 0 then -- gotta work around the arithmetic right shift\\\\\\\
- \\\\9\\\\9--[[\\\\\\\
- \\\\9\\\\9shiftOut = bit.brshift(shiftOut, 1)\\\\\\\
- \\\\9\\\\9shiftOut = bit.band(shiftOut, 0x7FFFFFFF)\\\\\\\
- \\\\9\\\\9shiftOut = bit.brshift(shiftOut, 31-i)\\\\\\\
- \\\\9\\\\9]]\\\\\\\
- \\\\9\\\\9shiftOut = bit.band(bit.brshift(shiftOut, 32-i), bitmask)\\\\\\\
- \\\\9else\\\\\\\
- \\\\9\\\\9shiftOut = bit.brshift(shiftOut, 32-i)\\\\\\\
- \\\\9end\\\\\\\
- \\\\9local b = bit.band(bit.blshift(a, i), 0xFFFFFFFF)\\\\\\\
- \\\\9b = bit.bor(b, shiftOut)\\\\\\\
- \\\\9return (b % (2^32))\\\\\\\
- end\\\\\\\
- \\\\\\\
- function digest(bytes, debugFile)\\\\\\\
- \\\\9bytes = Preprocessing(bytes)\\\\\\\
- \\\\9local chunks = breakMsg(bytes)\\\\\\\
- \\\\9local h = {}\\\\\\\
- \\\\9h[0] = 0x67452301\\\\\\\
- \\\\9h[1] = 0xEFCDAB89\\\\\\\
- \\\\9h[2] = 0x98BADCFE\\\\\\\
- \\\\9h[3] = 0x10325476\\\\\\\
- \\\\9h[4] = 0xC3D2E1F0\\\\\\\
- \\\\9local debug = false\\\\\\\
- \\\\9if debugFile then\\\\\\\
- \\\\9\\\\9debug = fs.open(debugFile, \\\\\\\"w\\\\\\\")\\\\\\\
- \\\\9end\\\\\\\
- \\\\9local pauseTimer1 = os.clock()\\\\\\\
- \\\\9for chunkN=1, #chunks do\\\\\\\
- \\\\9\\\\9local w = {}\\\\\\\
- \\\\9\\\\9for i=0, 15 do\\\\\\\
- \\\\9\\\\9\\\\9w[i] = chunks[chunkN][i+1]\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9local pauseTimer2 = os.clock()\\\\\\\
- \\\\9\\\\9for i=16, 79 do\\\\\\\
- \\\\9\\\\9\\\\9w[i] = bit.bxor( bit.bxor(w[i-3], w[i-8]), bit.bxor(w[i-14], w[i-16]) ) % (2^32)\\\\\\\
- \\\\9\\\\9\\\\9w[i] = leftrotate(w[i], 1)\\\\\\\
- \\\\9\\\\9\\\\9if (os.clock() - pauseTimer2) >= 2.5 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9os.queueEvent(\\\\\\\"\\\\\\\")\\\\\\\
- \\\\9\\\\9\\\\9\\\\9os.pullEvent(\\\\\\\"\\\\\\\")\\\\\\\
- \\\\9\\\\9\\\\9\\\\9pauseTimer2 = os.clock()\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9local a = h[0]\\\\\\\
- \\\\9\\\\9local b = h[1]\\\\\\\
- \\\\9\\\\9local c = h[2]\\\\\\\
- \\\\9\\\\9local d = h[3]\\\\\\\
- \\\\9\\\\9local e = h[4]\\\\\\\
- \\\\9\\\\9local pauseTimer3 = os.clock()\\\\\\\
- \\\\9\\\\9for i=0, 79 do\\\\\\\
- \\\\9\\\\9\\\\9local f = 0\\\\\\\
- \\\\9\\\\9\\\\9local k = 0\\\\\\\
- \\\\9\\\\9\\\\9if (i >= 0) and (i <= 19) then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9f = bit.bor(bit.band(a, c), bit.band(bit.bnot(b), d)) % (2^32)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9k = 0x5A827999\\\\\\\
- \\\\9\\\\9\\\\9elseif (i >= 20) and (i <= 39) then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9f = bit.bxor(b, bit.bxor(c, d)) % (2^32)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9k = 0x6ED9EBA1\\\\\\\
- \\\\9\\\\9\\\\9elseif (i >= 40) and (i <= 59) then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9f = bit.bor(bit.band(b, c), bit.bor(bit.band(b, d), bit.band(c, d))) % (2^32)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9k = 0x8F1BBCDC\\\\\\\
- \\\\9\\\\9\\\\9elseif (i >= 60) and (i <= 79) then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9f = bit.bxor(b, bit.bxor(c, d)) % (2^32)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9k = 0xCA62C1D6\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9local temp = (leftrotate(a, 5)+f+e+k+w[i]) % (2^32)\\\\\\\
- \\\\9\\\\9\\\\9e = d\\\\\\\
- \\\\9\\\\9\\\\9d = c\\\\\\\
- \\\\9\\\\9\\\\9c = leftrotate(b, 30)\\\\\\\
- \\\\9\\\\9\\\\9b = a\\\\\\\
- \\\\9\\\\9\\\\9a = temp\\\\\\\
- \\\\9\\\\9\\\\9if (os.clock() - pauseTimer3) >= 2.80 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9os.queueEvent(\\\\\\\"\\\\\\\")\\\\\\\
- \\\\9\\\\9\\\\9\\\\9os.pullEvent(\\\\\\\"\\\\\\\")\\\\\\\
- \\\\9\\\\9\\\\9\\\\9pauseTimer3 = os.clock()\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9h[0] = (h[0]+a) % (2^32)\\\\\\\
- \\\\9\\\\9h[1] = (h[1]+b) % (2^32)\\\\\\\
- \\\\9\\\\9h[2] = (h[2]+c) % (2^32)\\\\\\\
- \\\\9\\\\9h[3] = (h[3]+d) % (2^32)\\\\\\\
- \\\\9\\\\9h[4] = (h[4]+e) % (2^32)\\\\\\\
- \\\\9\\\\9if debug then\\\\\\\
- \\\\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]))\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9if (os.clock() - pauseTimer1) >= 2.80 then\\\\\\\
- \\\\9\\\\9\\\\9os.queueEvent(\\\\\\\"\\\\\\\")\\\\\\\
- \\\\9\\\\9\\\\9os.pullEvent(\\\\\\\"\\\\\\\")\\\\\\\
- \\\\9\\\\9\\\\9pauseTimer1 = os.clock()\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9end\\\\\\\
- \\\\9if debug then\\\\\\\
- \\\\9\\\\9debug.close()\\\\\\\
- \\\\9end\\\\\\\
- \\\\9local hash = {}\\\\\\\
- \\\\9for i=0, 4 do\\\\\\\
- \\\\9\\\\9table.insert(hash, h[i])\\\\\\\
- \\\\9end\\\\\\\
- \\\\9return hash\\\\\\\
- end\\\\\\\
- \\\\\\\
- function digestStr(str, debugFile)\\\\\\\
- \\\\9local msg = {}\\\\\\\
- \\\\9for i=1, #str do\\\\\\\
- \\\\9\\\\9msg[i] = string.byte(str, i, i)\\\\\\\
- \\\\9end\\\\\\\
- \\\\9return digest(msg, debugFile)\\\\\\\
- end\\\\\\\
- \\\\\\\
- function digest2str(d)\\\\\\\
- \\\\9local str = \\\\\\\"\\\\\\\"\\\\\\\
- \\\\9for i=1, #d do\\\\\\\
- \\\\9\\\\9str = str..string.format(\\\\\\\"%X\\\\\\\", d[i])\\\\\\\
- \\\\9end\\\\\\\
- \\\\9return str\\\\\\\
- end\\\\\\\
- \\\\\\\
- function digest2bytes(d)\\\\\\\
- \\\\9local bytes = {}\\\\\\\
- \\\\9for i=1, #d do\\\\\\\
- \\\\9\\\\9table.insert(bytes, bit.band(bit.brshift(bit.band(d[i], 0xFF000000), 24), 0xFF))\\\\\\\
- \\\\9\\\\9table.insert(bytes, bit.band(bit.brshift(bit.band(d[i], 0xFF0000), 16), 0xFF))\\\\\\\
- \\\\9\\\\9table.insert(bytes, bit.band(bit.brshift(bit.band(d[i], 0xFF00), 8), 0xFF))\\\\\\\
- \\\\9\\\\9table.insert(bytes, bit.band(d[i], 0xFF))\\\\\\\
- \\\\9end\\\\\\\
- \\\\9return bytes\\\\\\\
- end\\\"\",\
- \"F:menu\",\
- \"\\\"--MenuAPI by 1Ridav\\\\\\\
- --Modified for Debian ComputerCraft by MelnikovSM\\\\\\\
- local function mprint(array, this, s1, s2, x, y)\\\\\\\
- for i = 1, #array do\\\\\\\
- term.setCursorPos(x, y)\\\\\\\
- --Check if option selected\\\\\\\
- if i == this then \\\\\\\
- --Option selected \\\\\\\
- write(s1)\\\\\\\
- else \\\\\\\
- --Option NOT selected\\\\\\\
- write(s2)\\\\\\\
- end\\\\\\\
- --Print the string\\\\\\\
- print(array[i])\\\\\\\
- y = y + 1 \\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- function CreateMenu(array, state1, state2, pos_x, pos_y)\\\\\\\
- local select = 1\\\\\\\
- local x, y = term.getCursorPos()\\\\\\\
- \\\\\\\
- while true do\\\\\\\
- term.setCursorPos(x, y)\\\\\\\
- mprint(array, select, state1, state2, pos_x, pos_y)\\\\\\\
- event, key = os.pullEvent(\\\\\\\"key\\\\\\\")\\\\\\\
- --Enter\\\\\\\
- if key == 28 then \\\\\\\
- return select \\\\\\\
- end\\\\\\\
- \\\\\\\
- if #array > 1 then\\\\\\\
- --Arrow UP or W key\\\\\\\
- if key == 200 or key == 17 then \\\\\\\
- \\\\9\\\\9 select = select - 1 \\\\\\\
- \\\\9\\\\9\\\\9\\\\\\\
- if select < 1 then \\\\\\\
- select = #array \\\\\\\
- end\\\\\\\
- --Arrow Down or S key\\\\\\\
- elseif key == 208 or key == 31 then \\\\\\\
- \\\\9\\\\9 select = select + 1 \\\\\\\
- \\\\9\\\\9\\\\9 if select > #array then select = 1 end\\\\\\\
- \\\\9 end\\\\\\\
- end \\\\\\\
- end\\\\\\\
- end\\\"\",\
- }",
- "F:start",
- "\"os.loadAPI(\\\"/api/menu\\\")\\\
- os.loadAPI(\\\"/.rgaData/rga\\\")\\\
- os.loadAPI(\\\"/.rgaData/files\\\")\\\
- \\\
- local function bootdonestartup()\\\
- shell.run(\\\"clear\\\")\\\
- term.setBackgroundColor(colors.cyan)\\\
- term.setTextColor(colors.white)\\\
- print(\\\"+----------------------------------------------+\\\")\\\
- print(\\\"| ReactOS Boot Manager |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| Booting MBR, please wait |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"+----------------------------------------------+\\\")\\\
- sleep(5)\\\
- shell.run(\\\"clear\\\")\\\
- if fs.exists(\\\"/.mbr\\\") then\\\
- shell.run(\\\"/.mbr\\\")\\\
- else\\\
- shell.run(\\\"clear\\\")\\\
- printError(\\\"ERROR: Boot file missing!\\\")\\\
- printError(\\\"Please insert another boot device\\\")\\\
- printError(\\\"and restart your PC using Ctrl+R\\\")\\\
- end\\\
- end\\\
- local function bootdonecd()\\\
- shell.run(\\\"clear\\\")\\\
- term.setBackgroundColor(colors.cyan)\\\
- term.setTextColor(colors.white)\\\
- print(\\\"+----------------------------------------------+\\\")\\\
- print(\\\"| ReactOS Boot Manager |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| Booting from floppy. |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"| |\\\")\\\
- print(\\\"+----------------------------------------------+\\\")\\\
- sleep(3)\\\
- os.reboot()\\\
- end\\\
- -- To prevent errors MenuAPI from DCC is used\\\
- local bootArray = {\\\"ReactOS v1.5\\\", \\\"Boot from floppy\\\", \\\"Shutdown\\\", \\\"Reboot\\\"}\\\
- term.setBackgroundColor(colors.cyan)\\\
- term.setTextColor(colors.white)\\\
- shell.run(\\\"clear\\\")\\\
- print(\\\"+----------------------------------------------+\\\")\\\
- print(\\\" ReactOS Boot Manager \\\") \\\
- term.setCursorPos(1, 18)\\\
- print(\\\" \\\")\\\
- print(\\\"+----------------------------------------------+\\\") \\\
- local bootOption = menu.CreateMenu(bootArray, \\\"[ > ] \\\", \\\"[ ] \\\", 3, 4)\\\
- -- while true do -- Causes errors!\\\
- if bootOption == 1 then\\\
- bootdonestartup()\\\
- --[[\\\
- elseif bootOption == 2 then\\\
- term.setCursorPos(1,17)\\\
- printError(\\\"CraftOS boot record has been removed.\\\")\\\
- sleep(2)\\\
- os.reboot()\\\
- ]]--\\\
- elseif bootOption == 2 then\\\
- bootdonecd()\\\
- elseif bootOption == 3 then\\\
- os.shutdown()\\\
- elseif bootOption == 4 then\\\
- os.reboot()\\\
- --[[\\\
- elseif bootOption == 5 then\\\
- term.setCursorPos(1,17)\\\
- printError(\\\"ERROR: Unable to resolve bootCraftOS()\\\")\\\
- sleep(2)\\\
- shell.run(\\\"rom/programs/shell\\\")\\\
- ]]--\\\
- else -- If you manage to break this, you're a god in CC\\\
- shell.run(\\\"clear\\\")\\\
- printError(\\\"You ran into a serious bug with the Boot Manager!\\\")\\\
- printError(\\\"Reinstall your copy of ReactOS immediately!\\\")\\\
- printError(\\\"Press any key to enter CraftOS\\\")\\\
- os.pullEvent(\\\"key\\\")\\\
- shell.run(\\\"/rom/programs/shell\\\")\\\
- end \\\
- -- end \"",
- "F:startup",
- "\"if not SHA1 then\\\
- if not os.loadAPI(\\\"/disk/api/SHA1\\\") then\\\
- error(\\\"could not load hashing algorithm (SHA1)\\\")\\\
- end\\\
- end\\\
- \\\
- shell.run(\\\"clear\\\")\\\
- write(\\\"Initializing ReactOS installer\\\")\\\
- textutils.slowPrint(\\\"...\\\")\\\
- \\\
- sleep(0.5)\\\
- shell.run(\\\"clear\\\")\\\
- print([[\\\
- ReactOS Installer\\\
- ===================================================\\\
- \\\
- Welcome to the ReactOS Installer.\\\
- This program will install ReactOS on your computer.\\\
- \\\
- Be advised: ReactOS includes measures to prevent\\\
- illegal use of the software. We are not responsible\\\
- for any damage done to your computer during\\\
- installation or usage of the software.\\\
- \\\
- Type 'I Agree' to continue.\\\
- \\\
- \\\
- ]])\\\
- local input = read()\\\
- if input == \\\"I Agree\\\" then\\\
- shell.run(\\\"clear\\\")\\\
- print(\\\"Copying filesystem\\\")\\\
- local dirs = {\\\"api\\\", \\\"system32\\\", \\\".rgaData\\\"}\\\
- for i=1,#dirs do\\\
- if fs.exists(\\\"/disk/\\\"..dirs[i]) then\\\
- fs.copy(\\\"/disk/\\\"..dirs[i], \\\"/\\\"..dirs[i])\\\
- print(\\\"Copied \\\"..dirs[i])\\\
- else\\\
- error(\\\"Installation failed, files missing\\\")\\\
- end\\\
- end\\\
- fs.copy(\\\"/disk/start\\\", \\\"/startup\\\")\\\
- fs.copy(\\\"/disk/.mbr\\\", \\\"/.mbr\\\")\\\
- fs.copy(\\\"/disk/.setalias\\\", \\\"/.setalias\\\")\\\
- print(\\\"Please type in the registration key you got earlier.\\\")\\\
- print(\\\" \\\")\\\
- local in2 = read()\\\
- local dig = SHA1.digestStr(\\\"Reactor\\\")\\\
- while true do\\\
- if in2 == \\\"1436601872\\\" then\\\
- print(\\\"Registration key accepted\\\")\\\
- print(\\\"Updating registration data\\\")\\\
- fs.delete(\\\"/.rgaData/inactive\\\")\\\
- fs.move(\\\"/.rgaData/active\\\", \\\"/.rgaData/rga\\\")\\\
- local text = textutils.serialize(SHA1.digestStr(\\\"ReactOS_GenuineKey\\\"))\\\
- print(\\\"Writing system certificate\\\")\\\
- fs.copy(\\\"/disk/.rgaKey\\\", \\\"/.rgaKey\\\")\\\
- os.reboot()\\\
- -- elseif in2 == \\\"developer override: show license key\\\" then\\\
- -- print(dig[1])\\\
- -- return\\\
- else\\\
- print(\\\"Registration key invalid. Trial mode is active\\\")\\\
- fs.delete(\\\"/.rgaData/active\\\")\\\
- fs.move(\\\"/.rgaData/inactive\\\", \\\"/.rgaData/rga\\\") \\\
- local tb = textutils.serialize(SHA1.digestStr(\\\"ReactorOS\\\"))\\\
- print(\\\"Writing system certificate\\\")\\\
- local fb = fs.open(\\\"/.rgaKey\\\", \\\"w\\\")\\\
- fb.write(tb)\\\
- fb.close()\\\
- os.reboot()\\\
- end\\\
- end\\\
- end\"",
- "D:system32",
- "{\
- \"F:antimalware\",\
- \"\\\"local defs = {\\\\\\\
- [\\\\\\\"File can broadcast data through RedNet\\\\\\\"] = \\\\\\\"rednet.broadcast\\\\\\\",\\\\\\\
- [\\\\\\\"File can use modems to transmit data\\\\\\\"] = \\\\\\\"modem.transmit\\\\\\\",\\\\\\\
- [\\\\\\\"File can run a program using a custom environment\\\\\\\"] = \\\\\\\"os.run\\\\\\\",\\\\\\\
- [\\\\\\\"File can resist force termination\\\\\\\"] = \\\\\\\"os.pullEvent = os.pullEventRaw\\\\\\\",\\\\\\\
- [\\\\\\\"File can call for events\\\\\\\"] = \\\\\\\"os.pullEvent\\\\\\\",\\\\\\\
- [\\\\\\\"File can queue events\\\\\\\"] = \\\\\\\"os.queueEvent\\\\\\\",\\\\\\\
- [\\\\\\\"File can call for raw events\\\\\\\"] = \\\\\\\"os.pullEventRaw\\\\\\\",\\\\\\\
- [\\\\\\\"File can set system path\\\\\\\"] = \\\\\\\"shell.setPath\\\\\\\",\\\\\\\
- [\\\\\\\"File can create coroutines\\\\\\\"] = \\\\\\\"coroutine.create\\\\\\\",\\\\\\\
- [\\\\\\\"File can run background functions\\\\\\\"] = \\\\\\\"parallel.waitForA\\\\\\\",\\\\\\\
- [\\\\\\\"File can resume coroutines\\\\\\\"] = \\\\\\\"coroutine.resume\\\\\\\",\\\\\\\
- [\\\\\\\"File can use HTTP API to receive data\\\\\\\"] = \\\\\\\"http.get\\\\\\\",\\\\\\\
- [\\\\\\\"File can change runtime environments\\\\\\\"] = \\\\\\\"setfenv\\\\\\\",\\\\\\\
- [\\\\\\\"File can set metatables\\\\\\\"] = \\\\\\\"setmetatable\\\\\\\",\\\\\\\
- }\\\\\\\
- \\\\\\\
- local err = {\\\\\\\
- [\\\\\\\"0x0001\\\\\\\"] = \\\\\\\"Unable to find target file\\\\\\\",\\\\\\\
- [\\\\\\\"0x0002\\\\\\\"] = \\\\\\\"Access to file denied\\\\\\\",\\\\\\\
- [\\\\\\\"0x0003\\\\\\\"] = \\\\\\\"ReactOS is not activated\\\\\\\",\\\\\\\
- }\\\\\\\
- \\\\\\\
- local amArgs = {...}\\\\\\\
- local file = nil\\\\\\\
- local contents = nil\\\\\\\
- local points = 0\\\\\\\
- \\\\\\\
- function check()\\\\\\\
- if not rga.isActivated then\\\\\\\
- return false, \\\\\\\"0x0003\\\\\\\"\\\\\\\
- elseif #amArgs < 1 then\\\\\\\
- return false, \\\\\\\"0x0001\\\\\\\"\\\\\\\
- else\\\\\\\
- for _, val in pairs(files.listEdit) do\\\\\\\
- if string.find(amArgs[1], val) then\\\\\\\
- return false, \\\\\\\"0x0002\\\\\\\"\\\\\\\
- else\\\\\\\
- return true, nil\\\\\\\
- end\\\\\\\
- end\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- function draw()\\\\\\\
- shell.run(\\\\\\\"clear\\\\\\\")\\\\\\\
- print(\\\\\\\"ReactOS AntiMalware\\\\\\\")\\\\\\\
- print(\\\\\\\"___________________________________________________\\\\\\\")\\\\\\\
- print(\\\\\\\" \\\\\\\")\\\\\\\
- end\\\\\\\
- \\\\\\\
- function scan()\\\\\\\
- print(\\\\\\\"Checking \\\\\\\"..amArgs[1])\\\\\\\
- if fs.exists(amArgs[1]) then\\\\\\\
- file = fs.open(amArgs[1], \\\\\\\"r\\\\\\\")\\\\\\\
- contents = file.readAll()\\\\\\\
- file.close()\\\\\\\
- for k, v in pairs(defs) do\\\\\\\
- if string.find(contents, v) then\\\\\\\
- printError(k)\\\\\\\
- points = points + 1\\\\\\\
- end\\\\\\\
- end\\\\\\\
- print(\\\\\\\"Done! Found \\\\\\\"..points..\\\\\\\" suspicious functions\\\\\\\")\\\\\\\
- else\\\\\\\
- printError(\\\\\\\"File does not exist!\\\\\\\")\\\\\\\
- return false, \\\\\\\"0x0001\\\\\\\"\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- draw()\\\\\\\
- local result, error = check()\\\\\\\
- if result ~= true and error ~= nil then\\\\\\\
- for ke,va in pairs(err) do\\\\\\\
- if ke == error then\\\\\\\
- printError(ke..\\\\\\\": \\\\\\\"..va)\\\\\\\
- return\\\\\\\
- end\\\\\\\
- end\\\\\\\
- end\\\\\\\
- draw()\\\\\\\
- scan()\\\\\\\
- \\\"\",\
- \"F:cmd\",\
- \"\\\"\\\\\\\
- local parentShell = shell\\\\\\\
- \\\\\\\
- local bExit = false\\\\\\\
- local sDir = (parentShell and parentShell.dir()) or \\\\\\\"\\\\\\\"\\\\\\\
- local sPath = (parentShell and parentShell.path()) or \\\\\\\".:/rom/programs\\\\\\\"\\\\\\\
- local tAliases = (parentShell and parentShell.aliases()) or {}\\\\\\\
- local tProgramStack = {}\\\\\\\
- \\\\\\\
- local shell = {}\\\\\\\
- local tEnv = {\\\\\\\
- \\\\9[\\\\\\\"shell\\\\\\\"] = shell,\\\\\\\
- }\\\\\\\
- \\\\\\\
- -- Colours\\\\\\\
- local promptColour, textColour, bgColour\\\\\\\
- if term.isColour() then\\\\\\\
- \\\\9promptColour = colours.yellow\\\\\\\
- \\\\9textColour = colours.white\\\\\\\
- \\\\9bgColour = colours.black\\\\\\\
- else\\\\\\\
- \\\\9promptColour = colours.white\\\\\\\
- \\\\9textColour = colours.white\\\\\\\
- \\\\9bgColour = colours.black\\\\\\\
- end\\\\\\\
- \\\\\\\
- \\\\\\\
- local function run( _sCommand, ... )\\\\\\\
- \\\\9local sPath = shell.resolveProgram( _sCommand )\\\\\\\
- \\\\9if sPath ~= nil then\\\\\\\
- \\\\9\\\\9tProgramStack[#tProgramStack + 1] = sPath\\\\\\\
- \\\\9\\\\9local result = os.run( tEnv, sPath, ... )\\\\\\\
- \\\\9\\\\9tProgramStack[#tProgramStack] = nil\\\\\\\
- \\\\9\\\\9return result\\\\\\\
- \\\\9else\\\\\\\
- \\\\9printError( \\\\\\\"No such program\\\\\\\" )\\\\\\\
- \\\\9return false\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- local function runLine( _sLine )\\\\\\\
- \\\\9local tWords = {}\\\\\\\
- \\\\9for match in string.gmatch( _sLine, \\\\\\\"[^ \\\\\\\\t]+\\\\\\\" ) do\\\\\\\
- \\\\9\\\\9table.insert( tWords, match )\\\\\\\
- \\\\9end\\\\\\\
- \\\\\\\
- \\\\9local sCommand = tWords[1]\\\\\\\
- \\\\9if sCommand then\\\\\\\
- \\\\9\\\\9return run( sCommand, unpack( tWords, 2 ) )\\\\\\\
- \\\\9end\\\\\\\
- \\\\9return false\\\\\\\
- end\\\\\\\
- \\\\\\\
- -- Install shell API\\\\\\\
- function shell.run( ... )\\\\\\\
- \\\\9return runLine( table.concat( { ... }, \\\\\\\" \\\\\\\" ) )\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.exit()\\\\\\\
- bExit = true\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.dir()\\\\\\\
- \\\\9return sDir\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.setDir( _sDir )\\\\\\\
- \\\\9sDir = _sDir\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.path()\\\\\\\
- \\\\9return sPath\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.setPath( _sPath )\\\\\\\
- \\\\9sPath = _sPath\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.resolve( _sPath )\\\\\\\
- \\\\9local sStartChar = string.sub( _sPath, 1, 1 )\\\\\\\
- \\\\9if sStartChar == \\\\\\\"/\\\\\\\" or sStartChar == \\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\" then\\\\\\\
- \\\\9\\\\9return fs.combine( \\\\\\\"\\\\\\\", _sPath )\\\\\\\
- \\\\9else\\\\\\\
- \\\\9\\\\9return fs.combine( sDir, _sPath )\\\\\\\
- \\\\9end\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.resolveProgram( _sCommand )\\\\\\\
- \\\\9-- Substitute aliases firsts\\\\\\\
- \\\\9if tAliases[ _sCommand ] ~= nil then\\\\\\\
- \\\\9\\\\9_sCommand = tAliases[ _sCommand ]\\\\\\\
- \\\\9end\\\\\\\
- \\\\\\\
- -- If the path is a global path, use it directly\\\\\\\
- local sStartChar = string.sub( _sCommand, 1, 1 )\\\\\\\
- if sStartChar == \\\\\\\"/\\\\\\\" or sStartChar == \\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\" then\\\\\\\
- \\\\9local sPath = fs.combine( \\\\\\\"\\\\\\\", _sCommand )\\\\\\\
- \\\\9if fs.exists( sPath ) and not fs.isDir( sPath ) then\\\\\\\
- \\\\9\\\\9\\\\9return sPath\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\9return nil\\\\\\\
- end\\\\\\\
- \\\\\\\
- \\\\9-- Otherwise, look on the path variable\\\\\\\
- for sPath in string.gmatch(sPath, \\\\\\\"[^:]+\\\\\\\") do\\\\\\\
- \\\\9sPath = fs.combine( shell.resolve( sPath ), _sCommand )\\\\\\\
- \\\\9if fs.exists( sPath ) and not fs.isDir( sPath ) then\\\\\\\
- \\\\9\\\\9\\\\9return sPath\\\\\\\
- \\\\9end\\\\\\\
- end\\\\\\\
- \\\\9\\\\\\\
- \\\\9-- Not found\\\\\\\
- \\\\9return nil\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.programs( _bIncludeHidden )\\\\\\\
- \\\\9local tItems = {}\\\\\\\
- \\\\9\\\\\\\
- \\\\9-- Add programs from the path\\\\\\\
- for sPath in string.gmatch(sPath, \\\\\\\"[^:]+\\\\\\\") do\\\\\\\
- \\\\9sPath = shell.resolve( sPath )\\\\\\\
- \\\\9\\\\9if fs.isDir( sPath ) then\\\\\\\
- \\\\9\\\\9\\\\9local tList = fs.list( sPath )\\\\\\\
- \\\\9\\\\9\\\\9for n,sFile in pairs( tList ) do\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if not fs.isDir( fs.combine( sPath, sFile ) ) and\\\\\\\
- \\\\9\\\\9\\\\9\\\\9 (_bIncludeHidden or string.sub( sFile, 1, 1 ) ~= \\\\\\\".\\\\\\\") then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9tItems[ sFile ] = true\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end\\\\\\\
- end\\\\9\\\\\\\
- \\\\\\\
- \\\\9-- Sort and return\\\\\\\
- \\\\9local tItemList = {}\\\\\\\
- \\\\9for sItem, b in pairs( tItems ) do\\\\\\\
- \\\\9\\\\9table.insert( tItemList, sItem )\\\\\\\
- \\\\9end\\\\\\\
- \\\\9table.sort( tItemList )\\\\\\\
- \\\\9return tItemList\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.getRunningProgram()\\\\\\\
- \\\\9if #tProgramStack > 0 then\\\\\\\
- \\\\9\\\\9return tProgramStack[#tProgramStack]\\\\\\\
- \\\\9end\\\\\\\
- \\\\9return nil\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.setAlias( _sCommand, _sProgram )\\\\\\\
- \\\\9tAliases[ _sCommand ] = _sProgram\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.clearAlias( _sCommand )\\\\\\\
- \\\\9tAliases[ _sCommand ] = nil\\\\\\\
- end\\\\\\\
- \\\\\\\
- function shell.aliases()\\\\\\\
- \\\\9-- Add aliases\\\\\\\
- \\\\9local tCopy = {}\\\\\\\
- \\\\9for sAlias, sCommand in pairs( tAliases ) do\\\\\\\
- \\\\9\\\\9tCopy[sAlias] = sCommand\\\\\\\
- \\\\9end\\\\\\\
- \\\\9return tCopy\\\\\\\
- end\\\\\\\
- \\\\9\\\\\\\
- term.setBackgroundColor( bgColour )\\\\\\\
- term.setTextColour( promptColour )\\\\\\\
- print( \\\\\\\"ReactOS NT v2.4\\\\\\\" )\\\\\\\
- term.setTextColour( textColour )\\\\\\\
- \\\\\\\
- -- If this is the toplevel shell, run the startup programs\\\\\\\
- if parentShell == nil then\\\\\\\
- \\\\9-- Run the startup from the ROM first\\\\\\\
- \\\\9local sRomStartup = shell.resolveProgram( \\\\\\\"/rom/startup\\\\\\\" )\\\\\\\
- \\\\9if sRomStartup then\\\\\\\
- \\\\9\\\\9shell.run( sRomStartup )\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9-- Then run the user created startup, from the disks or the root\\\\\\\
- \\\\9local sUserStartup = shell.resolveProgram( \\\\\\\"/startup\\\\\\\" )\\\\\\\
- \\\\9for n,sSide in pairs( redstone.getSides() ) do\\\\\\\
- \\\\9\\\\9if disk.isPresent( sSide ) and disk.hasData( sSide ) then\\\\\\\
- \\\\9\\\\9\\\\9local sDiskStartup = shell.resolveProgram( fs.combine(disk.getMountPath( sSide ), \\\\\\\"startup\\\\\\\") )\\\\\\\
- \\\\9\\\\9\\\\9if sDiskStartup then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9sUserStartup = sDiskStartup\\\\\\\
- \\\\9\\\\9\\\\9\\\\9break\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9if sUserStartup then\\\\\\\
- \\\\9\\\\9shell.run( sUserStartup )\\\\\\\
- \\\\9end\\\\\\\
- end\\\\\\\
- \\\\\\\
- -- Run any programs passed in as arguments\\\\\\\
- local tArgs = { ... }\\\\\\\
- if #tArgs > 0 then\\\\\\\
- \\\\9shell.run( ... )\\\\\\\
- end\\\\\\\
- \\\\\\\
- -- Read commands and execute them\\\\\\\
- local tCommandHistory = {}\\\\\\\
- while not bExit do\\\\\\\
- \\\\9term.setBackgroundColor( bgColour )\\\\\\\
- \\\\9term.setTextColour( promptColour )\\\\\\\
- \\\\9write( shell.dir() .. \\\\\\\"> \\\\\\\" )\\\\\\\
- \\\\9term.setTextColour( textColour )\\\\\\\
- \\\\\\\
- \\\\9local sLine = read( nil, tCommandHistory )\\\\\\\
- if string.find(sLine, \\\\\\\"rom/programs/\\\\\\\") then\\\\\\\
- printError(\\\\\\\"Access denied\\\\\\\")\\\\\\\
- return\\\\\\\
- end\\\\\\\
- \\\\9table.insert( tCommandHistory, sLine )\\\\\\\
- \\\\9runLine( sLine )\\\\\\\
- end\\\\\\\
- \\\\\\\
- -- If this is the toplevel shell, run the shutdown program\\\\\\\
- if parentShell == nil then\\\\\\\
- \\\\9if shell.resolveProgram( \\\\\\\"shutdown\\\\\\\" ) then\\\\\\\
- \\\\9\\\\9shell.run( \\\\\\\"shutdown\\\\\\\" )\\\\\\\
- \\\\9end\\\\\\\
- \\\\9os.shutdown() -- just in case\\\\\\\
- end\\\"\",\
- \"F:copy\",\
- \"\\\"\\\\\\\
- local tArgs = { ... }\\\\\\\
- if #tArgs < 2 then\\\\\\\
- \\\\9print( \\\\\\\"Usage: cp <source> <destination>\\\\\\\" )\\\\\\\
- \\\\9return\\\\\\\
- end\\\\\\\
- \\\\\\\
- local sSource = shell.resolve( tArgs[1] )\\\\\\\
- local sDest = shell.resolve( tArgs[2] )\\\\\\\
- if fs.exists( sDest ) and fs.isDir( sDest ) then\\\\\\\
- \\\\9sDest = fs.combine( sDest, fs.getName(sSource) )\\\\\\\
- end\\\\\\\
- \\\\\\\
- for _, value in pairs(files.list) do\\\\\\\
- if string.find(sSource, value) then\\\\\\\
- error(\\\\\\\"access to system files is denied\\\\\\\")\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- fs.copy( sSource, sDest )\\\"\",\
- \"F:delete\",\
- \"\\\"\\\\\\\
- local tArgs = { ... }\\\\\\\
- if #tArgs < 1 then\\\\\\\
- \\\\9print( \\\\\\\"Usage: rm <path>\\\\\\\" )\\\\\\\
- \\\\9return\\\\\\\
- end\\\\\\\
- \\\\\\\
- local sNewPath = shell.resolve( tArgs[1] )\\\\\\\
- \\\\\\\
- for _, value in pairs(files.list) do\\\\\\\
- if string.find(sNewPath, value) then\\\\\\\
- error(\\\\\\\"cannot remove system files\\\\\\\")\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- fs.delete( sNewPath )\\\"\",\
- \"F:edit\",\
- \"\\\"local tArgs = { ... }\\\\\\\
- if #tArgs == 0 then\\\\\\\
- \\\\9printError( \\\\\\\"Usage: edit <path>\\\\\\\" )\\\\\\\
- \\\\9return\\\\\\\
- end\\\\\\\
- \\\\\\\
- local sPath = shell.resolve( tArgs[1] )\\\\\\\
- local bReadOnly = fs.isReadOnly( sPath )\\\\\\\
- if fs.exists( sPath ) and fs.isDir( sPath ) then\\\\\\\
- \\\\9printError( \\\\\\\"KodiCo Editor cannot edit this directory.\\\\\\\" )\\\\\\\
- \\\\9return\\\\\\\
- elseif string.find( sPath, \\\\\\\"startup\\\\\\\" ) and rga.isActivated == false then\\\\\\\
- printError(\\\\\\\"Access to startup files is denied.\\\\\\\")\\\\\\\
- printError(\\\\\\\"Please register your copy of ReactOS.\\\\\\\")\\\\\\\
- return\\\\\\\
- else\\\\\\\
- for _, value in pairs(files.listEdit) do\\\\\\\
- if string.find( sPath, value ) then\\\\\\\
- printError(\\\\\\\"Access to system files is denied.\\\\\\\")\\\\\\\
- return\\\\\\\
- end\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- local x,y = 1,1\\\\\\\
- local w,h = term.getSize()\\\\\\\
- local scrollX, scrollY = 0,0\\\\\\\
- \\\\\\\
- local tLines = {}\\\\\\\
- local bRunning = true\\\\\\\
- \\\\\\\
- local highlightColour, keywordColour, commentColour, textColour, bgColour\\\\\\\
- if term.isColour() then\\\\\\\
- \\\\9bgColour = colours.black\\\\\\\
- \\\\9textColour = colours.white\\\\\\\
- \\\\9highlightColour = colours.red\\\\\\\
- \\\\9keywordColour = colours.yellow\\\\\\\
- \\\\9commentColour = colours.lime\\\\\\\
- \\\\9stringColour = colours.blue\\\\\\\
- else\\\\\\\
- \\\\9bgColour = colours.black\\\\\\\
- \\\\9textColour = colours.white\\\\\\\
- \\\\9highlightColour = colours.white\\\\\\\
- \\\\9keywordColour = colours.white\\\\\\\
- \\\\9commentColour = colours.white\\\\\\\
- \\\\9stringColour = colours.white\\\\\\\
- end\\\\\\\
- \\\\\\\
- local bMenu = false\\\\\\\
- local nMenuItem = 1\\\\\\\
- local tMenuItems = {\\\\\\\"Save\\\\\\\", \\\\\\\"Exit\\\\\\\", \\\\\\\"Print\\\\\\\"}\\\\\\\
- local sStatus = \\\\\\\"Press CTRL to access editor menu.\\\\\\\"\\\\\\\
- \\\\\\\
- local function load(_sPath)\\\\\\\
- \\\\9tLines = {}\\\\\\\
- \\\\9if fs.exists( _sPath ) then\\\\\\\
- \\\\9\\\\9local file = io.open( _sPath, \\\\\\\"r\\\\\\\" )\\\\\\\
- \\\\9\\\\9local sLine = file:read()\\\\\\\
- \\\\9\\\\9while sLine do\\\\\\\
- \\\\9\\\\9\\\\9table.insert( tLines, sLine )\\\\\\\
- \\\\9\\\\9\\\\9sLine = file:read()\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9file:close()\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9if #tLines == 0 then\\\\\\\
- \\\\9\\\\9table.insert( tLines, \\\\\\\"\\\\\\\" )\\\\\\\
- \\\\9end\\\\\\\
- end\\\\\\\
- \\\\\\\
- local function save( _sPath )\\\\\\\
- \\\\9-- Create intervening folder\\\\\\\
- \\\\9local sDir = sPath:sub(1, sPath:len() - fs.getName(sPath):len() )\\\\\\\
- \\\\9if not fs.exists( sDir ) then\\\\\\\
- \\\\9\\\\9fs.makeDir( sDir )\\\\\\\
- \\\\9end\\\\\\\
- \\\\\\\
- \\\\9-- Save\\\\\\\
- \\\\9local file = nil\\\\\\\
- \\\\9local function innerSave()\\\\\\\
- \\\\9\\\\9file = fs.open( _sPath, \\\\\\\"w\\\\\\\" )\\\\\\\
- \\\\9\\\\9if file then\\\\\\\
- \\\\9\\\\9\\\\9for n, sLine in ipairs( tLines ) do\\\\\\\
- \\\\9\\\\9\\\\9\\\\9file.write( sLine .. \\\\\\\"\\\\\\\\n\\\\\\\" )\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9error( \\\\\\\"Failed to open \\\\\\\".._sPath )\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9local ok = pcall( innerSave )\\\\\\\
- \\\\9if file then \\\\\\\
- \\\\9\\\\9file.close()\\\\\\\
- \\\\9end\\\\\\\
- \\\\9return ok\\\\\\\
- end\\\\\\\
- \\\\\\\
- local tKeywords = {\\\\\\\
- \\\\9[\\\\\\\"and\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"break\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"do\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"else\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"elseif\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"end\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"false\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"for\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"function\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"if\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"in\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"local\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"nil\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"not\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"or\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"repeat\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"return\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"then\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"true\\\\\\\"] = true,\\\\\\\
- \\\\9[\\\\\\\"until\\\\\\\"]= true,\\\\\\\
- \\\\9[\\\\\\\"while\\\\\\\"] = true,\\\\\\\
- [\\\\\\\"pairs\\\\\\\"] = true,\\\\\\\
- [\\\\\\\"ipairs\\\\\\\"] = true,\\\\\\\
- }\\\\\\\
- \\\\\\\
- local function tryWrite( sLine, regex, colour )\\\\\\\
- \\\\9local match = string.match( sLine, regex )\\\\\\\
- \\\\9if match then\\\\\\\
- \\\\9\\\\9if type(colour) == \\\\\\\"number\\\\\\\" then\\\\\\\
- \\\\9\\\\9\\\\9term.setTextColour( colour )\\\\\\\
- \\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9term.setTextColour( colour(match) )\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9term.write( match )\\\\\\\
- \\\\9\\\\9term.setTextColour( textColour )\\\\\\\
- \\\\9\\\\9return string.sub( sLine, string.len(match) + 1 )\\\\\\\
- \\\\9end\\\\\\\
- \\\\9return nil\\\\\\\
- end\\\\\\\
- \\\\\\\
- local function writeHighlighted( sLine )\\\\\\\
- \\\\9while string.len(sLine) > 0 do\\\\9\\\\\\\
- \\\\9\\\\9sLine = \\\\\\\
- \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^%-%-%[%[.-%]%]\\\\\\\", commentColour ) or\\\\\\\
- \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^%-%-.*\\\\\\\", commentColour ) or\\\\\\\
- \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^\\\\\\\\\\\\\\\".-[^\\\\\\\\\\\\\\\\]\\\\\\\\\\\\\\\"\\\\\\\", stringColour ) or\\\\\\\
- \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^\\\\\\\\'.-[^\\\\\\\\\\\\\\\\]\\\\\\\\'\\\\\\\", stringColour ) or\\\\\\\
- \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^%[%[.-%]%]\\\\\\\", stringColour ) or\\\\\\\
- \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^[%w_]+\\\\\\\", function( match )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if tKeywords[ match ] then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9return keywordColour\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9\\\\9return textColour\\\\\\\
- \\\\9\\\\9\\\\9end ) or\\\\\\\
- \\\\9\\\\9\\\\9tryWrite( sLine, \\\\\\\"^[^%w_]\\\\\\\", textColour )\\\\\\\
- \\\\9end\\\\\\\
- end\\\\\\\
- \\\\\\\
- local function redrawText()\\\\\\\
- \\\\9for y=1,h-1 do\\\\\\\
- \\\\9\\\\9term.setCursorPos( 1 - scrollX, y )\\\\\\\
- \\\\9\\\\9term.clearLine()\\\\\\\
- \\\\\\\
- \\\\9\\\\9local sLine = tLines[ y + scrollY ]\\\\\\\
- \\\\9\\\\9if sLine ~= nil then\\\\\\\
- \\\\9\\\\9\\\\9writeHighlighted( sLine )\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9end\\\\\\\
- \\\\9term.setCursorPos( x - scrollX, y - scrollY )\\\\\\\
- end\\\\\\\
- \\\\\\\
- local function redrawLine(_nY)\\\\\\\
- \\\\9local sLine = tLines[_nY]\\\\\\\
- \\\\9term.setCursorPos( 1 - scrollX, _nY - scrollY )\\\\\\\
- \\\\9term.clearLine()\\\\\\\
- \\\\9writeHighlighted( sLine )\\\\\\\
- \\\\9term.setCursorPos( x - scrollX, _nY - scrollY )\\\\\\\
- end\\\\\\\
- \\\\\\\
- local function setLeftStatus()\\\\\\\
- end\\\\\\\
- \\\\\\\
- local function redrawMenu()\\\\\\\
- term.setCursorPos( 1, h )\\\\\\\
- \\\\9term.clearLine()\\\\\\\
- \\\\\\\
- \\\\9local sLeft, sRight\\\\\\\
- \\\\9local nLeftColour, nLeftHighlight1, nLeftHighlight2\\\\\\\
- \\\\9if bMenu then\\\\\\\
- \\\\9\\\\9local sMenu = \\\\\\\"\\\\\\\"\\\\\\\
- \\\\9\\\\9for n,sItem in ipairs( tMenuItems ) do\\\\\\\
- \\\\9\\\\9\\\\9if n == nMenuItem then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9nLeftHighlight1 = sMenu:len() + 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9nLeftHighlight2 = sMenu:len() + sItem:len() + 2\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9sMenu = sMenu..\\\\\\\" \\\\\\\"..sItem..\\\\\\\" \\\\\\\"\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9sLeft = sMenu\\\\\\\
- \\\\9\\\\9nLeftColour = textColour\\\\\\\
- \\\\9else\\\\\\\
- \\\\9\\\\9sLeft = sStatus\\\\\\\
- \\\\9\\\\9nLeftColour = highlightColour\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9-- Left goes last so that it can overwrite the line numbers.\\\\\\\
- \\\\9sRight = \\\\\\\"Ln \\\\\\\"..y\\\\\\\
- \\\\9term.setTextColour( highlightColour )\\\\\\\
- \\\\9term.setCursorPos( w-sRight:len() + 1, h )\\\\\\\
- \\\\9term.write(sRight)\\\\\\\
- \\\\\\\
- \\\\9sRight = tostring(y)\\\\\\\
- \\\\9term.setTextColour( textColour )\\\\\\\
- \\\\9term.setCursorPos( w-sRight:len() + 1, h )\\\\\\\
- \\\\9term.write(sRight)\\\\\\\
- \\\\\\\
- \\\\9if sLeft then\\\\\\\
- \\\\9\\\\9term.setCursorPos( 1, h )\\\\\\\
- \\\\9\\\\9term.setTextColour( nLeftColour )\\\\\\\
- \\\\9\\\\9term.write(sLeft)\\\\9\\\\9\\\\\\\
- \\\\9\\\\9if nLeftHighlight1 then\\\\\\\
- \\\\9\\\\9\\\\9term.setTextColour( highlightColour )\\\\\\\
- \\\\9\\\\9\\\\9term.setCursorPos( nLeftHighlight1, h )\\\\\\\
- \\\\9\\\\9\\\\9term.write( \\\\\\\"[\\\\\\\" )\\\\\\\
- \\\\9\\\\9\\\\9term.setCursorPos( nLeftHighlight2, h )\\\\\\\
- \\\\9\\\\9\\\\9term.write( \\\\\\\"]\\\\\\\" )\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9term.setTextColour( textColour )\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9-- Cursor highlights selection\\\\\\\
- \\\\9term.setCursorPos( x - scrollX, y - scrollY )\\\\\\\
- end\\\\\\\
- \\\\\\\
- local tMenuFuncs = { \\\\\\\
- \\\\9Save=function()\\\\\\\
- \\\\9\\\\9if bReadOnly then\\\\\\\
- \\\\9\\\\9\\\\9sStatus = \\\\\\\"Access denied\\\\\\\"\\\\\\\
- \\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9local ok, err = save( sPath )\\\\\\\
- \\\\9\\\\9\\\\9if ok then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9sStatus=\\\\\\\"Saved to \\\\\\\"..sPath\\\\\\\
- \\\\9\\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9\\\\9sStatus=\\\\\\\"Error saving to \\\\\\\"..sPath\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9redrawMenu()\\\\\\\
- \\\\9end,\\\\\\\
- \\\\9Print=function()\\\\\\\
- \\\\9\\\\9local sPrinterSide = nil\\\\\\\
- \\\\9\\\\9for n,sSide in ipairs(rs.getSides()) do\\\\\\\
- \\\\9\\\\9\\\\9if peripheral.isPresent(sSide) and peripheral.getType(sSide) == \\\\\\\"printer\\\\\\\" then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9sPrinterSide = sSide\\\\\\\
- \\\\9\\\\9\\\\9\\\\9break\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9\\\\9if not sPrinterSide then\\\\\\\
- \\\\9\\\\9\\\\9sStatus = \\\\\\\"No printer attached\\\\\\\"\\\\\\\
- \\\\9\\\\9\\\\9return\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\\\\
- \\\\9\\\\9local nPage = 0\\\\\\\
- \\\\9\\\\9local sName = fs.getName( sPath )\\\\\\\
- \\\\9\\\\9local printer = peripheral.wrap(sPrinterSide)\\\\\\\
- \\\\9\\\\9if printer.getInkLevel() < 1 then\\\\\\\
- \\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer out of ink\\\\\\\"\\\\\\\
- \\\\9\\\\9\\\\9return\\\\\\\
- \\\\9\\\\9elseif printer.getPaperLevel() < 1 then\\\\\\\
- \\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer out of paper\\\\\\\"\\\\\\\
- \\\\9\\\\9\\\\9return\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9\\\\9local terminal = {\\\\\\\
- \\\\9\\\\9\\\\9getCursorPos = printer.getCursorPos,\\\\\\\
- \\\\9\\\\9\\\\9setCursorPos = printer.setCursorPos,\\\\\\\
- \\\\9\\\\9\\\\9getSize = printer.getPageSize,\\\\\\\
- \\\\9\\\\9\\\\9write = printer.write,\\\\\\\
- \\\\9\\\\9}\\\\\\\
- \\\\9\\\\9terminal.scroll = function()\\\\\\\
- \\\\9\\\\9\\\\9if nPage == 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9printer.setPageTitle( sName..\\\\\\\" (page \\\\\\\"..nPage..\\\\\\\")\\\\\\\" )\\\\9\\\\9\\\\9\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9\\\\\\\
- \\\\9\\\\9\\\\9while not printer.newPage()\\\\9do\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if printer.getInkLevel() < 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer out of ink, please refill\\\\\\\"\\\\\\\
- \\\\9\\\\9\\\\9\\\\9elseif printer.getPaperLevel() < 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer out of paper, please refill\\\\\\\"\\\\\\\
- \\\\9\\\\9\\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer output tray full, please empty\\\\\\\"\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9\\\\9\\\\9\\\\9term.restore()\\\\\\\
- \\\\9\\\\9\\\\9\\\\9redrawMenu()\\\\\\\
- \\\\9\\\\9\\\\9\\\\9term.redirect( terminal )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\\\\
- \\\\9\\\\9\\\\9\\\\9local timer = os.startTimer(0.5)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9sleep(0.5)\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\\\\
- \\\\9\\\\9\\\\9nPage = nPage + 1\\\\\\\
- \\\\9\\\\9\\\\9if nPage == 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9printer.setPageTitle( sName )\\\\\\\
- \\\\9\\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9\\\\9printer.setPageTitle( sName..\\\\\\\" (page \\\\\\\"..nPage..\\\\\\\")\\\\\\\" )\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9\\\\9bMenu = false\\\\\\\
- \\\\9\\\\9term.redirect( terminal )\\\\\\\
- \\\\9\\\\9local ok, error = pcall( function()\\\\\\\
- \\\\9\\\\9\\\\9term.scroll()\\\\\\\
- \\\\9\\\\9\\\\9for n, sLine in ipairs( tLines ) do\\\\\\\
- \\\\9\\\\9\\\\9\\\\9print( sLine )\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end )\\\\\\\
- \\\\9\\\\9term.restore()\\\\\\\
- \\\\9\\\\9if not ok then\\\\\\\
- \\\\9\\\\9\\\\9print( error )\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9\\\\9while not printer.endPage() do\\\\\\\
- \\\\9\\\\9\\\\9sStatus = \\\\\\\"Printer output tray full, please empty\\\\\\\"\\\\\\\
- \\\\9\\\\9\\\\9redrawMenu()\\\\\\\
- \\\\9\\\\9\\\\9sleep( 0.5 )\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9bMenu = true\\\\\\\
- \\\\9\\\\9\\\\9\\\\\\\
- \\\\9\\\\9if nPage > 1 then\\\\\\\
- \\\\9\\\\9\\\\9sStatus = \\\\\\\"Printed \\\\\\\"..nPage..\\\\\\\" Pages\\\\\\\"\\\\\\\
- \\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9sStatus = \\\\\\\"Printed 1 Page\\\\\\\"\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9redrawMenu()\\\\\\\
- \\\\9end,\\\\\\\
- \\\\9Exit=function()\\\\\\\
- \\\\9\\\\9bRunning = false\\\\\\\
- \\\\9end\\\\\\\
- }\\\\\\\
- \\\\\\\
- local function doMenuItem( _n )\\\\\\\
- \\\\9tMenuFuncs[tMenuItems[_n]]()\\\\\\\
- \\\\9if bMenu then\\\\\\\
- \\\\9\\\\9bMenu = false\\\\\\\
- \\\\9\\\\9term.setCursorBlink( true )\\\\\\\
- \\\\9end\\\\\\\
- \\\\9redrawMenu()\\\\\\\
- end\\\\\\\
- \\\\\\\
- local function setCursor( x, y )\\\\\\\
- \\\\9local screenX = x - scrollX\\\\\\\
- \\\\9local screenY = y - scrollY\\\\\\\
- \\\\9\\\\\\\
- \\\\9local bRedraw = false\\\\\\\
- \\\\9if screenX < 1 then\\\\\\\
- \\\\9\\\\9scrollX = x - 1\\\\\\\
- \\\\9\\\\9screenX = 1\\\\\\\
- \\\\9\\\\9bRedraw = true\\\\\\\
- \\\\9elseif screenX > w then\\\\\\\
- \\\\9\\\\9scrollX = x - w\\\\\\\
- \\\\9\\\\9screenX = w\\\\\\\
- \\\\9\\\\9bRedraw = true\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9if screenY < 1 then\\\\\\\
- \\\\9\\\\9scrollY = y - 1\\\\\\\
- \\\\9\\\\9screenY = 1\\\\\\\
- \\\\9\\\\9bRedraw = true\\\\\\\
- \\\\9elseif screenY > h-1 then\\\\\\\
- \\\\9\\\\9scrollY = y - (h-1)\\\\\\\
- \\\\9\\\\9screenY = h-1\\\\\\\
- \\\\9\\\\9bRedraw = true\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9if bRedraw then\\\\\\\
- \\\\9\\\\9redrawText()\\\\\\\
- \\\\9end\\\\\\\
- \\\\9term.setCursorPos( screenX, screenY )\\\\\\\
- \\\\9\\\\\\\
- \\\\9-- Statusbar now pertains to menu, it would probably be safe to redraw the menu on every key event.\\\\\\\
- \\\\9redrawMenu()\\\\\\\
- end\\\\\\\
- \\\\\\\
- -- Actual program functionality begins\\\\\\\
- load(sPath)\\\\\\\
- \\\\\\\
- term.setBackgroundColour( bgColour )\\\\\\\
- term.clear()\\\\\\\
- term.setCursorPos(x,y)\\\\\\\
- term.setCursorBlink( true )\\\\\\\
- \\\\\\\
- redrawText()\\\\\\\
- redrawMenu()\\\\\\\
- \\\\\\\
- -- Handle input\\\\\\\
- while bRunning do\\\\\\\
- \\\\9local sEvent, param, param2, param3 = os.pullEvent()\\\\\\\
- \\\\9if sEvent == \\\\\\\"key\\\\\\\" then\\\\\\\
- \\\\9\\\\9if param == keys.up then\\\\\\\
- \\\\9\\\\9\\\\9-- Up\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if y > 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9-- Move cursor up\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9y = y - 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9x = math.min( x, string.len( tLines[y] ) + 1 )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.down then\\\\\\\
- \\\\9\\\\9\\\\9-- Down\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Move cursor down\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if y < #tLines then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9y = y + 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9x = math.min( x, string.len( tLines[y] ) + 1 )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.tab then\\\\\\\
- \\\\9\\\\9\\\\9-- Tab\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9local sLine = tLines[y]\\\\\\\
- \\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Indent line\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- IN CASE OF INSERT TAB IN PLACE:\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- tLines[y] = string.sub(sLine,1,x-1) .. \\\\\\\" \\\\\\\" .. string.sub(sLine,x)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9tLines[y]=\\\\\\\" \\\\\\\"..tLines[y]\\\\\\\
- \\\\9\\\\9\\\\9\\\\9x = x + 2\\\\\\\
- \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9redrawLine(y)\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.pageUp then\\\\\\\
- \\\\9\\\\9\\\\9-- Page Up\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Move up a page\\\\\\\
- \\\\9\\\\9\\\\9\\\\9local sx,sy=term.getSize()\\\\\\\
- \\\\9\\\\9\\\\9\\\\9y=y-sy-1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if y<1 then\\\\9y=1 end\\\\\\\
- \\\\9\\\\9\\\\9\\\\9x = math.min( x, string.len( tLines[y] ) + 1 )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.pageDown then\\\\\\\
- \\\\9\\\\9\\\\9-- Page Down\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Move down a page\\\\\\\
- \\\\9\\\\9\\\\9\\\\9local sx,sy=term.getSize()\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if y<#tLines-sy-1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9y = y+sy-1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9y = #tLines\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9\\\\9x = math.min( x, string.len( tLines[y] ) + 1 )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.home then\\\\\\\
- \\\\9\\\\9\\\\9-- Home\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Move cursor to the beginning\\\\\\\
- \\\\9\\\\9\\\\9\\\\9x=1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9setCursor(x,y)\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys[\\\\\\\"end\\\\\\\"] then\\\\\\\
- \\\\9\\\\9\\\\9-- End\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Move cursor to the end\\\\\\\
- \\\\9\\\\9\\\\9\\\\9x = string.len( tLines[y] ) + 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9setCursor(x,y)\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.left then\\\\\\\
- \\\\9\\\\9\\\\9-- Left\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if x > 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9-- Move cursor left\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9x = x - 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9elseif x==1 and y>1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9x = string.len( tLines[y-1] ) + 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9y = y - 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Move menu left\\\\\\\
- \\\\9\\\\9\\\\9\\\\9nMenuItem = nMenuItem - 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if nMenuItem < 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9nMenuItem = #tMenuItems\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9\\\\9redrawMenu()\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.right then\\\\\\\
- \\\\9\\\\9\\\\9-- Right\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if x < string.len( tLines[y] ) + 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9-- Move cursor right\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9x = x + 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9elseif x==string.len( tLines[y] ) + 1 and y<#tLines then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9x = 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9y = y + 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Move menu right\\\\\\\
- \\\\9\\\\9\\\\9\\\\9nMenuItem = nMenuItem + 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if nMenuItem > #tMenuItems then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9nMenuItem = 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9\\\\9redrawMenu()\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.delete then\\\\\\\
- \\\\9\\\\9\\\\9-- Delete\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if x < string.len( tLines[y] ) + 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9local sLine = tLines[y]\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9tLines[y] = string.sub(sLine,1,x-1) .. string.sub(sLine,x+1)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9redrawLine(y)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9elseif y<#tLines then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9tLines[y] = tLines[y] .. tLines[y+1]\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9table.remove( tLines, y+1 )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9redrawText()\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9redrawMenu()\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.backspace then\\\\\\\
- \\\\9\\\\9\\\\9-- Backspace\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if x > 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9-- Remove character\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9local sLine = tLines[y]\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9tLines[y] = string.sub(sLine,1,x-2) .. string.sub(sLine,x)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9redrawLine(y)\\\\\\\
- \\\\9\\\\9\\\\9\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9x = x - 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9elseif y > 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9-- Remove newline\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9local sPrevLen = string.len( tLines[y-1] )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9tLines[y-1] = tLines[y-1] .. tLines[y]\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9table.remove( tLines, y )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9redrawText()\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9x = sPrevLen + 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9y = y - 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.enter then\\\\\\\
- \\\\9\\\\9\\\\9-- Enter\\\\\\\
- \\\\9\\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Newline\\\\\\\
- \\\\9\\\\9\\\\9\\\\9local sLine = tLines[y]\\\\\\\
- \\\\9\\\\9\\\\9\\\\9local _,spaces=string.find(sLine,\\\\\\\"^[ ]+\\\\\\\")\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if not spaces then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9spaces=0\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9\\\\9tLines[y] = string.sub(sLine,1,x-1)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9table.insert( tLines, y+1, string.rep(' ',spaces)..string.sub(sLine,x) )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9redrawText()\\\\\\\
- \\\\9\\\\9\\\\9\\\\\\\
- \\\\9\\\\9\\\\9\\\\9x = spaces+1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9y = y + 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Menu selection\\\\\\\
- \\\\9\\\\9\\\\9\\\\9doMenuItem( nMenuItem )\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9elseif param == keys.leftCtrl or param == keys.rightCtrl then\\\\\\\
- \\\\9\\\\9\\\\9-- Menu toggle\\\\\\\
- \\\\9\\\\9\\\\9bMenu = not bMenu\\\\\\\
- \\\\9\\\\9\\\\9if bMenu then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9term.setCursorBlink( false )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9nMenuItem = 1\\\\\\\
- \\\\9\\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9\\\\9term.setCursorBlink( true )\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9redrawMenu()\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9elseif sEvent == \\\\\\\"char\\\\\\\" then\\\\\\\
- \\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9-- Input text\\\\\\\
- \\\\9\\\\9\\\\9local sLine = tLines[y]\\\\\\\
- \\\\9\\\\9\\\\9tLines[y] = string.sub(sLine,1,x-1) .. param .. string.sub(sLine,x)\\\\\\\
- \\\\9\\\\9\\\\9redrawLine(y)\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9\\\\9\\\\9x = x + string.len( param )\\\\\\\
- \\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9-- Select menu items\\\\\\\
- \\\\9\\\\9\\\\9for n,sMenuItem in ipairs( tMenuItems ) do\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if string.lower(string.sub(sMenuItem,1,1)) == string.lower(param) then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9doMenuItem( n )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9break\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9elseif sEvent == \\\\\\\"mouse_click\\\\\\\" then\\\\\\\
- \\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9if param == 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Left click\\\\\\\
- \\\\9\\\\9\\\\9\\\\9local cx,cy = param2, param3\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if cy < h then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9y = math.min( math.max( scrollY + cy, 1 ), #tLines )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9x = math.min( math.max( scrollX + cx, 1 ), string.len( tLines[y] ) + 1 )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9setCursor( x, y )\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9elseif sEvent == \\\\\\\"mouse_scroll\\\\\\\" then\\\\\\\
- \\\\9\\\\9if not bMenu then\\\\\\\
- \\\\9\\\\9\\\\9if param == -1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Scroll up\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if scrollY > 0 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9-- Move cursor up\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9scrollY = scrollY - 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9redrawText()\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9\\\\\\\
- \\\\9\\\\9\\\\9elseif param == 1 then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9-- Scroll down\\\\\\\
- \\\\9\\\\9\\\\9\\\\9local nMaxScroll = #tLines - (h-1)\\\\\\\
- \\\\9\\\\9\\\\9\\\\9if scrollY < nMaxScroll then\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9-- Move cursor down\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9scrollY = scrollY + 1\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\9redrawText()\\\\\\\
- \\\\9\\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\\\\
- \\\\9\\\\9\\\\9end\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9end\\\\\\\
- end\\\\\\\
- \\\\\\\
- -- Cleanup\\\\\\\
- term.clear()\\\\\\\
- term.setCursorBlink( false )\\\\\\\
- term.setCursorPos( 1, 1 )\\\"\",\
- \"F:list\",\
- \"\\\"\\\\\\\
- local tArgs = { ... }\\\\\\\
- \\\\\\\
- -- Get all the files in the directory\\\\\\\
- local sDir = shell.dir()\\\\\\\
- if tArgs[1] ~= nil then\\\\\\\
- \\\\9sDir = shell.resolve( tArgs[1] )\\\\\\\
- end\\\\\\\
- \\\\\\\
- -- Sort into dirs/files, and calculate column count\\\\\\\
- local tAll = fs.list( sDir )\\\\\\\
- local tFiles = {}\\\\\\\
- local tDirs = {}\\\\\\\
- \\\\\\\
- for n, sItem in pairs( tAll ) do\\\\\\\
- \\\\9if string.sub( sItem, 1, 1 ) ~= \\\\\\\".\\\\\\\" then\\\\\\\
- \\\\9\\\\9local sPath = fs.combine( sDir, sItem )\\\\\\\
- \\\\9\\\\9if fs.isDir( sPath ) then\\\\\\\
- \\\\9\\\\9\\\\9table.insert( tDirs, sItem )\\\\\\\
- \\\\9\\\\9else\\\\\\\
- \\\\9\\\\9\\\\9table.insert( tFiles, sItem )\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9end\\\\\\\
- end\\\\\\\
- table.sort( tDirs )\\\\\\\
- table.sort( tFiles )\\\\\\\
- term.setTextColor(colors.cyan)\\\\\\\
- print(\\\\\\\"Files Explorer:\\\\\\\")\\\\\\\
- if term.isColour() then\\\\\\\
- \\\\9textutils.pagedTabulate( colors.orange, tDirs, colours.red, tFiles )\\\\\\\
- else\\\\\\\
- \\\\9textutils.pagedTabulate( tDirs, tFiles )\\\\\\\
- end\\\"\",\
- \"F:lua\",\
- \"\\\"\\\\\\\
- local bRunning = true\\\\\\\
- local tCommandHistory = {}\\\\\\\
- local tEnv = {\\\\\\\
- \\\\9[\\\\\\\"leave\\\\\\\"] = function()\\\\\\\
- \\\\9\\\\9bRunning = false\\\\\\\
- \\\\9end,\\\\\\\
- [\\\\\\\"help\\\\\\\"] = function()\\\\\\\
- print([[\\\\\\\
- Welcome to the ReactOS Lua Prompt.\\\\\\\
- We hope you will find it useful for developing\\\\\\\
- your own ReactOS programs.\\\\\\\
- Be advised that the Lua Prompt itself is not\\\\\\\
- for running Lua programs - just type their\\\\\\\
- names in the command prompt to run them.\\\\\\\
- Also note that the ReactOS Lua Prompt is only\\\\\\\
- available in a valid, licensed copy of ReactOS.\\\\\\\
- \\\\\\\
- To exit, type leave() in the prompt.\\\\\\\
- ]])\\\\\\\
- end,\\\\\\\
- }\\\\\\\
- \\\\\\\
- if not rga.isActivated then\\\\\\\
- error(\\\\\\\"ReactOS is not activated\\\\\\\")\\\\\\\
- end\\\\\\\
- \\\\\\\
- setmetatable( tEnv, { __index = getfenv() } )\\\\\\\
- \\\\\\\
- if term.isColour() then\\\\\\\
- \\\\9term.setTextColour( colours.yellow )\\\\\\\
- end\\\\\\\
- print( \\\\\\\"ReactOS Lua Prompt\\\\\\\" )\\\\\\\
- term.setTextColour( colours.white )\\\\\\\
- print( \\\\\\\"Type help() for help \\\\\\\")\\\\\\\
- \\\\\\\
- while bRunning do\\\\\\\
- \\\\9--if term.isColour() then\\\\\\\
- \\\\9--\\\\9term.setTextColour( colours.yellow )\\\\\\\
- \\\\9--end\\\\\\\
- \\\\9write( \\\\\\\"Lua >> \\\\\\\" )\\\\\\\
- \\\\9--term.setTextColour( colours.white )\\\\\\\
- \\\\9\\\\\\\
- \\\\9local s = read( nil, tCommandHistory )\\\\\\\
- \\\\9table.insert( tCommandHistory, s )\\\\\\\
- \\\\9\\\\\\\
- \\\\9local nForcePrint = 0\\\\\\\
- \\\\9local func, e = loadstring( s, \\\\\\\"lua\\\\\\\" )\\\\\\\
- \\\\9local func2, e2 = loadstring( \\\\\\\"return \\\\\\\"..s, \\\\\\\"lua\\\\\\\" )\\\\\\\
- \\\\9if not func then\\\\\\\
- \\\\9\\\\9if func2 then\\\\\\\
- \\\\9\\\\9\\\\9func = func2\\\\\\\
- \\\\9\\\\9\\\\9e = nil\\\\\\\
- \\\\9\\\\9\\\\9nForcePrint = 1\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9else\\\\\\\
- \\\\9\\\\9if func2 then\\\\\\\
- \\\\9\\\\9\\\\9func = func2\\\\\\\
- \\\\9\\\\9end\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9if func then\\\\\\\
- setfenv( func, tEnv )\\\\\\\
- local tResults = { pcall( function() return func() end ) }\\\\\\\
- if tResults[1] then\\\\\\\
- \\\\9local n = 1\\\\\\\
- \\\\9while (tResults[n + 1] ~= nil) or (n <= nForcePrint) do\\\\\\\
- \\\\9\\\\9print( tostring( tResults[n + 1] ) )\\\\\\\
- \\\\9\\\\9n = n + 1\\\\\\\
- \\\\9end\\\\\\\
- else\\\\\\\
- \\\\9printError( tResults[2] )\\\\\\\
- end\\\\\\\
- else\\\\\\\
- \\\\9printError( e )\\\\\\\
- end\\\\\\\
- \\\\\\\
- end\\\"\",\
- \"F:mkdir\",\
- \"\\\"local tArgs = { ... }\\\\\\\
- if #tArgs < 1 then\\\\\\\
- \\\\9print( \\\\\\\"Usage: mkdir <path>\\\\\\\" )\\\\\\\
- \\\\9return\\\\\\\
- end\\\\\\\
- \\\\\\\
- local sNewDir = shell.resolve( tArgs[1] )\\\\\\\
- fs.makeDir( sNewDir )\\\\\\\
- print(\\\\\\\"New directory created! You can open it using\\\\\\\")\\\\\\\
- print(\\\\\\\"cd \\\\\\\"..tArgs[1])\\\\\\\
- \\\\\\\
- \\\"\",\
- \"F:modem\",\
- \"\\\"local mArgs = {...}\\\\\\\
- local help = \\\\\\\"modem <open/close/status/help>\\\\\\\"\\\\\\\
- \\\\\\\
- function autoOpen()\\\\\\\
- for _, v in pairs(rs.getSides()) do\\\\\\\
- if peripheral.isPresent(v) and peripheral.getType(v) == \\\\\\\"modem\\\\\\\" then\\\\\\\
- if not rednet.isOpen(v) then\\\\\\\
- rednet.open(v)\\\\\\\
- print(\\\\\\\"Modem opened on \\\\\\\"..v..\\\\\\\" side\\\\\\\")\\\\\\\
- else\\\\\\\
- printError(\\\\\\\"Modem on \\\\\\\"..v..\\\\\\\" side already open\\\\\\\")\\\\\\\
- end\\\\\\\
- end\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- function autoClose()\\\\\\\
- for _, v in pairs(rs.getSides()) do\\\\\\\
- if peripheral.isPresent(v) and peripheral.getType(v) == \\\\\\\"modem\\\\\\\" then\\\\\\\
- if rednet.isOpen(v) then\\\\\\\
- rednet.close(v)\\\\\\\
- print(\\\\\\\"Modem closed on \\\\\\\"..v..\\\\\\\" side\\\\\\\")\\\\\\\
- else\\\\\\\
- printError(\\\\\\\"Modem on \\\\\\\"..v..\\\\\\\" side already closed\\\\\\\")\\\\\\\
- end\\\\\\\
- end\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- function list()\\\\\\\
- for _, v in pairs(rs.getSides()) do\\\\\\\
- if peripheral.isPresent(v) and peripheral.getType(v) == \\\\\\\"modem\\\\\\\" then\\\\\\\
- print(\\\\\\\"Modem detected on \\\\\\\"..v..\\\\\\\" side\\\\\\\")\\\\\\\
- if rednet.isOpen(v) then\\\\\\\
- print(\\\\\\\"Modem is open\\\\\\\")\\\\\\\
- elseif not rednet.isOpen(v) then\\\\\\\
- print(\\\\\\\"Modem is closed\\\\\\\")\\\\\\\
- end\\\\\\\
- end\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- if #mArgs < 1 then\\\\\\\
- print(help)\\\\\\\
- else\\\\\\\
- if mArgs[1] == \\\\\\\"open\\\\\\\" then\\\\\\\
- autoOpen()\\\\\\\
- elseif mArgs[1] == \\\\\\\"close\\\\\\\" then\\\\\\\
- autoClose()\\\\\\\
- elseif mArgs[1] == \\\\\\\"status\\\\\\\" then\\\\\\\
- list()\\\\\\\
- elseif mArgs[1] == \\\\\\\"help\\\\\\\" then\\\\\\\
- print(help)\\\\\\\
- end\\\\\\\
- end\\\"\",\
- \"F:move\",\
- \"\\\"\\\\\\\
- local tArgs = { ... }\\\\\\\
- if #tArgs < 2 then\\\\\\\
- \\\\9print( \\\\\\\"Usage: mv <source> <destination>\\\\\\\" )\\\\\\\
- \\\\9return\\\\\\\
- end\\\\\\\
- \\\\\\\
- local sSource = shell.resolve( tArgs[1] )\\\\\\\
- local sDest = shell.resolve( tArgs[2] )\\\\\\\
- if fs.exists( sDest ) and fs.isDir( sDest ) then\\\\\\\
- \\\\9sDest = fs.combine( sDest, fs.getName(sSource) )\\\\\\\
- end\\\\\\\
- \\\\\\\
- for _, value in pairs(files.list) do\\\\\\\
- if string.find(sSource, value) or string.find(sDest, value) then\\\\\\\
- error(\\\\\\\"access to system files is denied\\\\\\\")\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- fs.move( sSource, sDest )\\\"\",\
- \"F:pastebin\",\
- \"\\\"\\\\\\\
- local function printUsage()\\\\\\\
- \\\\9print( \\\\\\\"Usages:\\\\\\\" )\\\\\\\
- \\\\9print( \\\\\\\"pastebin put <filename>\\\\\\\" )\\\\\\\
- \\\\9print( \\\\\\\"pastebin get <code> <filename>\\\\\\\" )\\\\\\\
- end\\\\\\\
- \\\\\\\
- local tArgs = { ... }\\\\\\\
- if #tArgs < 2 then\\\\\\\
- \\\\9printUsage()\\\\\\\
- \\\\9return\\\\\\\
- end\\\\\\\
- \\\\\\\
- if not http then\\\\\\\
- \\\\9print( \\\\\\\"Pastebin requires http API\\\\\\\" )\\\\\\\
- \\\\9print( \\\\\\\"Set enableAPI_http to 1 in mod_ComputerCraft.cfg\\\\\\\" )\\\\\\\
- \\\\9return\\\\\\\
- end\\\\\\\
- \\\\\\\
- if not rga.isActivated then\\\\\\\
- error(\\\\\\\"ReactOS is not activated\\\\\\\")\\\\\\\
- end\\\\\\\
- \\\\\\\
- local sCommand = tArgs[1]\\\\\\\
- if sCommand == \\\\\\\"put\\\\\\\" then\\\\\\\
- \\\\9-- Upload a file to pastebin.com\\\\\\\
- \\\\9-- Determine file to upload\\\\\\\
- \\\\9local sFile = tArgs[2]\\\\\\\
- \\\\9local sPath = shell.resolve( sFile )\\\\\\\
- \\\\9if not fs.exists( sPath ) or fs.isDir( sPath ) then\\\\\\\
- \\\\9\\\\9print( \\\\\\\"No such file\\\\\\\" )\\\\\\\
- \\\\9\\\\9return\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9-- Read in the file\\\\\\\
- \\\\9local sName = fs.getName( sPath )\\\\\\\
- \\\\9local file = fs.open( sPath, \\\\\\\"r\\\\\\\" )\\\\\\\
- \\\\9local sText = file.readAll()\\\\\\\
- \\\\9file.close()\\\\\\\
- \\\\9\\\\\\\
- \\\\9-- POST the contents to pastebin\\\\\\\
- \\\\9write( \\\\\\\"Connecting to pastebin.com... \\\\\\\" )\\\\\\\
- \\\\9local key = \\\\\\\"0ec2eb25b6166c0c27a394ae118ad829\\\\\\\"\\\\\\\
- \\\\9local response = http.post(\\\\\\\
- \\\\9\\\\9\\\\\\\"http://pastebin.com/api/api_post.php\\\\\\\", \\\\\\\
- \\\\9\\\\9\\\\\\\"api_option=paste&\\\\\\\"..\\\\\\\
- \\\\9\\\\9\\\\\\\"api_dev_key=\\\\\\\"..key..\\\\\\\"&\\\\\\\"..\\\\\\\
- \\\\9\\\\9\\\\\\\"api_paste_format=lua&\\\\\\\"..\\\\\\\
- \\\\9\\\\9\\\\\\\"api_paste_name=\\\\\\\"..textutils.urlEncode(sName)..\\\\\\\"&\\\\\\\"..\\\\\\\
- \\\\9\\\\9\\\\\\\"api_paste_code=\\\\\\\"..textutils.urlEncode(sText)\\\\\\\
- \\\\9\\\\9)\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9if response then\\\\\\\
- \\\\9\\\\9print( \\\\\\\"Success.\\\\\\\" )\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9\\\\9local sResponse = response.readAll()\\\\\\\
- \\\\9\\\\9response.close()\\\\\\\
- \\\\9\\\\9\\\\9\\\\9\\\\\\\
- \\\\9\\\\9local sCode = string.match( sResponse, \\\\\\\"[^/]+$\\\\\\\" )\\\\\\\
- \\\\9\\\\9print( \\\\\\\"Uploaded as \\\\\\\"..sResponse )\\\\\\\
- \\\\9\\\\9print( \\\\\\\"Run \\\\\\\\\\\\\\\"pastebin get \\\\\\\"..sCode..\\\\\\\"\\\\\\\\\\\\\\\" to download anywhere\\\\\\\" )\\\\\\\
- \\\\\\\
- \\\\9else\\\\\\\
- \\\\9\\\\9print( \\\\\\\"Failed.\\\\\\\" )\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- elseif sCommand == \\\\\\\"get\\\\\\\" then\\\\\\\
- \\\\9-- Download a file from pastebin.com\\\\\\\
- \\\\9if #tArgs < 3 then\\\\\\\
- \\\\9\\\\9printUsage()\\\\\\\
- \\\\9\\\\9return\\\\\\\
- \\\\9end\\\\\\\
- \\\\\\\
- \\\\9-- Determine file to download\\\\\\\
- \\\\9local sCode = tArgs[2]\\\\\\\
- \\\\9local sFile = tArgs[3]\\\\\\\
- \\\\9local sPath = shell.resolve( sFile )\\\\\\\
- \\\\9if fs.exists( sPath ) then\\\\\\\
- \\\\9\\\\9print( \\\\\\\"File already exists\\\\\\\" )\\\\\\\
- \\\\9\\\\9return\\\\\\\
- \\\\9end\\\\\\\
- \\\\9\\\\\\\
- \\\\9-- GET the contents from pastebin\\\\\\\
- \\\\9write( \\\\\\\"Connecting to pastebin.com... \\\\\\\" )\\\\\\\
- \\\\9local response = http.get(\\\\\\\
- \\\\9\\\\9\\\\\\\"http://pastebin.com/raw.php?i=\\\\\\\"..textutils.urlEncode( sCode )\\\\\\\
- \\\\9\\\\9)\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9if response then\\\\\\\
- \\\\9\\\\9print( \\\\\\\"Success.\\\\\\\" )\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9\\\\9local sResponse = response.readAll()\\\\\\\
- \\\\9\\\\9response.close()\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9\\\\9local file = fs.open( sPath, \\\\\\\"w\\\\\\\" )\\\\\\\
- \\\\9\\\\9file.write( sResponse )\\\\\\\
- \\\\9\\\\9file.close()\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9\\\\9print( \\\\\\\"Downloaded as \\\\\\\"..sFile )\\\\\\\
- \\\\9\\\\9\\\\\\\
- \\\\9else\\\\\\\
- \\\\9\\\\9print( \\\\\\\"Failed.\\\\\\\" )\\\\\\\
- \\\\9end\\\\9\\\\\\\
- \\\\\\\
- else\\\\\\\
- \\\\9printUsage()\\\\\\\
- \\\\9return\\\\\\\
- end\\\"\",\
- \"F:rga\",\
- \"\\\"if not SHA1 then\\\\\\\
- if not os.loadAPI(\\\\\\\"/api/SHA1\\\\\\\") then\\\\\\\
- error(\\\\\\\"could not load hashing algorithm (SHA1)\\\\\\\")\\\\\\\
- end\\\\\\\
- end\\\\\\\
- \\\\\\\
- local text = textutils.serialize(SHA1.digestStr(\\\\\\\"ReactOS_GenuineKey\\\\\\\"))\\\\\\\
- local hash = \\\\\\\" \\\\\\\"\\\\\\\
- print(\\\\\\\"ReactOS Genuine Advantage\\\\\\\")\\\\\\\
- print(\\\\\\\" \\\\\\\")\\\\\\\
- print(\\\\\\\"Verifying system activation certificate\\\\\\\")\\\\\\\
- local key = fs.open(\\\\\\\"/.rgaKey\\\\\\\", \\\\\\\"r\\\\\\\")\\\\\\\
- hash = key.readAll()\\\\\\\
- key.close()\\\\\\\
- if hash == text then\\\\\\\
- print(\\\\\\\"Your system is genuine!\\\\\\\")\\\\\\\
- write(\\\\\\\"Do you want to update the RGA data [Y/N]? \\\\\\\")\\\\\\\
- local ina = read()\\\\\\\
- if ina == \\\\\\\"Y\\\\\\\" or ina == \\\\\\\"y\\\\\\\" then\\\\\\\
- os.unloadAPI(\\\\\\\"rga\\\\\\\")\\\\\\\
- local cert = fs.open(\\\\\\\"/.rgaData/rga\\\\\\\", \\\\\\\"w\\\\\\\")\\\\\\\
- cert.writeLine(\\\\\\\"isActivated = true\\\\\\\")\\\\\\\
- cert.close()\\\\\\\
- os.loadAPI(\\\\\\\"/.rgaData/rga\\\\\\\")\\\\\\\
- else\\\\\\\
- print(\\\\\\\"Thank you.\\\\\\\")\\\\\\\
- end\\\\\\\
- else\\\\\\\
- os.unloadAPI(\\\\\\\"rga\\\\\\\")\\\\\\\
- local x = fs.open(\\\\\\\"/.rgaData/rga\\\\\\\", \\\\\\\"w\\\\\\\")\\\\\\\
- x.writeLine(\\\\\\\"isActivated = false\\\\\\\")\\\\\\\
- x.close()\\\\\\\
- os.loadAPI(\\\\\\\"/.rgaData/rga\\\\\\\")\\\\\\\
- printError([[\\\\\\\
- This copy of ReactOS is not activated.\\\\\\\
- Consider buying a valid, licensed copy.\\\\\\\
- ]])\\\\\\\
- end\\\"\",\
- \"F:test\",\
- \"\\\"print(\\\\\\\"Hello)\\\\\\\")\\\"\",\
- }",
- }
Advertisement
Add Comment
Please, Sign In to add comment