Advertisement
pepeknamornik

prikazy

Feb 4th, 2020 (edited)
1,188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.50 KB | None | 0 0
  1. verze = "23.0401.R1"
  2. local w, h = term.getSize()
  3. local register = 0
  4. local login = 0
  5. local deleteusers = 0
  6. local cestaProgramu = ""
  7.  
  8.     local f=fs.open("/C/system/RAM/user","r")
  9.     user=f.readLine()
  10.     f.close()
  11.        
  12.     if fs.exists("/C/system/RAM/devices/speaker.tmp") then
  13.     sound = true
  14.     end
  15.        
  16.     if fs.exists ("/C/system/Users/"..user.."/.Registry/colors") then
  17.     local data = fs.open("/C/system/Users/"..user.."/.Registry/colors", "r")
  18.     BarPoz = tonumber(data.readLine())
  19.     BarTxt = tonumber(data.readLine())
  20.     data.close()
  21.     end
  22.     if BarPoz == nil or BarTxt == nil then BarPoz = 2048 BarTxt = 1 end
  23.    
  24.     function song(type)
  25.     if sound then shell.run("/C/system/api/sound.api "..type) end
  26.     end
  27.  
  28. if fs.exists("/C/system/.core/defmodem") then
  29.         local data = fs.open ("/C/system/.core/defmodem","r")
  30.         modemPos = data.readLine()
  31.         data.close()
  32.         idPC = os.getComputerID()
  33.         modem = peripheral.wrap(modemPos)
  34.         modem.open(idPC)
  35.         if not modemPos then
  36.         fs.delete("/C/system/.core/defmodem")
  37.         modemPos = "offline"
  38.         end
  39.     else
  40.         modemPos = "offline"
  41. end
  42.    
  43. if fs.exists ("/C/system/.core/AD") then
  44.     ADC = true
  45.     local f=fs.open("/C/system/.core/AD","r")
  46.     ADServer=f.readLine()
  47.     f.close()
  48. end
  49.  
  50. function prc(text, y)
  51.   local w = term.getSize()
  52.   local _, cy = term.getCursorPos()
  53.   term.setCursorPos(math.ceil((w-#text)/2), y or cy)
  54.   write(text)
  55. end
  56.  
  57. function dialog(nadpis,dtext1,dtext2,autoclose)
  58.  
  59.     if nadpis == nil then nadpis = "" end
  60.     if dtext1 == nil then dtext1 = "" end
  61.     if dtext2 == nil then dtext2 = "" end
  62.     if autoclose == nil then autoclose = "close" end
  63.  
  64.     myWindow = window.create(term.current(),w/2-8,h/2-2,20,7)
  65.     myWindow.setBackgroundColor(colors.white)
  66.     myWindow.setTextColor(BarTxt)
  67.     myWindow.clear()
  68.     myWindow.setBackgroundColor(colors.red)
  69.     myWindow.setCursorPos (20, 1)
  70.     myWindow.write"×"
  71.     myWindow.setCursorPos (1, 1)
  72.     myWindow.setBackgroundColor(BarPoz)
  73.     myWindow.setTextColor(BarTxt)
  74.     myWindow.write("                   ")
  75.     myWindow.setCursorPos (2, 1)
  76.     myWindow.write(nadpis)
  77.     myWindow.setBackgroundColor(colors.white)
  78.     myWindow.setTextColor(colors.black)
  79.     myWindow.setCursorPos (2, 3)
  80.     myWindow.write(dtext1)
  81.     myWindow.setCursorPos (2, 4)
  82.     myWindow.write(dtext2)
  83.     myWindow.setTextColor(colors.black)
  84.     myWindow.setBackgroundColor(colors.lightGray)
  85.     myWindow.setCursorPos (9, 6)
  86.     myWindow.write" OK "
  87.    
  88.     if autoclose == "close" then sleep (1) error() end
  89.    
  90.     if autoclose == "return" then return end
  91.    
  92.     function ok()
  93.         myWindow.setBackgroundColor(colors.gray)
  94.         myWindow.setCursorPos (9, 6)
  95.         myWindow.write" OK "
  96.         sleep(0.1)
  97.         error()
  98.     end
  99.  
  100.      while true do
  101.             local event, button, x, y = os.pullEvent()
  102.            
  103.             if event == "mouse_click" and x == math.floor(w/2+11) and  y == math.floor(h/2-2) and button == 1 then
  104.             error()
  105.             elseif event == "mouse_click" and x >= math.floor(w/2) and x <= math.floor(w/2+3) and  y == math.floor(h/2+3) and button == 1 then
  106.             ok()
  107.             elseif event == "key" and (button == keys.enter or button == keys.numEnter) then
  108.             ok()
  109.             end
  110.     end
  111.    
  112. end
  113.  
  114. function prikazy()
  115.    
  116.     local prikazdoc = fs.open ("/C/system/RAM/command", "r")
  117.     prikaz = prikazdoc.readLine()
  118.     verze = prikazdoc.readLine()
  119.     prikazdoc.close ()
  120.            
  121.     if prikaz == "cmd" or prikaz == "shell" or prikaz == "terminal" or prikaz == "commander" then
  122.         term.setCursorPos(1,1)
  123.         if not fs.exists("/C/system/api/commander.lua") then
  124.         downloading("LY8cUArW", "/C/system/api/commander.lua")
  125.         end
  126.         shell.run ("cd /C")
  127.         shell.run ("/C/system/api/commander.lua")
  128.     elseif prikaz == "id" or prikaz == "ID" then
  129.    
  130.         if os.getComputerLabel() == nil or os.getComputerLabel() == "" then
  131.             dtext = ""
  132.         else
  133.             dtext  = ("Label: "..(os.getComputerLabel()))
  134.         end
  135.         dialog("     Identify     ","ID: "..os.getComputerID(),dtext,"")
  136.     elseif prikaz == "opt" then
  137.         shell.run("/C/system/api/setting.lua")
  138.     elseif prikaz == "reload os" then
  139.         shell.run ("/C/system/.core/desktop.lua")
  140.     elseif prikaz == "oldwin" then
  141.         local data = fs.open("/C/system/Users/"..user.."/colors", "w") data.writeLine("256") data.writeLine("32768") data.close ()
  142.         downloading("41j27xwq", "/C/system/Users/"..user.."/bar.nfp")
  143.         shell.run ("/C/system/.core/desktop.lua")
  144.     elseif prikaz == "defcol" then
  145.         local data = fs.open("/C/system/Users/"..user.."/colors", "w")
  146.         data.writeLine("2048")
  147.         data.writeLine("1")
  148.         data.close ()
  149.         downloading("ZQ8BBcVQ", "/C/system/Users/"..user.."/bar.nfp")
  150.         shell.run ("/C/system/.core/desktop.lua")
  151.     elseif prikaz == "cls list" then   
  152.         if fs.exists ("/C/system/Users/"..user.."/.Registry/lsprogram") then
  153.         fs.delete ("/C/system/Users/"..user.."/.Registry/lsprogram")
  154.         end
  155.     elseif prikaz == "cls ram" then
  156.         if fs.exists ("/C/system/RAM/bluescreen.lua") then
  157.         fs.move ("/C/system/RAM/bluescreen.lua", "/C/system/RAM_temp/bluescreen.lua")
  158.         end
  159.         if fs.exists ("/C/system/RAM/user") then
  160.         fs.move ("/C/system/RAM/user", "/C/system/RAM_temp/user")
  161.         end
  162.         fs.delete ("/C/system/RAM")
  163.         if fs.exists ("/C/system/RAM_temp/bluescreen.lua") then
  164.         fs.move ("/C/system/RAM_temp/bluescreen.lua", "/C/system/RAM/bluescreen.lua")
  165.         end
  166.         if fs.exists ("/C/system/RAM_temp/user") then
  167.         fs.move ("/C/system/RAM_temp/user", "/C/system/RAM/user")
  168.         end
  169.         fs.delete ("/C/system/RAM_temp")
  170.     elseif prikaz == "anim off" then
  171.         data = fs.open("/C/system/Users/"..user.."/.Registry/.disableAnim", "w") data.close()
  172.         shell.run("/C/system/.core/desktop.lua")
  173.     elseif prikaz == "anim on" then
  174.         if fs.exists ("/C/system/Users/"..user.."/.Registry/.disableAnim") then
  175.         fs.delete ("/C/system/Users/"..user.."/.Registry/.disableAnim")
  176.         end
  177.         shell.run("/C/system/.core/desktop.lua")
  178.     elseif prikaz == "pmanager" then
  179.     if not fs.exists("/Programs/PepekSoft/pmanager") then
  180.         downloading("5eSpGpGa", "/Programs/PepekSoft/pmanager")
  181.         end
  182.         shell.run("/Programs/PepekSoft/pmanager")
  183.     elseif prikaz == "" then
  184.         menu()
  185.     elseif prikaz == "vyvoj" then
  186.         if not fs.exists("/C/system/Users/"..user.."/vyvoj") then
  187.         local data = fs.open("/C/system/Users/"..user.."/vyvoj", "w")
  188.         data.close()
  189.         else
  190.         fs.delete ("/C/system/Users/"..user.."/vyvoj")
  191.         end
  192.         shell.run("/C/system/.core/desktop.lua")
  193.     elseif prikaz == "label" then
  194.         local data = fs.open ("/C/system/RAM/setting/"..user.."/setdata", "w")
  195.         data.writeLine ("label")
  196.         data.close ()
  197.         shell.run("/C/system/api/setting.lua")
  198.     elseif prikaz == "update" then
  199.         shell.run("/C/system/api/update.lua noface")
  200.     elseif prikaz == "update -all" then
  201.         shell.run("pastebin run kVTbg59d")
  202.     elseif prikaz == "update run" then
  203.             downloading("r18V4xrG", "/C/system/api/commands.lua")
  204.             menu()
  205.     elseif prikaz == "update start" then
  206.             downloading("0xh6jEx1", "/startup.lua")
  207.             menu()
  208.     elseif prikaz == "update local" then
  209.             if fs.exists("/C/system/server/rules/Update/") then
  210.                 if fs.exists("/C/system/server/rules/Update/desktop.lua") then
  211.                 fs.delete ("/C/system/.core/desktop.lua")
  212.                 shell.run("copy /C/system/server/rules/Update/desktop.lua /C/system/.core/desktop.lua")
  213.                 end
  214.                 if fs.exists("/C/system/server/rules/Update/startup.lua") then
  215.                 fs.delete ("/startup.lua")
  216.                 shell.run("copy /C/system/server/rules/Update/startup.lua /startup.lua")
  217.                 end
  218.             end
  219.             menu()
  220.     elseif prikaz == "sync" then
  221.         if not (modemPos == "offline") then
  222.         modem.transmit(tonumber(ADServer),555, user)
  223.        
  224.             if fs.exists("/C/system/Users/"..user.."/bar.nfp") then
  225.             local f=fs.open("/C/system/Users/"..user.."/bar.nfp","r")
  226.             sync_object=f.readAll()
  227.             f.close()
  228.             modem.transmit(tonumber(ADServer),560, sync_object)
  229.             end
  230.  
  231.             if fs.exists("/C/system/Users/"..user.."/colors") then
  232.             local f=fs.open("/C/system/Users/"..user.."/colors","r")
  233.             sync_object=f.readAll()
  234.             f.close()
  235.             modem.transmit(tonumber(ADServer),561, sync_object)
  236.             end
  237.         else
  238.         song("error")
  239.         dialog("       Error      ","Computer is Offline","","")
  240.         end
  241.     elseif prikaz == "monitor" then  
  242.     local names = {}
  243.             local function filter(name)
  244.             table.insert(names, name)
  245.             local f=fs.open("/C/system/.core/display","w") f.writeLine(name) f.close()
  246.             local data = fs.open ("/C/system/RAM/displayreboot", "w") data.close ()
  247.             term.setBackgroundColor(colors.black)
  248.             term.clear()
  249.             os.reboot()
  250.             end
  251.            
  252.             peripheral.find("monitor", filter)
  253.     elseif prikaz == "help" then
  254.     term.setBackgroundColor(colors.lightGray)
  255.     term.clear()
  256.     sleep (0.1)
  257.     term.setBackgroundColor(colors.gray)
  258.     term.clear()
  259.     sleep (0.1)
  260.     term.setBackgroundColor(colors.white)
  261.     term.setTextColor(colors.black)
  262.     term.clear()
  263.     term.setBackgroundColor(colors.white)
  264.     term.setTextColor(colors.black)
  265.     term.clear()
  266.     term.setCursorPos(0, h-12)
  267.     prc "Downloading current catalog"
  268.     term.setCursorPos(0, h-10)
  269.     prc "Please wait"
  270.     term.setBackgroundColor(colors.white)
  271.     term.setTextColor(colors.blue)
  272.     term.setCursorPos(w/2-5,h-1)
  273.     print"  Pepek"
  274.     term.setCursorPos(w/2+3,h-1)
  275.     print"Soft  "
  276.     term.setCursorPos(w/2+2,h-1)
  277.     term.setTextColor(colors.lime)
  278.     print"@"
  279.  
  280.     if not fs.exists("/C/system/RAM/help") then
  281.     downloading("WBE35q0m", "/C/system/RAM/help")
  282.     end
  283.     shell.run("/C/system/RAM/help")
  284.    
  285.     elseif prikaz == "ADPD" then
  286.     shell.run("pastebin run iAAc0GNS")
  287.     else
  288.         if shell.resolveProgram(prikaz) == nil then
  289.         song("error")
  290.         dialog("       Error      ","No such program","sought: "..prikaz,"")
  291.         else
  292.         shell.run(prikaz)
  293.         end
  294.     end
  295. end
  296.  
  297. function downloading(kod, cesta)
  298. dialog(" Downloading  ",cesta,"","return")
  299. if fs.exists(cesta) then fs.delete(cesta)end
  300. shell.run("/C/system/api/stahni.api get "..kod.." "..cesta)
  301. end
  302.  
  303. prikazy ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement