pepeknamornik

Starý setting

May 27th, 2020
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 106.60 KB | None | 0 0
  1. local verze = "20.0327.2"
  2. local w,h = term.getSize()
  3. local register = 0
  4. local login = 0
  5. local deleteusers = 0
  6. local nastaveni={barva=colors.blue}
  7. local cestaProgramu = ""
  8. local adUser = ""
  9. local adPass = ""
  10. local idPC = os.getComputerID()
  11.  
  12. if fs.exists("/C/system/.core/system") then
  13.     local data = fs.open ("/C/system/.core/system", "r")
  14.     edice = data.readLine()
  15.     data.close()
  16. else
  17.     edice = "Standard"
  18. end
  19.    
  20. if (edice == "Server") then
  21.     ServerMode = true
  22. end
  23.  
  24.     local f=fs.open("/C/system/RAM/user","r")
  25.     user=f.readLine()
  26.     f.close()
  27.    
  28.     if not fs.exists("/C/system/Users/"..user.."/colors") then
  29.     shell.run ("pastebin get ECh4d3A4 /C/system/Users/"..user.."/colors")
  30.     end
  31.        
  32.     local f=fs.open("/C/system/Users/"..user.."/colors","r")
  33.     cnt=f.readAll()
  34.     f.close()
  35.     nastaveni=textutils.unserialize(cnt)
  36.  
  37.     if not fs.exists("/C/system/Users/"..user.."/textcol") then
  38.     shell.run ("pastebin get 4JttBRbg /C/system/Users/"..user.."/textcol")
  39.     end
  40.    
  41.     local f=fs.open("/C/system/Users/"..user.."/textcol","r")
  42.     tnt=f.readAll()
  43.     f.close()
  44.     text=textutils.unserialize(tnt)
  45.    
  46.     if not fs.exists ("/C/system/.core/setting/Ikon.nft") then
  47.     shell.run ("pastebin get RPyte0cc /C/system/.core/setting/Ikon.nft")
  48.     end
  49.  
  50. local propojeni = ""
  51.  
  52.  
  53.  
  54. local function prc(text, y)
  55.   local w = term.getSize()
  56.   local _, cy = term.getCursorPos()
  57.   term.setCursorPos(math.ceil((w-#text)/2), y or cy)
  58.   write(text)
  59. end
  60.  
  61.  
  62. function start ()
  63.     if fs.exists ("/C/system/RAM/setting/"..user.."/setdata") then
  64.         local data = fs.open ("/C/system/RAM/setting/"..user.."/setdata", "r")
  65.         local funkce = data.readLine ()
  66.         data.close ()
  67.         local myWindow = window.create(term.current(),1,1,16,h)
  68.         myWindow.setBackgroundColor(colors.gray)
  69.         myWindow.clear()
  70.         resus ()
  71.     else
  72.     term.setBackgroundColor(colors.magenta)
  73.     term.setTextColor(colors.white)
  74.     term.clear ()
  75.     local image = paintutils.loadImage("/C/system/.core/setting/Ikon.nft")
  76.     paintutils.drawImage(image, w/2-7.5, h/2-6.5)
  77.     prc ("Setting", h/2+8)
  78. --    o=fs.open ("/C/system/RAM/setting/"..user.."/setting", "r")
  79. --    user=o.readLine()
  80. --    passI=o.readLine()
  81. --    o.close()
  82.     sleep (1)
  83. setupmenu ()
  84. end
  85. end
  86.  
  87. function minimalizace ()
  88.  
  89.     if not fs.exists ("/C/system/.core/setting/mineditor") then
  90.     shell.run ("pastebin get EiKMubhV /C/system/.core/setting/mineditor")
  91.     minimalizace()
  92.     end
  93.    
  94.     if fs.exists ("/C/system/RAM/setting/"..user.."/setdata") then
  95.     fs.delete ("/C/system/RAM/setting/"..user.."/setdata")
  96.     end
  97.    
  98.     local data = fs.open ("/C/system/RAM/setting/"..user.."/setdata", "w")
  99.     data.writeLine(funkce)
  100.     data.close ()
  101.     local data = fs.open ("/C/system/RAM/"..user.."/prlists", "w")
  102.         data.writeLine ("setting")
  103.         data.close ()
  104.     shell.exit ()
  105.     shell.run ("/C/system/.core/setting/mineditor")
  106. end
  107.  
  108. function ukonceni ()
  109.     fs.delete ("/C/system/RAM/setting/"..user)
  110.     shell.run("/C/system/api/closeApp")
  111. end
  112.  
  113. function resus ()
  114.  
  115. local data = fs.open ("/C/system/RAM/setting/"..user.."/setdata", "r")
  116.         local funkce = data.readLine ()
  117.         data.close ()
  118.        
  119.     local myFuncs = {
  120.         ["label"] = function()
  121.         network ()
  122.         end,
  123.        
  124.         ["modem"] = function()
  125.         network ()
  126.         end,
  127.        
  128.         ["info"] = function()
  129.         info ()
  130.         end,
  131.        
  132.         ["display"] = function()
  133.         display ()
  134.         end,
  135.        
  136.         ["credits"] = function()
  137.          credits ()
  138.         end,
  139.        
  140.         ["diskinfo"] = function()
  141.          disk ()
  142.         end,
  143.        
  144.         ["startup"] = function()
  145.          startup ()
  146.         end,
  147.        
  148.         ["theme"] = function()
  149.          theme ()
  150.         end,
  151.        
  152.         ["tapety"] = function()
  153.          tapety ()
  154.         end,
  155.        
  156.         ["account"] = function()
  157.          account ()
  158.         end,
  159.        
  160.         ["deleteuser"] = function()
  161.          account ()
  162.         end,
  163.        
  164.         ["createuser"] = function()
  165.          account ()
  166.         end,
  167.        
  168.         ["logon"] = function()
  169.          account ()
  170.         end,
  171.        
  172.         ["password"] = function()
  173.         account ()
  174.         end,
  175.        
  176.         ["network"] = function()
  177.          network ()
  178.         end,
  179.        
  180.         ["updates"] = function()
  181.          updates ()
  182.         end,
  183.        
  184.         ["recovery"] = function()
  185.          recovery ()
  186.         end,
  187.        
  188.         ["update"] = function()
  189.          update ()
  190.         end,
  191.        
  192.         ["setprograms"] = function()
  193.          setprograms ()
  194.         end,
  195.        
  196.         ["language"] = function()
  197.          language ()
  198.         end,
  199. }
  200.  
  201. myFuncs[funkce]()
  202. end
  203.  
  204. function setupmenu ()
  205.     term.setBackgroundColor(colors.white)
  206.     term.clear()
  207.     local myWindow = window.create(term.current(),16,1,37,h)
  208.     myWindow.setBackgroundColor(colors.white)
  209.     myWindow.clear()
  210.         if not fs.exists ("/C/system/.core/ikon/logo.nft") then
  211.         shell.run("pastebin get u5hbXtBq /C/system/.core/ikon/logo.nft")
  212.         setupmenu()
  213.         end
  214.     local image = paintutils.loadImage("/C/system/.core/ikon/logo.nft")
  215.     paintutils.drawImage(image, 22, 5)
  216.     term.setBackgroundColor(colors.white)
  217.     term.setTextColor(colors.blue)
  218.     myWindow.setCursorPos(20,17)
  219.     write "  Pepek"
  220.     myWindow.setCursorPos(28,17)
  221.     write "Soft  "
  222.     myWindow.setCursorPos(22,18)
  223.     term.setTextColor(colors.black)
  224.     write "2014-2020"
  225.     myWindow.setCursorPos(27,17)
  226.     myWindow.setTextColor(colors.lime)
  227.     write "@"
  228.     local myWindow = window.create(term.current(),1,1,16,h)
  229.     myWindow.setBackgroundColor(colors.gray)
  230.     myWindow.clear()
  231.     local myWindow = window.create(term.current(),1,1,15,h)
  232.     myWindow.setBackgroundColor(nastaveni.barva)
  233.     myWindow.clear()
  234.     term.setBackgroundColor (nastaveni.barva)
  235.     term.setTextColor(colors.lime)
  236.     term.setCursorPos(2,3)
  237.     write  "Setting"
  238.     term.setTextColor(text.barva)
  239.     term.setCursorPos(2,5)
  240.     write  "Info"
  241.     term.setCursorPos(2,7)
  242.     write  "Accounts"
  243.     term.setCursorPos(2,9)
  244.     write  "Network"
  245.     term.setCursorPos(2,11)
  246.     write  "Language"
  247.     term.setCursorPos(2,13)
  248.     write  "System"
  249.     term.setCursorPos(2,15)
  250.     write  "Programs"
  251.     term.setCursorPos(2,17)
  252.     write  "Themes"
  253.    
  254.       while true do
  255.     local event, button, x, y = os.pullEvent("mouse_click")
  256.     xy = x..","..y
  257.      
  258.     if x >= 2 and x <= 16 and y == 5 and button == 1 then
  259.     info ()
  260.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  261.     account ()
  262.     elseif x >= 2 and x <= 16 and y == 9 and button == 1 then
  263.     network ()
  264.     elseif x >= 2 and x <= 16 and y == 11 and button == 1 then
  265.     language ()
  266.     elseif x >= 2 and x <= 16 and y == 13 and button == 1 then
  267.     display ()
  268.     elseif x >= 2 and x <= 16 and y == 15 and button == 1 then
  269.     setprograms ()
  270.     elseif x >= 2 and x <= 16 and y == 17 and button == 1 then
  271.     theme ()
  272.     else
  273.     paintutils.drawLine(1, 1, w, 1, colors.black)
  274.     paintutils.drawPixel (w,1, colors.red)
  275.     term.setCursorPos (w,1)
  276.     write  "*"
  277.              while true do
  278.         local event, button, x, y = os.pullEvent("mouse_click")
  279.         xy = x..","..y
  280.        
  281.         if x == w and y == 1 then
  282.             ukonceni ()
  283.         else
  284.         setupmenu ()
  285.             end
  286.             end
  287.     break
  288.     end
  289.     end
  290. end
  291.  
  292. function label ()
  293. funkce = "label"
  294.         local myWindow = window.create(term.current(),17,1,w-16,h)
  295.     myWindow.setBackgroundColor(colors.white)
  296.     myWindow.clear()
  297.     term.setBackgroundColor(nastaveni.barva)
  298.        term.setCursorPos(1,1)
  299.        write  "               "
  300.        paintutils.drawPixel(16, 1, colors.gray)
  301.        term.setBackgroundColor(colors.white)
  302.        term.setCursorPos(17,1)
  303.        write  "                                   "
  304.      myWindow.setTextColor(colors.black)
  305.     myWindow.setCursorPos(2, 9)
  306.     write ("Set label: ")
  307.     myWindow.setCursorPos(2, 11)
  308.     write ("Label clear: ")
  309.     term.setBackgroundColor(colors.lightGray)
  310.     myWindow.setTextColor(colors.white)
  311.     myWindow.setCursorPos(14, 9)
  312.     write  "          "
  313.     myWindow.setCursorPos(14, 9)
  314.     if os.getComputerLabel() == nil then
  315.         write  "None"
  316.         else
  317.     write (os.getComputerLabel())
  318.     end
  319.     term.setBackgroundColor(colors.gray)
  320.     myWindow.setCursorPos(15, 11)
  321.     write  " Clear "
  322.    
  323.    
  324.         while true do
  325.         local event, button, x, y = os.pullEvent("mouse_click")
  326.         xy = x..","..y
  327.    
  328.     if x >= 29 and x <= 39 and y == 9 and button == 1 then
  329.         term.setBackgroundColor(colors.gray)
  330.         myWindow.setCursorPos(14, 9)
  331.         write  "          "
  332.         myWindow.setCursorPos(14, 9)
  333.         propojeni = read ()
  334.         os.setComputerLabel(propojeni)
  335.         label ()
  336.     elseif x >= 30 and x <= 37 and y == 11 and button == 1 then
  337.         myWindow.setCursorPos(14, 9)
  338.         shell.run ("label clear")
  339.         label ()
  340.     elseif x >= 2 and x <= 16 and y == 3 and button == 1 then
  341.     setupmenu ()
  342.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  343.     modemS ()
  344.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  345.     label ()
  346.     elseif event == "mouse_click" then
  347.     paintutils.drawLine(1, 1, w, 1, colors.black)
  348.     paintutils.drawPixel (w,1, colors.red)
  349.     term.setTextColor(colors.white)
  350.     term.setCursorPos (w,1)
  351.     write  "*"
  352.     paintutils.drawPixel (50,1, colors.lightGray)
  353.     term.setCursorPos (w-1,1)
  354.     write  "<"
  355.     paintutils.drawPixel (49,1, colors.lightGray)
  356.         term.setCursorPos (w-2,1)
  357.         write  "_"
  358.  
  359.              while true do
  360.         local event, button, x, y = os.pullEvent("mouse_click")
  361.         xy = x..","..y
  362.        
  363.         if x == w and y == 1 then
  364.             ukonceni ()
  365.         elseif x == w-1 and y == 1 then
  366.             network ()
  367.         elseif x == w-2 and y == 1 then
  368.             minimalizace ()
  369.         else
  370.         label ()
  371.             end
  372.             end
  373. end
  374. end
  375. end
  376.  
  377. function defmodem(size)
  378. local dm = fs.open("/C/system/.core/defmodem","w")
  379. dm.writeLine(size)
  380. dm.close()
  381. end
  382.  
  383. function prijmout()
  384. local odpoved = false
  385. timerRX = os.startTimer(2)
  386.     while true do
  387.     local event,p1,p2,p3,p4 = os.pullEvent()
  388.       if event == ("modem_message") then
  389.           if (p3 == 552) then
  390.             odpoved = true
  391.                 if (p4 == "true") then
  392.                 local c = fs.open ("/C/system/.core/AD", "w")
  393.                 c.writeLine(tostring(adID))
  394.                 c.close()
  395.                 plocha.setCursorPos(2,17)
  396.                 plocha.setTextColor(colors.green)
  397.                 plocha.write"Successfully connected!"
  398.                 sleep(0.5)
  399.                 restartovat()
  400.                 else
  401.                 plocha.setCursorPos(2,17)
  402.                 plocha.setTextColor(colors.red)
  403.                 plocha.write"Error, invalid login!"
  404.                 sleep(0.5)
  405.                 end
  406.             end
  407.       elseif event == "timer" then
  408.         if p1 >= timerRX then
  409.         plocha.setCursorPos(2,17)
  410.         plocha.setTextColor(colors.red)
  411.         if not odpoved then plocha.write"Error, server not found!" sleep(1) end
  412.         modemS ()
  413.         end
  414.       end
  415.     end
  416. end
  417.  
  418. function dotaz()
  419.     if not (adID == nil) then
  420.     modemC.open(idPC)
  421.     modemC.transmit(tonumber(adID),550,idPC)
  422.     modemC.transmit(tonumber(adID),551,adUser)
  423.     modemC.transmit(tonumber(adID),552,adPass)
  424.     prijmout()
  425.     end
  426. end
  427.  
  428. function modemS ()
  429.     funkce = "modem"
  430.     term.setBackgroundColor(nastaveni.barva)
  431.     term.setCursorPos(1,1)
  432.     write  "               "
  433.     paintutils.drawPixel(16, 1, colors.gray)
  434.     plocha = window.create(term.current(),17,1,w-16,h)
  435.     plocha.setBackgroundColor(colors.white)
  436.     plocha.clear()
  437.     local myWindow = window.create(term.current(),1,1,16,h)
  438.     myWindow.setBackgroundColor(colors.gray)
  439.     myWindow.clear()
  440.     local myWindow = window.create(term.current(),1,1,15,h)
  441.     myWindow.setBackgroundColor(nastaveni.barva)
  442.     myWindow.clear()
  443.     term.setBackgroundColor (nastaveni.barva)
  444.     term.setTextColor(colors.lime)
  445.     term.setCursorPos(2,3)
  446.     write  "< Network"
  447.     term.setTextColor(text.barva)
  448.     term.setCursorPos(2,5)
  449.     write  "Modem"
  450.     term.setCursorPos(2,7)
  451.     write  "Label"  
  452.    
  453.     if fs.exists("/C/system/.core/defmodem") then
  454.     s = fs.open("/C/system/.core/defmodem","r")
  455.     modem = s.readLine()
  456.     s.close()
  457.     AD = true
  458.     modemE = peripheral.wrap(modem)
  459.     if not modemE then
  460.     fs.delete("/C/system/.core/defmodem")
  461.     modemS ()
  462.     end
  463.  
  464. else
  465.     modem = "offline"
  466.     AD = false
  467. end
  468. plocha.setTextColor(colors.black)
  469. plocha.setCursorPos(5,3)
  470. plocha.write"Choose your primary modem."
  471. if not (modem == "offline") then
  472. plocha.setCursorPos(2,11)
  473. plocha.write"If you already have an AD server,"
  474. plocha.setCursorPos(2,12)
  475. plocha.write" you can connect here."
  476. plocha.setCursorPos(2,14)
  477. plocha.write"Server  ID:"
  478. plocha.setCursorPos(2,15)
  479. plocha.write"Admin user:"
  480. plocha.setCursorPos(2,16)
  481. plocha.write"Admin pass:"
  482. plocha.setBackgroundColor(colors.lightGray)
  483. plocha.setCursorPos(14,14)
  484. plocha.write"               "
  485. if not (adID == nil) then plocha.setCursorPos(15,14) plocha.write(tostring(adID)) end
  486. plocha.setCursorPos(14,15)
  487. plocha.write"               "
  488. if not (adUser == "") then plocha.setCursorPos(15,15) plocha.write(adUser) end
  489. plocha.setCursorPos(14,16)
  490. plocha.write"               "
  491. if not (adPass == "") then plocha.setCursorPos(15,16) plocha.write("Password") end
  492. plocha.setBackgroundColor(colors.lightGray)
  493. ww = w-12
  494. plocha.setCursorPos(ww/2-5,h-1)
  495. plocha.write" Connect "
  496. end
  497. plocha.setBackgroundColor(colors.white)
  498. plocha.setTextColor(colors.black)
  499. plocha.setBackgroundColor(colors.lightGray)
  500. plocha.setCursorPos(8,5)
  501. if (modem == "top") then plocha.setBackgroundColor(colors.gray) else plocha.setBackgroundColor(colors.lightGray) end
  502. plocha.write" TOP     "
  503. plocha.setCursorPos(8,7)
  504. if (modem == "left") then plocha.setBackgroundColor(colors.gray) else plocha.setBackgroundColor(colors.lightGray) end
  505. plocha.write" LEFT    "
  506. plocha.setCursorPos(8,9)
  507. if (modem == "right") then plocha.setBackgroundColor(colors.gray) else plocha.setBackgroundColor(colors.lightGray) end
  508. plocha.write" RIGHT   "
  509. plocha.setCursorPos(20,5)
  510. if (modem == "back") then plocha.setBackgroundColor(colors.gray) else plocha.setBackgroundColor(colors.lightGray) end
  511. plocha.write" BACK    "
  512. plocha.setCursorPos(20,7)
  513. if (modem == "bottom") then plocha.setBackgroundColor(colors.gray) else plocha.setBackgroundColor(colors.lightGray) end
  514. plocha.write" BOTTOM  "
  515. plocha.setCursorPos(20,9)
  516. if (modem == "offline") then plocha.setBackgroundColor(colors.gray) else plocha.setBackgroundColor(colors.lightGray) end
  517. plocha.write" OFFLINE "
  518.  
  519.     while true do
  520.     event, button, x,y = os.pullEvent()
  521.    
  522.     if event == "mouse_click" and x >= 24 and x<= 32 and y == 5 and button == 1 then
  523.     defmodem("top")
  524.     modemS ()
  525.     elseif event == "mouse_click" and x >= 36 and x<= 44 and y == 5 and button == 1 then
  526.     defmodem("back")
  527.     modemS ()
  528.     elseif event == "mouse_click" and x >= 24 and x<= 32 and y == 7 and button == 1 then
  529.     defmodem("left")
  530.     modemS ()
  531.     elseif event == "mouse_click" and x >= 36 and x<= 44 and y == 7 and button == 1 then
  532.     defmodem("bottom")
  533.     modemS ()
  534.     elseif event == "mouse_click" and x >= 24 and x<= 32 and y == 9 and button == 1 then
  535.     defmodem("right")
  536.     modemS ()
  537.     elseif event == "mouse_click" and x >= 36 and x<= 44 and y == 9 and button == 1 then
  538.         if fs.exists("/C/system/.core/defmodem") then
  539.             fs.delete("/C/system/.core/defmodem")
  540.         end
  541.     modemS ()
  542.     elseif event == "mouse_click" and x >= 26 and x<= 40 and y == 14 and AD and button == 1 then
  543.     term.setBackgroundColor(colors.lightBlue)
  544.     plocha.setBackgroundColor(colors.lightBlue)
  545.     plocha.setCursorPos(14,14)
  546.     plocha.write"               "
  547.     plocha.setCursorPos(15,14)
  548.     adID = read()
  549.     modemS ()
  550.     elseif event == "mouse_click" and x >= 26 and x<= 40 and y == 15 and AD and button == 1 then
  551.     term.setBackgroundColor(colors.lightBlue)
  552.     plocha.setBackgroundColor(colors.lightBlue)
  553.     plocha.setCursorPos(14,15)
  554.     plocha.write"               "
  555.     plocha.setCursorPos(15,15)
  556.     adUser = read()
  557.     modemS ()
  558.     elseif event == "mouse_click" and x >= 26 and x<= 40 and y == 16 and AD and button == 1 then
  559.     term.setBackgroundColor(colors.lightBlue)
  560.     plocha.setBackgroundColor(colors.lightBlue)
  561.     plocha.setCursorPos(14,16)
  562.     plocha.write"               "
  563.     plocha.setCursorPos(15,16)
  564.     adPass = read("x")
  565.     modemS()
  566.     elseif event == "mouse_click" and x >= 30 and x<= 38 and y == h-1 and button == 1 then
  567.         plocha.setBackgroundColor(colors.gray)
  568.         plocha.setCursorPos(ww/2-5,h-1)
  569.         plocha.write" Connect "
  570.         sleep(0.1)
  571.         plocha.setBackgroundColor(colors.white)
  572.         if AD then
  573.             modemC = peripheral.wrap(modem)
  574.             dotaz()
  575.         end
  576.         modemS()
  577.     elseif event == "mouse_click" and x >= 2 and x <= 16 and y == 3 and button == 1 then
  578.     setupmenu ()
  579.     elseif event == "mouse_click" and x >= 2 and x <= 16 and y == 5 and button == 1 then
  580.     modemS ()
  581.     elseif event == "mouse_click" and x >= 2 and x <= 16 and y == 7 and button == 1 then
  582.     label ()
  583.     elseif (event == "mouse_click") then
  584.     paintutils.drawLine(1, 1, w, 1, colors.black)
  585.     paintutils.drawPixel (w,1, colors.red)
  586.     term.setTextColor(colors.white)
  587.     term.setCursorPos (w,1)
  588.     write  "*"
  589.     paintutils.drawPixel (50,1, colors.lightGray)
  590.     term.setCursorPos (w-1,1)
  591.     write  "<"
  592.     paintutils.drawPixel (49,1, colors.lightGray)
  593.     term.setCursorPos (w-2,1)
  594.     write  "_"
  595.    
  596.         while true do
  597.         local event, button, x, y = os.pullEvent("mouse_click")
  598.         xy = x..","..y
  599.        
  600.             if x == w and y == 1 then
  601.                 ukonceni ()
  602.             elseif x == w-1 and y == 1 then
  603.                 network ()
  604.             elseif x == w-2 and y == 1 then
  605.                 minimalizace ()
  606.             else
  607.             modemS ()
  608.             end
  609.         end
  610. end
  611. end
  612. end
  613.  
  614. local function prc(text, y)
  615.   local w = term.getSize()
  616.   local _, cy = term.getCursorPos()
  617.   term.setCursorPos(math.ceil((w-#text)/2), y or cy)
  618.   write(text)
  619. end
  620.  
  621.  
  622. function info ()
  623. funkce = "info"
  624.         local myWindow = window.create(term.current(),16,1,37,h)
  625.     myWindow.setBackgroundColor(colors.white)
  626.     myWindow.clear()
  627.         local myWindow = window.create(term.current(),1,1,16,h)
  628.     myWindow.setBackgroundColor(colors.gray)
  629.     myWindow.clear()
  630. local myWindow = window.create(term.current(),1,1,15,h)
  631.     myWindow.setBackgroundColor(nastaveni.barva)
  632.     myWindow.clear()
  633.     term.setBackgroundColor (nastaveni.barva)
  634.     term.setTextColor(colors.lime)
  635.     write  "< Info"
  636.     term.setCursorPos(2,3)
  637.         local myWindow = window.create(term.current(),17,1,w-16,h)
  638.     myWindow.setBackgroundColor(colors.white)
  639.     myWindow.clear()
  640.     term.setBackgroundColor(nastaveni.barva)
  641.        term.setCursorPos(1,1)
  642.        write  "               "
  643.        paintutils.drawPixel(16, 1, colors.gray)
  644.        term.setBackgroundColor(colors.white)
  645.        term.setCursorPos(17,1)
  646.        write  "                                   "
  647.        myWindow.setTextColor(colors.blue)
  648.     myWindow.setCursorPos(9, 18)
  649.     write  "Pepek@Soft"
  650.     term.setTextColor(colors.black)
  651.     myWindow.setCursorPos(20, 18)
  652.     write  "Software"
  653.     myWindow.setTextColor(colors.lime)
  654.     myWindow.setCursorPos(14, 18)
  655.     write  "@"
  656.     myWindow.setTextColor(colors.black)
  657.     myWindow.setCursorPos(2, 3)
  658.     write  ("Pepdroll Seven "..edice)
  659.     myWindow.setCursorPos(2, 6)
  660.     write  "                                  "
  661.     myWindow.setCursorPos(2, 6)
  662.     write  ("Free disk space: "..(tonumber(fs.getFreeSpace("/")/1000)).." kB")
  663.     myWindow.setCursorPos(2, 7)
  664.     write  ("Use  disk space: "..(1000-tonumber(fs.getFreeSpace("/")/1000)).." kB")
  665.     vypMis = math.ceil(1000 - (tonumber(fs.getFreeSpace("/")/1000)))/10
  666.     vypMis = math.ceil(vypMis/100*33)
  667.     misto = ""
  668.    
  669.     term.setBackgroundColor(colors.lightBlue)
  670.     myWindow.setCursorPos(2, 8)
  671.     term.write "                                 " --33
  672.  
  673.     if (vypMis <24) then
  674.     myWindow.setCursorPos(((33-vypMis)/2)+vypMis-2, 8)
  675.     term.write((100-(math.ceil(1000 - (tonumber(fs.getFreeSpace("/")/1000)))/10)).."% Free")
  676.     elseif (vypMis <30) then
  677.     myWindow.setCursorPos(((33-vypMis)/2)+vypMis, 8)
  678.     write "Free"
  679.     end
  680.    
  681.     for i=1,vypMis do
  682.     misto = misto.." "
  683.     end
  684.     term.setBackgroundColor(colors.blue)
  685.     myWindow.setCursorPos(2, 8)
  686.     term.write(misto)
  687.     myWindow.setTextColor(colors.black)
  688.     if (vypMis > 7) then
  689.         myWindow.setCursorPos(((vypMis)/2)-2, 8)
  690.         term.write((math.ceil(1000 - (tonumber(fs.getFreeSpace("/")/1000)))/10).."% Used")
  691.     elseif (vypMis > 2) then
  692.         myWindow.setCursorPos(((vypMis)/2)+1, 8)
  693.         term.write((math.ceil(1000 - (tonumber(fs.getFreeSpace("/")/1000)))/10).."%")
  694.     end
  695.  
  696.     myWindow.setTextColor(colors.black)
  697.     term.setBackgroundColor(colors.white)
  698.     internetcon = ""
  699.     myWindow.setCursorPos(2, 13)
  700.     if fs.exists ("/C/system/RAM/online") then
  701.     myWindow.setTextColor(colors.black)
  702.     internetcon = "Internet access"
  703.     else
  704.     myWindow.setTextColor(colors.red)
  705.     internetcon = "No internet access"
  706.     end
  707.     myWindow.setCursorPos(12, 13)
  708.     write  (internetcon)
  709.     myWindow.setTextColor(colors.black)
  710.     myWindow.setCursorPos(2, 13)
  711.     write  ("Network : ")
  712.     myWindow.setCursorPos(2, 14)
  713.     if os.getComputerLabel() == nil then
  714.         write  ("Label   : None")
  715.         else
  716.     write  ("Label   : "..(os.getComputerLabel()))
  717.     end
  718.     myWindow.setCursorPos(2, 15)
  719.     write  ("Comp. ID: "..(os.getComputerID()))
  720.  
  721.     term.setBackgroundColor (nastaveni.barva)
  722.     term.setTextColor(colors.lime)
  723.     term.setCursorPos(2,3)
  724.     write  "< Info"
  725. term.setTextColor(colors.white)
  726.    
  727.       while true do
  728.     local event, button, x, y = os.pullEvent("mouse_click")
  729.     xy = x..","..y
  730.      
  731.     if x >= 2 and x <= 16 and y == 3 and button == 1 then
  732.     setupmenu ()
  733.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  734.     credits ()
  735.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  736.     disk ()
  737.     else
  738.     paintutils.drawLine(1, 1, w, 1, colors.black)
  739.     paintutils.drawPixel (w,1, colors.red)
  740.     term.setCursorPos (w,1)
  741.     write  "*"
  742.     paintutils.drawPixel (50,1, colors.lightGray)
  743.     term.setCursorPos (w-1,1)
  744.     write  "<"
  745.     paintutils.drawPixel (49,1, colors.lightGray)
  746.         term.setCursorPos (w-2,1)
  747.         write  "_"
  748.  
  749.              while true do
  750.         local event, button, x, y = os.pullEvent("mouse_click")
  751.         xy = x..","..y
  752.        
  753.         if x == w and y == 1 then
  754.             ukonceni ()
  755.         elseif x == w-1 and y == 1 then
  756.             setupmenu ()
  757.         elseif x == w-2 and y == 1 then
  758.             minimalizace ()
  759.         else
  760.         info ()
  761.             end
  762.             end
  763. end
  764. end
  765. end
  766.  
  767. function credits ()
  768. funkce = "credits"
  769.         local myWindow = window.create(term.current(),17,1,w-16,h)
  770.     myWindow.setBackgroundColor(colors.white)
  771.     myWindow.clear()
  772.     term.setBackgroundColor(nastaveni.barva)
  773.        term.setCursorPos(1,1)
  774.        write  "               "
  775.        paintutils.drawPixel(16, 1, colors.gray)
  776.        term.setBackgroundColor(colors.white)
  777.        term.setCursorPos(17,1)
  778.        write  "                                   "
  779.        myWindow.setTextColor(colors.lime)
  780.     myWindow.setCursorPos(2, 2)
  781.     write  "Pepek@Soft"
  782.     term.setTextColor(colors.black)
  783.     myWindow.setCursorPos(13, 2)
  784.     write  "Programs"
  785.     myWindow.setTextColor(colors.blue)
  786.     myWindow.setCursorPos(7, 2)
  787.     write  "@"
  788.     myWindow.setTextColor(colors.black)
  789.  
  790.    
  791.         while true do
  792.         local event, button, x, y = os.pullEvent("mouse_click")
  793.         xy = x..","..y
  794.    
  795.     if x >= 2 and x <= 16 and y == 3 and button == 1 then
  796.     setupmenu ()
  797.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  798.     credits ()
  799.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  800.     disk ()
  801.     else
  802.     paintutils.drawLine(1, 1, w, 1, colors.black)
  803.     paintutils.drawPixel (w,1, colors.red)
  804.     term.setTextColor(colors.white)
  805.     term.setCursorPos (w,1)
  806.     write  "*"
  807.     paintutils.drawPixel (50,1, colors.lightGray)
  808.     term.setCursorPos (w-1,1)
  809.     write  "<"
  810.     paintutils.drawPixel (49,1, colors.lightGray)
  811.         term.setCursorPos (w-2,1)
  812.         write  "_"
  813.  
  814.              while true do
  815.         local event, button, x, y = os.pullEvent("mouse_click")
  816.         xy = x..","..y
  817.        
  818.         if x == w and y == 1 then
  819.             ukonceni ()
  820.         elseif x == w-1 and y == 1 then
  821.             info ()
  822.         elseif x == w-2 and y == 1 then
  823.             minimalizace ()
  824.         else
  825.         credits ()
  826.             end
  827.             end
  828. end
  829. end
  830. end
  831.  
  832. function disk ()
  833. funkce = "diskinfo"
  834.         local myWindow = window.create(term.current(),17,1,w-16,h)
  835.     myWindow.setBackgroundColor(colors.white)
  836.     myWindow.clear()
  837.     term.setBackgroundColor(nastaveni.barva)
  838.        term.setCursorPos(1,1)
  839.        write  "               "
  840.        paintutils.drawPixel(16, 1, colors.gray)
  841.        term.setBackgroundColor(colors.white)
  842.        term.setCursorPos(17,1)
  843.        write  "                                   "
  844.      myWindow.setTextColor(colors.black)
  845.     myWindow.setCursorPos(2, 9)
  846.     write ("Free Space: "..fs.getFreeSpace("/").." KB")
  847.         if fs.exists ("disk/") then
  848.             write ("Free Space: "..fs.getFreeSpace("disk/").." KB")
  849.             end
  850.  
  851.    
  852.         while true do
  853.         local event, button, x, y = os.pullEvent("mouse_click")
  854.         xy = x..","..y
  855.    
  856.  
  857. if x >= 2 and x <= 16 and y == 3 and button == 1 then
  858.     setupmenu ()
  859.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  860.     credits ()
  861.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  862.     disk ()
  863.     else
  864.     paintutils.drawLine(1, 1, w, 1, colors.black)
  865.     paintutils.drawPixel (w,1, colors.red)
  866.     term.setTextColor(colors.white)
  867.     term.setCursorPos (w,1)
  868.     write  "*"
  869.     paintutils.drawPixel (50,1, colors.lightGray)
  870.     term.setCursorPos (w-1,1)
  871.     write  "<"
  872.     paintutils.drawPixel (49,1, colors.lightGray)
  873.         term.setCursorPos (w-2,1)
  874.         write  "_"
  875.  
  876.              while true do
  877.         local event, button, x, y = os.pullEvent("mouse_click")
  878.         xy = x..","..y
  879.        
  880.         if x == w and y == 1 then
  881.             ukonceni ()
  882.         elseif x == w-1 and y == 1 then
  883.             info ()
  884.         elseif x == w-2 and y == 1 then
  885.             minimalizace ()
  886.         else
  887.         disk ()
  888.             end
  889.             end
  890. end
  891. end
  892. end
  893.  
  894. function theme ()
  895. funkce = "theme"
  896. if funkces == nil then
  897. local f=fs.open("/C/system/Users/"..user.."/colors","r")
  898. local cnt=f.readAll()
  899. f.close()
  900. local nastaveni=textutils.unserialize(cnt)
  901.      
  902. local f=fs.open("/C/system/Users/"..user.."/textcol","r")
  903. local tnt=f.readAll()
  904. f.close()
  905. local text=textutils.unserialize(tnt)
  906.  
  907. local myWindow = window.create(term.current(),1,1,15,h)
  908.     myWindow.setBackgroundColor(nastaveni.barva)
  909.     myWindow.clear()
  910.     term.setBackgroundColor (nastaveni.barva)
  911.     term.setTextColor(colors.lime)
  912.     term.setCursorPos(2,3)
  913.     write  "< Info"
  914.     term.setTextColor(text.barva)
  915.     term.setCursorPos(2,5)
  916.     write  "Colors"
  917.     term.setCursorPos(2,7)
  918.     write  "Background"
  919.    
  920.     local myWindow = window.create(term.current(),17,1,w-16,h)
  921.     myWindow.setBackgroundColor(colors.white)
  922.     myWindow.clear()
  923.     term.setBackgroundColor (nastaveni.barva)
  924.     term.setTextColor(colors.lime)
  925.     term.setCursorPos(2,3)
  926.     write  "< Theme"
  927.    
  928.         local myWindow = window.create(term.current(),17,1,w-16,h)
  929.     myWindow.setBackgroundColor(colors.white)
  930.     myWindow.clear()
  931.     term.setBackgroundColor(nastaveni.barva)
  932.        term.setCursorPos(1,1)
  933.        write  "               "
  934. end
  935.  
  936.        paintutils.drawPixel(16, 1, colors.gray)
  937.        term.setBackgroundColor(colors.white)
  938.        term.setCursorPos(17,1)
  939.        write  "                                   "
  940.        term.setCursorPos(19,6)
  941.        term.setTextColor(colors.black)
  942.        write  "Change background color."
  943.        term.setCursorPos(19,13)
  944.        write  "Change text color."
  945.        term.setCursorPos(30,8)
  946.        write  "W"
  947.        term.setCursorPos(30,15)
  948.        write  "W"
  949.        paintutils.drawPixel(20, 8, colors.orange)
  950.        paintutils.drawPixel(22, 8, colors.magenta)
  951.        paintutils.drawPixel(24, 8, colors.yellow)
  952.        paintutils.drawPixel(26, 8, colors.cyan)
  953.        paintutils.drawPixel(28, 8, colors.purple)
  954.        paintutils.drawPixel(20, 10, colors.blue)
  955.        paintutils.drawPixel(22, 10, colors.brown)
  956.        paintutils.drawPixel(24, 10, colors.green)
  957.        paintutils.drawPixel(26, 10, colors.red)
  958.        paintutils.drawPixel(28, 10, colors.black)
  959.        paintutils.drawPixel(30, 10, colors.gray)
  960.        paintutils.drawPixel(20, 15, colors.orange)
  961.        paintutils.drawPixel(22, 15, colors.magenta)
  962.        paintutils.drawPixel(24, 15, colors.yellow)
  963.        paintutils.drawPixel(26, 15, colors.cyan)
  964.        paintutils.drawPixel(28, 15, colors.purple)
  965.        paintutils.drawPixel(20, 17, colors.blue)
  966.        paintutils.drawPixel(22, 17, colors.brown)
  967.        paintutils.drawPixel(24, 17, colors.green)
  968.        paintutils.drawPixel(26, 17, colors.red)
  969.        paintutils.drawPixel(28, 17, colors.black)
  970.        paintutils.drawPixel(30, 17, colors.gray)
  971.        paintutils.drawPixel(35, 8, nastaveni.barva)
  972.        paintutils.drawPixel(36, 8, nastaveni.barva)
  973.        paintutils.drawPixel(37, 8, nastaveni.barva)
  974.        paintutils.drawPixel(35, 9, nastaveni.barva)
  975.        paintutils.drawPixel(36, 9, nastaveni.barva)
  976.        paintutils.drawPixel(37, 9, nastaveni.barva)
  977.        paintutils.drawPixel(35, 10, nastaveni.barva)
  978.        paintutils.drawPixel(36, 10, nastaveni.barva)
  979.        paintutils.drawPixel(37, 10, nastaveni.barva)
  980.        paintutils.drawPixel(38, 8, nastaveni.barva)
  981.        paintutils.drawPixel(38, 9, nastaveni.barva)
  982.        paintutils.drawPixel(38, 10, nastaveni.barva)
  983.        term.setCursorPos (35,9)
  984.        term.setTextColor(text.barva)
  985.        write  "Text"
  986.        term.setTextColor(colors.white)
  987.        term.setBackgroundColor(colors.gray)
  988.            term.setCursorPos(44, 16)
  989.     write  " Apply "
  990.        
  991.  
  992.    
  993.         while true do
  994.         local event, button, x, y = os.pullEvent("mouse_click")
  995.         xy = x..","..y
  996.    
  997.     if x == 20 and y == 8 and button == 1 then
  998.         local novaBarva= "orange"
  999.     if colors[novaBarva:lower()] then
  1000.   nastaveni.barva=colors[novaBarva:lower()]
  1001.     end
  1002.     funkces = 1
  1003.     theme ()
  1004.     elseif x == 22 and y == 8 and button == 1 then
  1005.     local novaBarva= "magenta"
  1006.     if colors[novaBarva:lower()] then
  1007.   nastaveni.barva=colors[novaBarva:lower()]
  1008.     end
  1009.     funkces = 1
  1010.     theme ()
  1011.     elseif x == 30 and y == 8 and button == 1 then
  1012.     local novaBarva= "white"
  1013.     if colors[novaBarva:lower()] then
  1014.   nastaveni.barva=colors[novaBarva:lower()]
  1015.     end
  1016.     funkces = 1
  1017.     theme ()
  1018.     elseif x == 24 and y == 8 and button == 1 then
  1019.     local novaBarva= "yellow"
  1020.     if colors[novaBarva:lower()] then
  1021.   nastaveni.barva=colors[novaBarva:lower()]
  1022.     end
  1023.     funkces = 1
  1024.     theme ()
  1025.     elseif x == 26 and y == 8 and button == 1 then
  1026.     local novaBarva= "cyan"
  1027.     if colors[novaBarva:lower()] then
  1028.   nastaveni.barva=colors[novaBarva:lower()]
  1029.     end
  1030.     funkces = 1
  1031.     theme ()
  1032.     elseif x == 28 and y == 8 and button == 1 then
  1033.     local novaBarva= "purple"
  1034.     if colors[novaBarva:lower()] then
  1035.   nastaveni.barva=colors[novaBarva:lower()]
  1036.     end
  1037.     funkces = 1
  1038.     theme ()
  1039.     elseif x == 20 and y == 10 and button == 1 then
  1040.     local novaBarva= "blue"
  1041.     if colors[novaBarva:lower()] then
  1042.   nastaveni.barva=colors[novaBarva:lower()]
  1043.     end
  1044.     funkces = 1
  1045.     theme ()
  1046.     elseif x == 22 and y == 10 and button == 1 then
  1047.     local novaBarva= "brown"
  1048.     if colors[novaBarva:lower()] then
  1049.   nastaveni.barva=colors[novaBarva:lower()]
  1050.     end
  1051.     funkces = 1
  1052.     theme ()
  1053.     elseif x == 24 and y == 10 and button == 1 then
  1054.     local novaBarva= "green"
  1055.     if colors[novaBarva:lower()] then
  1056.   nastaveni.barva=colors[novaBarva:lower()]
  1057.     end
  1058.     funkces = 1
  1059.     theme ()
  1060.     elseif x == 26 and y == 10 and button == 1 then
  1061.     local novaBarva= "red"
  1062.     if colors[novaBarva:lower()] then
  1063.   nastaveni.barva=colors[novaBarva:lower()]
  1064.     end
  1065.     funkces = 1
  1066.     theme ()
  1067.     elseif x == 28 and y == 10 and button == 1 then
  1068.     local novaBarva= "black"
  1069.     if colors[novaBarva:lower()] then
  1070.   nastaveni.barva=colors[novaBarva:lower()]
  1071.     end
  1072.     funkces = 1
  1073.     theme ()
  1074.     elseif x == 30 and y == 10 and button == 1 then
  1075.     local novaBarva= "gray"
  1076.     if colors[novaBarva:lower()] then
  1077.   nastaveni.barva=colors[novaBarva:lower()]
  1078.     end
  1079.     funkces = 1
  1080.     theme ()
  1081.     elseif x == 20 and y == 15 and button == 1 then
  1082.         local textBarva= "orange"
  1083.     if colors[textBarva:lower()] then
  1084.   text.barva=colors[textBarva:lower()]
  1085.     end
  1086.     funkces = 1
  1087.     theme ()
  1088.     elseif x == 22 and y == 15 and button == 1 then
  1089.     local textBarva= "magenta"
  1090.     if colors[textBarva:lower()] then
  1091.   text.barva=colors[textBarva:lower()]
  1092.     end
  1093.     funkces = 1
  1094.     theme ()
  1095.     elseif x == 24 and y == 15 and button == 1 then
  1096.     local textBarva= "yellow"
  1097.     if colors[textBarva:lower()] then
  1098.   text.barva=colors[textBarva:lower()]
  1099.     end
  1100.     funkces = 1
  1101.     theme ()
  1102.     elseif x == 26 and y == 15 and button == 1 then
  1103.     local textBarva= "cyan"
  1104.     if colors[textBarva:lower()] then
  1105.   text.barva=colors[textBarva:lower()]
  1106.     end
  1107.     funkces = 1
  1108.     theme ()
  1109.     elseif x == 28 and y == 15 and button == 1 then
  1110.     local textBarva= "purple"
  1111.     if colors[textBarva:lower()] then
  1112.   text.barva=colors[textBarva:lower()]
  1113.     end
  1114.     funkces = 1
  1115.     theme ()
  1116.     elseif x == 20 and y == 17 and button == 1 then
  1117.     local textBarva= "blue"
  1118.     if colors[textBarva:lower()] then
  1119.   text.barva=colors[textBarva:lower()]
  1120.     end
  1121.     funkces = 1
  1122.     theme ()
  1123.     elseif x == 22 and y == 17 and button == 1 then
  1124.     local textBarva= "brown"
  1125.     if colors[textBarva:lower()] then
  1126.   text.barva=colors[textBarva:lower()]
  1127.     end
  1128.     funkces = 1
  1129.     theme ()
  1130.     elseif x == 24 and y == 17 and button == 1 then
  1131.     local textBarva= "green"
  1132.     if colors[textBarva:lower()] then
  1133.   text.barva=colors[textBarva:lower()]
  1134.     end
  1135.     funkces = 1
  1136.     theme ()
  1137.     elseif x == 26 and y == 17 and button == 1 then
  1138.     local textBarva= "red"
  1139.     if colors[textBarva:lower()] then
  1140.   text.barva=colors[textBarva:lower()]
  1141.     end
  1142.     funkces = 1
  1143.     theme ()
  1144.     elseif x == 30 and y == 15 and button == 1 then
  1145.     local textBarva= "white"
  1146.     if colors[textBarva:lower()] then
  1147.   text.barva=colors[textBarva:lower()]
  1148.     end
  1149.     funkces = 1
  1150.     theme ()
  1151.     elseif x == 30 and y == 17 and button == 1 then
  1152.     local textBarva= "gray"
  1153.     if colors[textBarva:lower()] then
  1154.   text.barva=colors[textBarva:lower()]
  1155.     end
  1156.     funkces = 1
  1157.     theme ()
  1158.     elseif x == 28 and y == 17 and button == 1 then
  1159.     local textBarva= "black"
  1160.     if colors[textBarva:lower()] then
  1161.   text.barva=colors[textBarva:lower()]
  1162.     end
  1163.     funkces = 1
  1164.     theme ()
  1165.  
  1166.     elseif x >= 44 and x <= 51 and y == 16 and button == 1 then
  1167.         local f=fs.open("/C/system/Users/"..user.."/colors","w") --#otevrit soubor
  1168.         f.write(textutils.serialize(nastaveni)) --#zapsat tabulku jako text a ten ulozit
  1169.         f.close()
  1170.         local nastaveni={barva=colors.blue}
  1171.         local f=fs.open("/C/system/Users/"..user.."/textcol","w") --#otevrit soubor
  1172.         f.write(textutils.serialize(text)) --#zapsat tabulku jako text a ten ulozit
  1173.         f.close()
  1174.         local text={barva=colors.white}
  1175.         funkces = nil
  1176.         theme ()
  1177.     elseif x >= 2 and x <= 16 and y == 3 and button == 1 then
  1178.     funkces = nil
  1179.     setupmenu ()
  1180.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  1181.     funkces = nil
  1182.     theme ()
  1183.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  1184.     funkces = nil
  1185.     tapety ()
  1186.     else
  1187.     funkces = nil
  1188.     paintutils.drawLine(1, 1, w, 1, colors.black)
  1189.     paintutils.drawPixel (w,1, colors.red)
  1190.     term.setTextColor(colors.white)
  1191.     term.setCursorPos (w,1)
  1192.     write  "*"
  1193.     paintutils.drawPixel (50,1, colors.lightGray)
  1194.     term.setCursorPos (w-1,1)
  1195.     write  "<"
  1196.     paintutils.drawPixel (49,1, colors.lightGray)
  1197.     term.setCursorPos (w-2,1)
  1198.     write  "_"
  1199.              while true do
  1200.         local event, button, x, y = os.pullEvent("mouse_click")
  1201.         xy = x..","..y
  1202.        
  1203.         if x == w and y == 1 then
  1204.             ukonceni ()
  1205.         elseif x == w-1 and y == 1 then
  1206.             setupmenu ()
  1207.         elseif x == w-2 and y == 1 then
  1208.             minimalizace ()
  1209.         else
  1210.         theme ()
  1211.             end
  1212.             end
  1213. end
  1214. end
  1215. end
  1216.  
  1217. function tapety ()
  1218. funkce = "tapety"
  1219.     tap1 = "- Background clear"
  1220.     tap2 = "- Pepdroll"
  1221.     tap3 = "- Farm"
  1222.     tap4 = "- Windows XP"
  1223.     tap5 = "- Castle"
  1224.     local myWindow = window.create(term.current(),1,1,16,h)
  1225.     myWindow.setBackgroundColor(colors.gray)
  1226.     myWindow.clear()
  1227.     local myWindow = window.create(term.current(),1,1,15,h)
  1228.     myWindow.setBackgroundColor(nastaveni.barva)
  1229.     myWindow.clear()
  1230.     term.setBackgroundColor (nastaveni.barva)
  1231.     term.setTextColor(colors.lime)
  1232.     term.setCursorPos(2,3)
  1233.     write  "< Info"
  1234.     term.setTextColor(text.barva)
  1235.     term.setCursorPos(2,5)
  1236.     write  "Colors"
  1237.     term.setCursorPos(2,7)
  1238.     write  "Background"
  1239.     local myWindow = window.create(term.current(),17,1,w-16,h)
  1240.     myWindow.setBackgroundColor(colors.white)
  1241.     myWindow.clear()
  1242.     term.setBackgroundColor (nastaveni.barva)
  1243.     term.setTextColor(colors.lime)
  1244.     term.setCursorPos(2,3)
  1245.     write  "< Theme"
  1246.    
  1247.         local myWindow = window.create(term.current(),17,1,w-16,h)
  1248.     myWindow.setBackgroundColor(colors.white)
  1249.     myWindow.clear()
  1250.     term.setBackgroundColor(nastaveni.barva)
  1251.        term.setCursorPos(1,1)
  1252.        write  "               "
  1253.        paintutils.drawPixel(16, 1, colors.gray)
  1254.        term.setBackgroundColor(colors.white)
  1255.        term.setCursorPos(17,1)
  1256.        write  "                                   "
  1257.        myWindow.setCursorPos(2,6)
  1258.        term.setTextColor(colors.black)
  1259.        write  "Change background image."
  1260.        myWindow.setCursorPos(2, 8)
  1261.        write  (tap1)
  1262.        myWindow.setCursorPos(2, 10)
  1263.        write  (tap2)
  1264.        myWindow.setCursorPos(2, 12)
  1265.        write  (tap3)
  1266.        myWindow.setCursorPos(2, 14)
  1267.        write  (tap4)
  1268.        myWindow.setCursorPos(2, 16)
  1269.        write  (tap5)
  1270.        myWindow.setCursorPos(2, 18)
  1271.        write "Pastebin code: "
  1272.        term.setBackgroundColor(colors.lightGray)
  1273.        write "          "
  1274.  
  1275.         while true do
  1276.         local event, button, x, y = os.pullEvent("mouse_click")
  1277.         xy = x..","..y
  1278.    
  1279.  
  1280.     if x >= 2 and x <= 16 and y == 3 and button == 1 then
  1281.     setupmenu ()
  1282.     elseif x >= 33 and x <= 42 and y == 18 and button == 1 then
  1283.     term.setBackgroundColor(colors.gray)
  1284.     term.setTextColor(colors.white)
  1285.     term.setCursorPos(33, 18)
  1286.     write "          "
  1287.     term.setCursorPos(34, 18)
  1288.     backcode = read()
  1289.         --if backcode == "" then
  1290.         --tapety()
  1291.         --end
  1292.        
  1293.     if fs.exists("/C/system/Users/"..user.."/bar.nfp") then
  1294.     fs.delete("/C/system/Users/"..user.."/bar.nfp")
  1295.     end
  1296.     shell.run("pastebin get "..backcode.." /C/system/Users/"..user.."/bar.nfp")
  1297.     tapety()
  1298.    
  1299.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  1300.     theme ()
  1301.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  1302.     theme ()
  1303.     elseif x >= 16 and x <= 35 and y == 8 and button == 1 then
  1304.     myWindow.setCursorPos(2, 8)
  1305.     term.setBackgroundColor(colors.lightBlue)
  1306.     term.setTextColor(colors.white)
  1307.     write  (tap1)
  1308.     term.setBackgroundColor(colors.white)
  1309.     myWindow.setCursorPos(2, 1)
  1310.     fs.delete("/C/system/Users/"..user.."/bar.nfp")
  1311.     sleep(0.1)
  1312.     tapety ()
  1313.     elseif x >= 16 and x <= 35 and y == 10 and button == 1 then
  1314.     myWindow.setCursorPos(2, 10)
  1315.     term.setBackgroundColor(colors.lightBlue)
  1316.     term.setTextColor(colors.white)
  1317.     write  (tap2)
  1318.     term.setBackgroundColor(colors.white)
  1319.     myWindow.setCursorPos(2, 1)
  1320.     shell.run(" delete /C/system/Users/"..user.."/bar.nfp")
  1321.     myWindow.setCursorPos(2, 1)
  1322.     shell.run("pastebin get ZQ8BBcVQ /C/system/Users/"..user.."/bar.nfp")
  1323.     sleep(0.1)
  1324.     tapety ()
  1325.     elseif x >= 16 and x <= 35 and y == 12 and button == 1 then
  1326.     myWindow.setCursorPos(2, 12)
  1327.     term.setBackgroundColor(colors.lightBlue)
  1328.     term.setTextColor(colors.white)
  1329.     write  (tap3)
  1330.     term.setBackgroundColor(colors.white)
  1331.     myWindow.setCursorPos(2, 1)
  1332.     shell.run(" delete /C/system/Users/"..user.."/bar.nfp")
  1333.     myWindow.setCursorPos(2, 1)
  1334.     shell.run("pastebin get K0zXPiKn /C/system/Users/"..user.."/bar.nfp")
  1335.     sleep(0.1)
  1336.     tapety ()
  1337.     elseif x >= 16 and x <= 35 and y == 14 and button == 1 then
  1338.     myWindow.setCursorPos(2, 14)
  1339.     term.setBackgroundColor(colors.lightBlue)
  1340.     term.setTextColor(colors.white)
  1341.     write  (tap4)
  1342.     term.setBackgroundColor(colors.white)
  1343.     myWindow.setCursorPos(2, 1)
  1344.     shell.run(" delete /C/system/Users/"..user.."/bar.nfp")
  1345.     myWindow.setCursorPos(2, 1)
  1346.     shell.run("pastebin get iy3EcA4Z /C/system/Users/"..user.."/bar.nfp")
  1347.     sleep(0.1)
  1348.     tapety ()
  1349.     elseif x >= 16 and x <= 35 and y == 16 and button == 1 then
  1350.     myWindow.setCursorPos(2, 16)
  1351.     term.setBackgroundColor(colors.lightBlue)
  1352.     term.setTextColor(colors.white)
  1353.     write  (tap5)
  1354.     term.setBackgroundColor(colors.white)
  1355.     myWindow.setCursorPos(2, 1)
  1356.     shell.run(" delete /C/system/Users/"..user.."/bar.nfp")
  1357.     myWindow.setCursorPos(2, 1)
  1358.     shell.run("pastebin get C3MXEfYf /C/system/Users/"..user.."/bar.nfp")
  1359.     sleep(0.1)
  1360.     tapety ()
  1361.     else
  1362.     paintutils.drawLine(1, 1, w, 1, colors.black)
  1363.     paintutils.drawPixel (w,1, colors.red)
  1364.     term.setTextColor(colors.white)
  1365.     term.setCursorPos (w,1)
  1366.     write  "*"
  1367.     paintutils.drawPixel (50,1, colors.lightGray)
  1368.     term.setCursorPos (w-1,1)
  1369.     write  "<"
  1370.     paintutils.drawPixel (49,1, colors.lightGray)
  1371.     term.setCursorPos (w-2,1)
  1372.     write  "_"
  1373.              while true do
  1374.         local event, button, x, y = os.pullEvent("mouse_click")
  1375.         xy = x..","..y
  1376.        
  1377.         if x == w and y == 1 then
  1378.             ukonceni ()
  1379.         elseif x == w-1 and y == 1 then
  1380.             setupmenu ()
  1381.         elseif x == w-2 and y == 1 then
  1382.             minimalizace ()
  1383.         else
  1384.         tapety ()
  1385.             end
  1386.             end
  1387.  
  1388. end
  1389. end
  1390. end
  1391.  
  1392.  
  1393. function account ()
  1394. funkce = "account"
  1395.     defuser = user
  1396.         local myWindow = window.create(term.current(),16,1,37,h)
  1397.     myWindow.setBackgroundColor(colors.white)
  1398.     myWindow.clear()
  1399.         local myWindow = window.create(term.current(),1,1,16,h)
  1400.     myWindow.setBackgroundColor(colors.gray)
  1401.     myWindow.clear()
  1402.     local myWindow = window.create(term.current(),1,1,15,h)
  1403.     myWindow.setBackgroundColor(nastaveni.barva)
  1404.     myWindow.clear()
  1405.     term.setBackgroundColor (nastaveni.barva)
  1406.     term.setTextColor(colors.lime)
  1407.     term.setCursorPos(2,3)
  1408.     write  "< Accounts"
  1409.     term.setTextColor(text.barva)
  1410.     term.setCursorPos(2,5)
  1411.     write  "Password"
  1412.     term.setCursorPos(2,7)
  1413.     write  "Login"
  1414.     term.setCursorPos(2,9)
  1415.     write  "New user"
  1416.     term.setCursorPos(2,11)
  1417.     write  "Delete users"
  1418.     term.setCursorPos(2,13)
  1419.     write  "Log out"
  1420.    
  1421. --    if fs.exists ("/C/system/RAM/setting/"..user.."/setdata")then
  1422. --     local data = fs.open ("/C/system/RAM/setting/"..user.."/setdata", "r")
  1423. --        funkce = data.readLine ()
  1424. --        data.close ()
  1425. --        end
  1426.        
  1427.        
  1428.         if funkce == "password" then
  1429.             password ()
  1430.         elseif funkce == logon then
  1431.             login ()
  1432.         elseif funkce == "createuser" then
  1433.             createuser ()
  1434.         elseif funkce == "deleteuser" then
  1435.             deleteuser ()
  1436.         end
  1437.        
  1438.         logon ()
  1439. end
  1440.  
  1441. function deleteuser ()
  1442. funkce = "deleteuser"    
  1443.     function dele ()
  1444.                 term.setCursorPos (20, 13)
  1445.                 term.setTextColor(colors.lime)
  1446.                 write  "User is deleted!"
  1447.                 sleep (1)
  1448.                 fs.delete ("/C/system/Users/"..deluser)
  1449.                 deleteusers = 0
  1450.                 deleteuser ()
  1451.                 end
  1452.                         function defuserdel ()
  1453.                            if defuser == deluser then
  1454.                                term.setCursorPos (20, 13)
  1455.                                 term.setTextColor(colors.red)
  1456.                                 write  "User is a default!"
  1457.                                 sleep (1)
  1458.                                 local myWindow = window.create(term.current(),19,10,21,5)
  1459.                                 myWindow.setBackgroundColor(colors.gray)
  1460.                                 myWindow.clear()
  1461.                                 local myWindow = window.create(term.current(),18,9,21,5)
  1462.                                 myWindow.setBackgroundColor(colors.yellow)
  1463.                                 myWindow.clear()
  1464.                                 term.setTextColor(colors.black)
  1465.                                 myWindow.setCursorPos (2,2)
  1466.                                 write  "Do you want change"
  1467.                                 myWindow.setCursorPos (2,3)
  1468.                                 write  "default user now ?"
  1469.                                 myWindow.setCursorPos (2,5)
  1470.                                 write  "Yes             No"
  1471.                                
  1472.                         while true do
  1473.                         local event, button, x, y = os.pullEvent("mouse_click")
  1474.                         xy = x..","..y
  1475.                                 if x >= 19 and x <= 21 and y == 13 and button == 1 then
  1476.                                 logon ()
  1477.                                 else
  1478.                                 deleteusers = 1
  1479.                                 deleteuser ()
  1480.                                 end
  1481.                                 end
  1482.                                 else
  1483.                                 dele ()
  1484.                                 end
  1485.                                 end
  1486.                                
  1487.                                 function resetnow ()
  1488.                                  local myWindow = window.create(term.current(),19,10,21,5)
  1489.                                 myWindow.setBackgroundColor(colors.gray)
  1490.                                 myWindow.clear()
  1491.                                 local myWindow = window.create(term.current(),18,9,21,5)
  1492.                                 myWindow.setBackgroundColor(colors.yellow)
  1493.                                 myWindow.clear()
  1494.                                 term.setTextColor(colors.black)
  1495.                                 myWindow.setCursorPos (2,2)
  1496.                                 write  "Do you want       "
  1497.                                 myWindow.setCursorPos (2,3)
  1498.                                 write  "restart now ?     "
  1499.                                 myWindow.setCursorPos (2,5)
  1500.                                 write  "Yes             No"
  1501.                                
  1502.                         while true do
  1503.                         local event, button, x, y = os.pullEvent("mouse_click")
  1504.                         xy = x..","..y
  1505.                                 if x >= 19 and x <= 21 and y == 13 and button == 1 then
  1506.                                 restart ()
  1507.                                 else
  1508.                                 deleteusers = 1
  1509.                                 deleteuser ()
  1510.                                 end
  1511.                                 end
  1512.                                 end  
  1513.                
  1514.         if deleteusers == 0 then
  1515.             deluser = ""
  1516.             end
  1517.            
  1518.     term.setBackgroundColor(nastaveni.barva)
  1519.        term.setCursorPos(1,1)
  1520.        write  "               "
  1521.        paintutils.drawPixel(16, 1, colors.gray)
  1522.     local myWindow = window.create(term.current(),17,1,w-16,h)
  1523.     myWindow.setBackgroundColor(colors.white)
  1524.     myWindow.clear()
  1525.      term.setBackgroundColor(colors.white)
  1526.     term.setTextColor(colors.blue)
  1527.     myWindow.setCursorPos (2,3)
  1528.     write  "Delete an account"
  1529.     term.setTextColor(colors.black)
  1530.     myWindow.setCursorPos(2, 5)
  1531.     write  "User name:"
  1532.     term.setBackgroundColor(colors.gray)
  1533.     term.setTextColor(colors.white)
  1534.     myWindow.setCursorPos(30, 16)
  1535.     write  " Apply "
  1536.     term.setBackgroundColor(colors.lightGray)
  1537.     myWindow.setCursorPos(13, 5)
  1538.     write  "              "
  1539.     term.setCursorPos(29, 5)
  1540.     write  (deluser)
  1541.     myWindow.setCursorPos(35,9)
  1542.     write  "<"
  1543.            
  1544.     while true do
  1545.         local event, button, x, y = os.pullEvent("mouse_click")
  1546.         xy = x..","..y
  1547.  
  1548.     if x >= 29 and x <= 44 and y == 5 and button == 1 then
  1549.             term.setBackgroundColor(colors.gray)
  1550.             term.setCursorPos(29, 5)
  1551.             write  "              "
  1552.             term.setCursorPos(29, 5)
  1553.             deluser = read ()
  1554.             deleteusers = 1
  1555.             deleteuser ()
  1556.     elseif x >= 44 and x <= 51 and y == 16 and button == 1 then
  1557.         term.setBackgroundColor(colors.white)
  1558.        
  1559.         if fs.exists ("/C/system/RAM/setting/"..user.."/"..deluser) then
  1560.             term.setCursorPos (20, 13)
  1561.                         term.setTextColor(colors.red)
  1562.                         write  "You must restart computer"
  1563.                         sleep (1)
  1564.                         resetnow ()
  1565.                         end
  1566.                        
  1567.         if fs.exists ("/C/system/Users/"..deluser) then
  1568.              if fs.exists ("/C/system/.core/defuser") then
  1569.                data = fs.open ("/C/system/.core/defuser", "r")
  1570.                defuser = data.readLine ()
  1571.                defuserdel ()
  1572.                else
  1573.                dele ()
  1574.                end
  1575.            else
  1576.            term.setCursorPos (20, 13)
  1577.                 term.setTextColor(colors.red)
  1578.                 write  "User is not found!"
  1579.                 sleep (1)
  1580.                 deleteusers = 1
  1581.                 deleteuser ()
  1582.                 end
  1583.                
  1584.     elseif x == 51 and y == 9 and button == 1 then              
  1585.         local myWindow = window.create(term.current(),1,17,51,3)
  1586.         myWindow.setBackgroundColor(colors.yellow)
  1587.         myWindow.clear()
  1588.         term.setCursorPos(1,17)
  1589.         shell.run ("ls /C/system/Users/")
  1590.        
  1591.         while true do
  1592.         local event, button, xPos, yPos = os.pullEvent("mouse_click")
  1593.         local myWindow = window.create(term.current(),1,17,15,3)
  1594.         myWindow.setBackgroundColor(nastaveni.barva)
  1595.         myWindow.clear()
  1596.         local myWindow = window.create(term.current(),17,17,40,3)
  1597.         myWindow.setBackgroundColor(colors.white)
  1598.         myWindow.clear()
  1599.         paintutils.drawPixel(16, 17, colors.gray)
  1600.         paintutils.drawPixel(16, 18, colors.gray)
  1601.         paintutils.drawPixel(16, 19, colors.gray)
  1602.         deleteuser ()
  1603.         end
  1604.     elseif x >= 2 and x <= 16 and y == 3 and button == 1 then
  1605.     setupmenu ()
  1606.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  1607.     password ()
  1608.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  1609.     logon ()
  1610.     elseif x >= 2 and x <= 16 and y == 9 and button == 1 then
  1611.     createuser ()
  1612.     elseif x >= 2 and x <= 16 and y == 11 and button == 1 then
  1613.     deleteuser ()
  1614.     elseif x >= 2 and x <= 16 and y == 13 and button == 1 then
  1615.     odhlasit ()
  1616.     else
  1617.     paintutils.drawLine(1, 1, w, 1, colors.black)
  1618.     paintutils.drawPixel (w,1, colors.red)
  1619.     term.setTextColor(colors.white)
  1620.     term.setCursorPos (w,1)
  1621.     write  "*"
  1622.     paintutils.drawPixel (50,1, colors.lightGray)
  1623.     term.setCursorPos (w-1,1)
  1624.     write  "<"
  1625.     paintutils.drawPixel (49,1, colors.lightGray)
  1626.     term.setCursorPos (w-2,1)
  1627.     write  "_"
  1628.              while true do
  1629.         local event, button, x, y = os.pullEvent("mouse_click")
  1630.         xy = x..","..y
  1631.        
  1632.         if x == w and y == 1 then
  1633.             ukonceni ()
  1634.         elseif x == w-1 and y == 1 then
  1635.             account ()
  1636.         elseif x == w-2 and y == 1 then
  1637.             minimalizace ()
  1638.         else
  1639.         deleteuser ()
  1640.             end
  1641.             end
  1642. end
  1643. end
  1644. end
  1645.  
  1646. function createuser ()
  1647. funkce = "createuser"
  1648.         if register == 0 then
  1649.             newuser = ""
  1650.             newpass = ""
  1651.             newpas = ""
  1652.             end
  1653.            
  1654.     term.setBackgroundColor(nastaveni.barva)
  1655.        term.setCursorPos(1,1)
  1656.        write  "               "
  1657.        paintutils.drawPixel(16, 1, colors.gray)
  1658.     local myWindow = window.create(term.current(),17,1,w-16,h)
  1659.     myWindow.setBackgroundColor(colors.white)
  1660.    
  1661.     myWindow.clear()
  1662.     myWindow.setCursorPos (2,3)
  1663.     term.setTextColor(colors.blue)
  1664.      term.setBackgroundColor(colors.white)
  1665.     write  "Create a new account"
  1666.     term.setTextColor(colors.black)
  1667.     myWindow.setCursorPos(2, 5)
  1668.     write  "User name:"
  1669.     myWindow.setCursorPos(2, 7)
  1670.     write  " Password:"
  1671.     term.setBackgroundColor(colors.gray)
  1672.     term.setTextColor(colors.white)
  1673.     myWindow.setCursorPos(30, 16)
  1674.     write  " Apply "
  1675.     term.setBackgroundColor(colors.lightGray)
  1676.     myWindow.setCursorPos(13, 5)
  1677.     write  "              "
  1678.     myWindow.setCursorPos(13, 5)
  1679.     write  (newuser)
  1680.     myWindow.setCursorPos(13, 7)
  1681.     write  "              "
  1682.     myWindow.setCursorPos(13, 7)
  1683.     write  (newpas)
  1684.     myWindow.setCursorPos(35,9)
  1685.     write  "<"
  1686.    
  1687.     while true do
  1688.         local event, button, x, y = os.pullEvent("mouse_click")
  1689.         xy = x..","..y
  1690.    
  1691.         if x >= 29 and x <= 44 and y == 5 and button == 1 then
  1692.             term.setBackgroundColor(colors.gray)
  1693.             term.setCursorPos(29, 5)
  1694.             write  "              "
  1695.             term.setCursorPos(29, 5)
  1696.             newuser = read ()
  1697.             register = 1
  1698.             createuser ()
  1699.         elseif x >= 29 and x <= 44 and y == 7 and button == 1 then
  1700.             term.setBackgroundColor(colors.gray)
  1701.             term.setCursorPos(29, 7)
  1702.             write  "              "
  1703.             term.setCursorPos(29, 7)
  1704.             newpass= read ("@")
  1705.             newpas = "Password"
  1706.             register = 1
  1707.             createuser ()
  1708.     elseif x >= 44 and x <= 51 and y == 16 and button == 1 then
  1709.     term.setBackgroundColor(colors.white)
  1710.                 if not fs.exists ("/C/system/Users/"..newuser) then
  1711.                         file = fs.open ("/C/system/Users/"..newuser.."/.data", "w")
  1712.                         file.writeLine(newuser)
  1713.                         file.writeLine(newpass)
  1714.                         file.close ()
  1715.                         term.setCursorPos(17,13)
  1716.                         shell.run ("pastebin get ZQ8BBcVQ ", "/C/system/Users/"..newuser.."/bar.nfp")
  1717.                         term.setCursorPos(17,13)
  1718.                         shell.run ("pastebin get 2Rg15U0q ", "/C/system/Users/"..newuser.."/user")
  1719.                         local myWindow = window.create(term.current(),17,13,34,3)
  1720.                         myWindow.setBackgroundColor(colors.white)
  1721.                         myWindow.clear ()
  1722.                         term.setCursorPos(20,14)
  1723.                         term.setTextColor(colors.lime)
  1724.                         write  "Complete"
  1725.                         register = 0
  1726.                         local myWindow = window.create(term.current(),1,14,15,2)
  1727.                         myWindow.setBackgroundColor(nastaveni.barva)
  1728.                         myWindow.clear()
  1729.                         paintutils.drawPixel(16, 14, colors.gray)
  1730.                         paintutils.drawPixel(16, 15, colors.gray)
  1731.                         sleep (1)
  1732.                         createuser ()
  1733.                         else
  1734.                         term.setCursorPos (20, 13)
  1735.                         term.setTextColor(colors.red)
  1736.                         write  "User is exists"
  1737.                         sleep (1)
  1738.                         register = 1
  1739.                         createuser ()
  1740.                     end
  1741.     elseif x == 51 and y == 9 and button == 1 then              
  1742.         local myWindow = window.create(term.current(),1,17,51,3)
  1743.         myWindow.setBackgroundColor(colors.yellow)
  1744.         myWindow.clear()
  1745.         term.setCursorPos(1,17)
  1746.         shell.run ("ls /C/system/Users/")
  1747.        
  1748.         while true do
  1749.         local event, button, xPos, yPos = os.pullEvent("mouse_click")
  1750.         local myWindow = window.create(term.current(),1,17,15,3)
  1751.         myWindow.setBackgroundColor(nastaveni.barva)
  1752.         myWindow.clear()
  1753.         local myWindow = window.create(term.current(),17,17,40,3)
  1754.         myWindow.setBackgroundColor(colors.white)
  1755.         myWindow.clear()
  1756.         paintutils.drawPixel(16, 17, colors.gray)
  1757.         paintutils.drawPixel(16, 18, colors.gray)
  1758.         paintutils.drawPixel(16, 19, colors.gray)
  1759.         createuser ()
  1760.         end
  1761.        
  1762.     elseif x >= 2 and x <= 16 and y == 3 and button == 1 then
  1763.     setupmenu ()
  1764.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  1765.     password ()
  1766.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  1767.     logon ()
  1768.     elseif x >= 2 and x <= 16 and y == 9 and button == 1 then
  1769.     createuser ()
  1770.     elseif x >= 2 and x <= 16 and y == 11 and button == 1 then
  1771.     deleteuser ()
  1772.     elseif x >= 2 and x <= 16 and y == 13 and button == 1 then
  1773.     odhlasit ()
  1774.     else
  1775.     paintutils.drawLine(1, 1, w, 1, colors.black)
  1776.     paintutils.drawPixel (w,1, colors.red)
  1777.     term.setTextColor(colors.white)
  1778.     term.setCursorPos (w,1)
  1779.     write  "*"
  1780.     paintutils.drawPixel (50,1, colors.lightGray)
  1781.     term.setCursorPos (w-1,1)
  1782.     write  "<"
  1783.     paintutils.drawPixel (49,1, colors.lightGray)
  1784.     term.setCursorPos (w-2,1)
  1785.     write  "_"
  1786.              while true do
  1787.         local event, button, x, y = os.pullEvent("mouse_click")
  1788.         xy = x..","..y
  1789.        
  1790.         if x == w and y == 1 then
  1791.             ukonceni ()
  1792.         elseif x == w-1 and y == 1 then
  1793.             account ()
  1794.         elseif x == w-2 and y == 1 then
  1795.             minimalizace ()
  1796.         else
  1797.         createuser ()
  1798.             end
  1799.             end
  1800. end
  1801. end
  1802. end
  1803.  
  1804.    function logon ()
  1805.    funkce = "logon"
  1806.     defuser = user
  1807.        function apply ()
  1808.            
  1809.         term.setBackgroundColor(colors.white)
  1810.         data = fs.open("/C/system/.core/defuser","w")
  1811.         data.writeLine(defuser)
  1812.         data.close()
  1813.         term.setCursorPos (20, 13)
  1814.                 term.setTextColor(colors.lime)
  1815.                 write  "Successeful!"
  1816.                 sleep (1)
  1817.         logon ()
  1818.            end
  1819.         local data = fs.open("/C/system/.core/defuser","r")
  1820.         defuser = data.readLine ()
  1821.         data.close ()  
  1822.         local n=fs.open("/C/system/.core/logon.cfg","r")
  1823.         preskoclog = n.readLine ()
  1824.         n.close ()        
  1825.        term.setBackgroundColor(nastaveni.barva)
  1826.        term.setCursorPos(1,1)
  1827.        write  "               "
  1828.        paintutils.drawPixel(16, 1, colors.gray)
  1829.         local myWindow = window.create(term.current(),17,1,w-16,h)
  1830.     myWindow.setBackgroundColor(colors.white)
  1831.     myWindow.clear()
  1832.     term.setTextColor(colors.blue)
  1833.     term.setBackgroundColor(colors.white)
  1834.     myWindow.setCursorPos (2,3)
  1835.     write  "Setting a login"
  1836.  
  1837.     term.setBackgroundColor(colors.white)
  1838.     term.setTextColor(colors.black)
  1839.     term.setCursorPos(22, 9)
  1840.     write  ("You must log")
  1841.     term.setCursorPos(20, 16)
  1842.     write  ("If you want skip login,")
  1843.     term.setCursorPos(20, 17)
  1844.     write  ("default user will ")
  1845.     term.setCursorPos(38, 17)
  1846.     term.setBackgroundColor(colors.lightGray)
  1847.     write  (defuser)
  1848.         myWindow.setCursorPos(35,9)
  1849.     write  "<"
  1850.     term.setBackgroundColor(colors.lightGray)
  1851.     term.setCursorPos(37,9)  
  1852.     if preskoclog == "1" then
  1853.         stavlog = "No"
  1854.         else
  1855.         stavlog = "Yes"
  1856.         end
  1857.         term.setTextColor(colors.white)
  1858.     write  ("  "..stavlog.."  ")
  1859.         if stavlog == "Yes" then
  1860.             paintutils.drawPixel (37, 9, colors.lime)
  1861.         elseif stavlog == "No" then
  1862.             paintutils.drawPixel (43, 9, colors.red)
  1863.             paintutils.drawPixel (37, 9, colors.lightGray)
  1864.        end
  1865.  
  1866.    
  1867.    
  1868.         while true do
  1869.         local event, button, x, y = os.pullEvent("mouse_click")
  1870.         xy = x..","..y
  1871.    
  1872.     if x >= 37 and x <= 43 and y == 17 and button == 1 then
  1873.         term.setCursorPos(38, 17)
  1874.         term.setBackgroundColor(colors.gray)
  1875.         write  "          "
  1876.         term.setCursorPos(38, 17)
  1877.         defus = read ()
  1878.             if fs.exists ("/C/system/Users/"..defus) then
  1879.                 defuser = defus
  1880.                 apply ()
  1881.                 else
  1882.                 term.setBackgroundColor(colors.white)
  1883.                 term.setCursorPos (20, 13)
  1884.                 term.setTextColor(colors.red)
  1885.                 write  "User not found!"
  1886.                 sleep (1)
  1887.                 logon ()
  1888.              end
  1889.         end
  1890.        
  1891.    if x >= 37 and x <= 43 and y == 9 and button == 1 then
  1892.  
  1893.     if preskoclog == "1" then
  1894.     preskoclog = "0"
  1895.     elseif preskoclog == "0" then
  1896.     preskoclog = "1"
  1897.     end
  1898.    
  1899. local n=fs.open("/C/system/.core/logon.cfg","w")
  1900. n.writeLine(preskoclog)
  1901. n.close()
  1902. logon ()
  1903.        
  1904.     elseif x == 51 and y == 9 and button == 1 then              
  1905.         local myWindow = window.create(term.current(),1,17,51,3)
  1906.         myWindow.setBackgroundColor(colors.yellow)
  1907.         myWindow.clear()
  1908.         term.setCursorPos(1,17)
  1909.         shell.run ("ls /C/system/Users/")
  1910.        
  1911.         while true do
  1912.         local event, button, xPos, yPos = os.pullEvent("mouse_click")
  1913.         local myWindow = window.create(term.current(),1,17,15,3)
  1914.         myWindow.setBackgroundColor(nastaveni.barva)
  1915.         myWindow.clear()
  1916.         local myWindow = window.create(term.current(),17,17,40,3)
  1917.         myWindow.setBackgroundColor(colors.white)
  1918.         myWindow.clear()
  1919.         paintutils.drawPixel(16, 17, colors.gray)
  1920.         paintutils.drawPixel(16, 18, colors.gray)
  1921.         paintutils.drawPixel(16, 19, colors.gray)
  1922.         logon ()
  1923.         end
  1924.     elseif x >= 2 and x <= 16 and y == 3 and button == 1 then
  1925.     setupmenu ()
  1926.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  1927.     password ()
  1928.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  1929.     logon ()
  1930.     elseif x >= 2 and x <= 16 and y == 9 and button == 1 then
  1931.      createuser ()
  1932.     elseif x >= 2 and x <= 16 and y == 11 and button == 1 then
  1933.     deleteuser ()
  1934.     elseif x >= 2 and x <= 16 and y == 13 and button == 1 then
  1935.     odhlasit ()
  1936.     else
  1937.     paintutils.drawLine(1, 1, w, 1, colors.black)
  1938.     paintutils.drawPixel (w,1, colors.red)
  1939.     term.setTextColor(colors.white)
  1940.     term.setCursorPos (w,1)
  1941.     write  "*"
  1942.     paintutils.drawPixel (50,1, colors.lightGray)
  1943.     term.setCursorPos (w-1,1)
  1944.     write  "<"
  1945.     paintutils.drawPixel (49,1, colors.lightGray)
  1946.     term.setCursorPos (w-2,1)
  1947.     write  "_"
  1948.  
  1949.              while true do
  1950.         local event, button, x, y = os.pullEvent("mouse_click")
  1951.         xy = x..","..y
  1952.        
  1953.         if x == w and y == 1 then
  1954.             ukonceni ()
  1955.         elseif x == w-1 and y == 1 then
  1956.             account ()
  1957.         elseif x == w-2 and y == 1 then
  1958.             minimalizace ()
  1959.         else
  1960.         logon ()
  1961.             end
  1962.             end
  1963. end
  1964. end
  1965. end
  1966.  
  1967.  function password ()
  1968.  funkce = "password"
  1969.      
  1970.      if login == 1 then
  1971.          else
  1972.         passold = ""
  1973.         passoldp = ""
  1974.         pass1 = ""
  1975.         pass1p = ""
  1976.         pass2 = ""
  1977.         pass2p = ""
  1978.         end
  1979.        
  1980.         local n=fs.open("/C/system/.core/logon.cfg","r")
  1981.         preskoclog = n.readLine ()
  1982.         n.close ()
  1983.        
  1984.        term.setBackgroundColor(nastaveni.barva)
  1985.        term.setCursorPos(1,1)
  1986.        write  "               "
  1987.        paintutils.drawPixel(16, 1, colors.gray)
  1988.         local myWindow = window.create(term.current(),17,1,w-16,h)
  1989.     myWindow.setBackgroundColor(colors.white)
  1990.     myWindow.clear()
  1991.      term.setBackgroundColor(colors.white)
  1992.     term.setTextColor(colors.blue)
  1993.     myWindow.setCursorPos (2,3)
  1994.     write  "Change your password"
  1995.     term.setTextColor(colors.black)
  1996.     myWindow.setCursorPos(2, 5)
  1997.     write  "Your old password:"
  1998.     myWindow.setCursorPos(2, 7)
  1999.     write  "Your new password:"
  2000.     myWindow.setCursorPos(3, 9)
  2001.     write  "Confirm password:"
  2002.     term.setBackgroundColor(colors.gray)
  2003.     term.setTextColor(colors.white)
  2004.     myWindow.setCursorPos(30, 16)
  2005.     write  " Apply "
  2006.     term.setBackgroundColor(colors.lightGray)
  2007.     myWindow.setCursorPos(21, 5)
  2008.     write  "              "
  2009.     myWindow.setCursorPos(21, 5)
  2010.     write  (passoldp)
  2011.     myWindow.setCursorPos(21, 7)
  2012.     write  "              "
  2013.     myWindow.setCursorPos(21, 7)
  2014.     write  (pass1p)
  2015.     myWindow.setCursorPos(21, 9)
  2016.     write  "              "
  2017.     myWindow.setCursorPos(21, 9)
  2018.         if pass2 == pass1 then
  2019.         term.setTextColor(colors.lime)  
  2020.         write  "Valid"
  2021.         else
  2022.         term.setTextColor(colors.red)
  2023.         write  "Invalid"
  2024.         end
  2025.  
  2026.    
  2027.         while true do
  2028.         local event, button, x, y = os.pullEvent("mouse_click")
  2029.         xy = x..","..y
  2030.     if x >= 37 and x <= 50 and y == 5 and button == 1 then
  2031.     term.setBackgroundColor(colors.gray)
  2032.     term.setCursorPos(37, 5)
  2033.     write  "              "
  2034.     term.setCursorPos(37, 5)
  2035.     term.setTextColor(colors.white)
  2036.     passold = read ("@")
  2037.     passoldp = "Old Password"
  2038.     login = 1
  2039.     password ()
  2040.     elseif x >= 37 and x <= 50 and y == 7 and button == 1 then
  2041.     term.setBackgroundColor(colors.gray)
  2042.     term.setCursorPos(37, 7)
  2043.     write  "              "
  2044.     term.setCursorPos(37, 7)
  2045.     term.setTextColor(colors.white)
  2046.     pass1 = read ("@")
  2047.     pass1p = "New Password"
  2048.     login = 1
  2049.     password ()
  2050.     elseif x >= 37 and x <= 50 and y == 9 and button == 1 then
  2051.     term.setBackgroundColor(colors.gray)
  2052.     term.setCursorPos(37, 9)
  2053.     write  "              "
  2054.     term.setCursorPos(37, 9)
  2055.     term.setTextColor(colors.white)
  2056.     pass2 = read ("@")
  2057.     password ()
  2058.  
  2059.     elseif x >= 44 and x <= 51 and y == 16 and button == 1 then
  2060.    
  2061.     o=fs.open ("/C/system/Users/"..user.."/.data", "r")
  2062.     user=o.readLine()
  2063.     passI=o.readLine()
  2064.     o.close()
  2065.     term.setBackgroundColor(colors.white)
  2066.         if passold == passI then
  2067.             if pass1 == pass2 then
  2068.                 term.setCursorPos (20, 13)
  2069.             term.setTextColor(colors.lime)
  2070.             data = fs.open("/C/system/Users/"..user.."/.data","w")
  2071.             data.writeLine(user)
  2072.             data.writeLine(pass1)
  2073.             data.close()
  2074.             write  "Your accound has been changed."
  2075.             login = 0
  2076.             sleep (1)
  2077.             password ()
  2078.             else
  2079.             term.setCursorPos (20, 13)
  2080.             term.setTextColor(colors.red)
  2081.             write  "Invalid confirm password!"
  2082.             login = 1
  2083.             sleep (1)
  2084.             password ()
  2085.             end
  2086.     else
  2087.     term.setCursorPos (20, 13)
  2088.     term.setTextColor(colors.red)
  2089.     write  "Invalid old password!"
  2090.     sleep (1)
  2091.     login = 1
  2092.     password ()
  2093.     end
  2094.          
  2095.     elseif x >= 2 and x <= 16 and y == 3 and button == 1 then
  2096.     login = 0
  2097.     setupmenu ()
  2098.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  2099.     login = 0
  2100.     password ()
  2101.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  2102.     login = 0
  2103.     logon ()
  2104.     elseif x >= 2 and x <= 16 and y == 9 and button == 1 then
  2105.      createuser ()
  2106.     elseif x >= 2 and x <= 16 and y == 11 and button == 1 then
  2107.     deleteuser ()
  2108.     elseif x >= 2 and x <= 16 and y == 13 and button == 1 then
  2109.     odhlasit ()
  2110.     else
  2111.     paintutils.drawLine(1, 1, w, 1, colors.black)
  2112.     paintutils.drawPixel (w,1, colors.red)
  2113.     term.setTextColor(colors.white)
  2114.     term.setCursorPos (w,1)
  2115.     write  "*"
  2116.     paintutils.drawPixel (50,1, colors.lightGray)
  2117.     term.setCursorPos (w-1,1)
  2118.     write  "<"
  2119.     paintutils.drawPixel (49,1, colors.lightGray)
  2120.     term.setCursorPos (w-2,1)
  2121.     write  "_"
  2122.  
  2123.              while true do
  2124.         local event, button, x, y = os.pullEvent("mouse_click")
  2125.         xy = x..","..y
  2126.        
  2127.         if x == w and y == 1 then
  2128.         login = 0
  2129.             ukonceni ()
  2130.         elseif x == w-1 and y == 1 then
  2131.         login = 0
  2132.             account ()
  2133.         elseif x == w-2 and y == 1 then
  2134.         login = 1
  2135.             minimalizace ()
  2136.         else
  2137.         login = 1
  2138.         password ()
  2139.             end
  2140.             end
  2141. end
  2142. end
  2143. end
  2144.  
  2145. function network ()
  2146.     funkce = "network"
  2147.     if not fs.exists ("/C/system/.core/network.nfp") then
  2148.     shell.run("pastebin get 8zkYBLPE /C/system/.core/network.nfp")
  2149.     network()
  2150.     end
  2151.     local image = paintutils.loadImage("/C/system/.core/network.nfp")
  2152.     paintutils.drawImage(image, 17, 1)
  2153.     local myWindow = window.create(term.current(),1,1,16,h)
  2154.     myWindow.setBackgroundColor(colors.gray)
  2155.     myWindow.clear()
  2156.     local myWindow = window.create(term.current(),1,1,15,h)
  2157.     myWindow.setBackgroundColor(nastaveni.barva)
  2158.     myWindow.clear()
  2159.     term.setBackgroundColor (nastaveni.barva)
  2160.     term.setTextColor(colors.lime)
  2161.     term.setCursorPos(2,3)
  2162.     write  "< Network"
  2163.     term.setTextColor(text.barva)
  2164.     term.setCursorPos(2,5)
  2165.     write  "Modem"
  2166.     term.setCursorPos(2,7)
  2167.     write  "Label"
  2168.    
  2169.       while true do
  2170.     local event, button, x, y = os.pullEvent("mouse_click")
  2171.     xy = x..","..y
  2172.      
  2173.     if x >= 2 and x <= 16 and y == 3 and button == 1 then
  2174.     setupmenu ()
  2175.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  2176.     modemS ()
  2177.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  2178.     label ()
  2179.     else
  2180.     paintutils.drawLine(1, 1, w, 1, colors.black)
  2181.     paintutils.drawPixel (w,1, colors.red)
  2182.     term.setCursorPos (w,1)
  2183.     write  "*"
  2184.     paintutils.drawPixel (50,1, colors.lightGray)
  2185.     term.setCursorPos (w-1,1)
  2186.     write  "<"
  2187.    
  2188.         if fs.exists ("/C/system/RAM/setting/"..user.."/setdata")then
  2189.          local data = fs.open ("/C/system/RAM/setting/"..user.."/setdata", "r")
  2190.             funkce = data.readLine ()
  2191.             data.close ()
  2192.             end
  2193.                        
  2194.             if funkce == "network" then
  2195.                 modemS ()
  2196.             elseif funkce == "network" then
  2197.                 label ()
  2198.             end
  2199.            
  2200.         network ()
  2201.        
  2202.        
  2203.              while true do
  2204.         local event, button, x, y = os.pullEvent("mouse_click")
  2205.         xy = x..","..y
  2206.        
  2207.         if x == w and y == 1 then
  2208.             ukonceni ()
  2209.         elseif x == w-1 and y == 1 then
  2210.             setupmenu ()
  2211.         else
  2212.         network ()
  2213.             end
  2214.             end
  2215.         end
  2216.         end
  2217.     end
  2218.  
  2219. function language ()
  2220.     funkce = "language"
  2221.         local myWindow = window.create(term.current(),16,1,37,h)
  2222.     myWindow.setBackgroundColor(colors.white)
  2223.     myWindow.clear()
  2224.         local myWindow = window.create(term.current(),1,1,16,h)
  2225.     myWindow.setBackgroundColor(colors.gray)
  2226.     local myWindow = window.create(term.current(),1,1,15,h)
  2227.     myWindow.setBackgroundColor(nastaveni.barva)
  2228.     myWindow.clear()
  2229.     term.setBackgroundColor (nastaveni.barva)
  2230.     term.setTextColor(colors.lime)
  2231.     term.setCursorPos(2,3)
  2232.     write  "< Language"
  2233.     term.setTextColor(text.barva)
  2234.     term.setCursorPos(2,5)
  2235.     write  "Account"
  2236.     term.setCursorPos(2,7)
  2237.     write  "Primary"
  2238.    
  2239.       while true do
  2240.     local event, button, x, y = os.pullEvent("mouse_click")
  2241.     xy = x..","..y
  2242.      
  2243.     if x >= 2 and x <= 16 and y == 3 and button == 1 then
  2244.     setupmenu ()
  2245.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  2246.     fs.delete ("/C/system/RAM/setting/"..user.."/jazyk1")
  2247.     shell.run ("pastebin get uVRBmFvy /C/system/RAM/"..user.."/jazyk1")
  2248.     shell.run ("/C/system/RAM/setting/"..user.."/jazyk1")
  2249.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  2250.     fs.delete ("/C/system/RAM/setting/"..user.."/jazyk2")
  2251.     shell.run ("pastebin get uVRBmFvy /C/system/RAM/"..user.."/jazyk2")
  2252.     shell.run ("/C/system/RAM/setting/"..user.."/jazyk2")
  2253.     else
  2254.     paintutils.drawLine(1, 1, w, 1, colors.black)
  2255.     paintutils.drawPixel (w,1, colors.red)
  2256.     term.setCursorPos (w,1)
  2257.     write  "*"
  2258.     paintutils.drawPixel (50,1, colors.lightGray)
  2259.     term.setCursorPos (w-1,1)
  2260.     write  "<"
  2261.     paintutils.drawPixel (49,1, colors.lightGray)
  2262.     term.setCursorPos (w-2,1)
  2263.     write  "_"
  2264.  
  2265.              while true do
  2266.         local event, button, x, y = os.pullEvent("mouse_click")
  2267.         xy = x..","..y
  2268.        
  2269.         if x == w and y == 1 then
  2270.             ukonceni ()
  2271.         elseif x == w-1 and y == 1 then
  2272.             setupmenu ()
  2273.         elseif x == w-2 and y == 1 then
  2274.             minimalizace ()
  2275.         else
  2276.         language ()
  2277.             end
  2278.             end
  2279. end
  2280. end
  2281.     end
  2282.  
  2283. function updates ()
  2284. funkce = "updates"
  2285.         local myWindow = window.create(term.current(),16,1,37,h)
  2286.     myWindow.setBackgroundColor(colors.white)
  2287.     myWindow.clear()
  2288.         local myWindow = window.create(term.current(),1,1,16,h)
  2289.     myWindow.setBackgroundColor(colors.gray)
  2290.     myWindow.clear()
  2291.     local myWindow = window.create(term.current(),1,1,15,h)
  2292.     myWindow.setBackgroundColor(nastaveni.barva)
  2293.     myWindow.clear()
  2294.     term.setBackgroundColor (nastaveni.barva)
  2295.     term.setTextColor(colors.lime)
  2296.     term.setCursorPos(2,3)
  2297.     write  "< System"
  2298.     term.setTextColor(text.barva)
  2299.     term.setCursorPos(2,6)
  2300.     write  "Update's"
  2301.     term.setCursorPos(2,8)
  2302.     write  "Monitor's"
  2303.     term.setCursorPos(2,10)
  2304.     write  "Recovery"
  2305.        
  2306.       while true do
  2307.     local event, button, x, y = os.pullEvent("mouse_click")
  2308.     xy = x..","..y
  2309.      
  2310.     if x >= 2 and x <= 16 and y >= 3 and y <= 4 and button == 1 then
  2311.     setupmenu ()
  2312.     elseif x >= 2 and x <= 16 and y == 6 and button == 1 then
  2313.     update ()
  2314.     elseif x >= 2 and x <= 16 and y == 8 and button == 1 then
  2315.     display()
  2316.     elseif x >= 2 and x <= 16 and y == 10 and button == 1 then
  2317.     recovery()
  2318.     else
  2319.         paintutils.drawLine(1, 1, w, 1, colors.black)
  2320.         paintutils.drawPixel (w,1, colors.red)
  2321.         term.setCursorPos (w,1)
  2322.         write  "*"
  2323.         paintutils.drawPixel (50,1, colors.lightGray)
  2324.         term.setCursorPos (w-1,1)
  2325.         write  "<"
  2326.         paintutils.drawPixel (49,1, colors.lightGray)
  2327.         term.setCursorPos (w-2,1)
  2328.         write  "_"
  2329.              while true do
  2330.         local event, button, x, y = os.pullEvent("mouse_click")
  2331.         xy = x..","..y
  2332.        
  2333.         if x == w and y == 1 then
  2334.             ukonceni ()
  2335.         elseif x == w-1 and y == 1 then
  2336.             setupmenu ()
  2337.         elseif x == w-2 and y == 1 then
  2338.             minimalizace ()
  2339.         else
  2340.         updates ()
  2341.             end
  2342.             end
  2343. end
  2344. end
  2345.     end
  2346.    
  2347. function update ()
  2348. funkce = "updates"
  2349.     term.setBackgroundColor(nastaveni.barva)
  2350.        term.setCursorPos(1,1)
  2351.        write  "               "
  2352.        paintutils.drawPixel(16, 1, colors.gray)
  2353.        if not fs.exists ("/C/system/.core/update") then
  2354.            data = fs.open ("/C/system/.core/update", "w")
  2355.            data.writeLine ("0")
  2356.            data.close ()
  2357.     local myWindow = window.create(term.current(),17,1,w-16,h)
  2358.     myWindow.setBackgroundColor(colors.white)
  2359.     myWindow.clear()
  2360.     term.setTextColor(colors.black)
  2361.     myWindow.setCursorPos (2,5)
  2362.     write  "Update"
  2363.     while true do
  2364.         local event, button, x, y = os.pullEvent("mouse_click")
  2365.         xy = x..","..y
  2366.  
  2367.     if x >= 2 and x <= 16 and y == 3 and button == 1 then
  2368.     setupmenu ()
  2369.     elseif x >= 2 and x <= 16 and y == 6 and button == 1 then
  2370.     update ()
  2371.   elseif x >= 2 and x <= 16 and y == 8 and button == 1 then
  2372.     else
  2373.     paintutils.drawLine(1, 1, w, 1, colors.black)
  2374.     paintutils.drawPixel (w,1, colors.red)
  2375.     term.setTextColor(colors.white)
  2376.     term.setCursorPos (w,1)
  2377.     write  "*"
  2378.     paintutils.drawPixel (50,1, colors.lightGray)
  2379.     term.setCursorPos (w-1,1)
  2380.     write  "<"
  2381.     paintutils.drawPixel (49,1, colors.lightGray)
  2382.     term.setCursorPos (w-2,1)
  2383.     write  "_"
  2384.  
  2385.              while true do
  2386.         local event, button, x, y = os.pullEvent("mouse_click")
  2387.         xy = x..","..y
  2388.        
  2389.         if x == w and y == 1 then
  2390.             ukonceni ()
  2391.         elseif x == w-1 and y == 1 then
  2392.             updates ()
  2393.         elseif x == w-2 and y == 1 then
  2394.             minimalizace ()
  2395.         else
  2396.         update ()
  2397.             end
  2398.             end
  2399. end
  2400. end
  2401. end
  2402. end
  2403.  
  2404. function display ()
  2405. funkce = "display"
  2406.         local myWindow = window.create(term.current(),1,1,15,h)
  2407.     myWindow.setBackgroundColor(nastaveni.barva)
  2408.     myWindow.clear()
  2409.     term.setBackgroundColor (nastaveni.barva)
  2410.     term.setTextColor(colors.lime)
  2411.     term.setCursorPos(2,3)
  2412.     write  "< System"
  2413.     term.setTextColor(text.barva)
  2414.     term.setCursorPos(2,6)
  2415.     write  "Update's"
  2416.     term.setCursorPos(2,8)
  2417.     write  "Monitor's"
  2418.     term.setCursorPos(2,10)
  2419.     write  "Recovery"
  2420.    
  2421.     local myWindow = window.create(term.current(),17,1,w-16,h)
  2422.     myWindow.setBackgroundColor(colors.white)
  2423.     myWindow.clear()
  2424.     term.setBackgroundColor(nastaveni.barva)
  2425.     term.setCursorPos(1,1)
  2426.     write  "               "
  2427.     paintutils.drawPixel(16, 1, colors.gray)
  2428.     term.setBackgroundColor(colors.white)
  2429.     term.setCursorPos(17,1)
  2430.     write  "                                   "
  2431.    
  2432.    
  2433.     myWindow.setTextColor(colors.black)
  2434.     myWindow.setCursorPos(2, 3)
  2435.     write  "Connecting the monitor"
  2436.     myWindow.setCursorPos(2, 14)
  2437.     write"No monitor:"
  2438.     myWindow.setCursorPos(2, 5)
  2439.     write  "Where is the monitor located?"
  2440.     myWindow.setCursorPos(7, 7)
  2441.     term.setBackgroundColor(colors.lightGray)
  2442.     term.setTextColor(colors.white)
  2443.     write  " Left    Right   Back "
  2444.     myWindow.setCursorPos(7, 9)
  2445.     write " Top    Bottom "
  2446.     paintutils.drawPixel (29,7, colors.white)
  2447.     paintutils.drawPixel (29,9, colors.white)
  2448.     paintutils.drawPixel (38,7, colors.white)
  2449.    
  2450.     myWindow.setCursorPos(2, 12)
  2451.     myWindow.setTextColor(colors.black)
  2452.     write"User define: "
  2453.     term.setBackgroundColor(colors.lightGray)
  2454.     write"            "
  2455.     term.setTextColor(colors.white)
  2456.     myWindow.setCursorPos(15, 14)
  2457.     write " Disconect "
  2458.     term.setBackgroundColor(colors.gray)
  2459.    
  2460.  
  2461.    
  2462.    
  2463.       while true do
  2464.     local event, button, x, y = os.pullEvent("mouse_click")
  2465.     xy = x..","..y
  2466.      
  2467.     if x >= 2 and x <= 16 and y >= 3 and y <= 4 and button == 1 then
  2468.     setupmenu ()
  2469.     elseif x >= 2 and x <= 16 and y == 6 and button == 1 then
  2470.     update ()
  2471.     elseif x >= 2 and x <= 16 and y == 8 and button == 1 then
  2472.     display()
  2473.     elseif x >= 2 and x <= 16 and y == 10 and button == 1 then
  2474.     recovery()
  2475.     elseif x >= 23 and x <= 28 and y == 7 and button == 1 then
  2476.     term.setCursorPos(23,7)
  2477.     write" Left "
  2478.     monitor = "left"
  2479.     setmonitor()
  2480.     elseif x >= 30 and x <= 37 and y == 7 and button == 1 then
  2481.     term.setCursorPos(30,7)
  2482.     write"  Right "
  2483.     monitor = "right"
  2484.     setmonitor()
  2485.     elseif x >= 31 and x <= 43 and y == 12 and button == 1 then
  2486.     term.setCursorPos(31,12)
  2487.     write"            "
  2488.     term.setCursorPos(32,12)
  2489.     monitor = read()
  2490.     setmonitor()
  2491.     elseif x >= 31 and x <= 41 and y == 14 and button == 1 then
  2492.     local data = fs.open ("/C/system/RAM/displayreboot", "w")
  2493.     data.close ()
  2494.     term.setCursorPos(31,14)
  2495.     write" Disconect "
  2496.     if fs.exists("/C/system/.core/display") then
  2497.     fs.delete("/C/system/.core/display")
  2498.     end
  2499.     term.setBackgroundColor(colors.black)
  2500.     term.clear()
  2501.     os.reboot()
  2502.    
  2503.     else
  2504.     paintutils.drawLine(1, 1, w, 1, colors.black)
  2505.     paintutils.drawPixel (w,1, colors.red)
  2506.     term.setCursorPos (w,1)
  2507.     write  "*"
  2508.     paintutils.drawPixel (50,1, colors.lightGray)
  2509.     term.setCursorPos (w-1,1)
  2510.     write  "<"
  2511.     paintutils.drawPixel (49,1, colors.lightGray)
  2512.         term.setCursorPos (w-2,1)
  2513.         write  "_"
  2514.  
  2515.              while true do
  2516.         local event, button, x, y = os.pullEvent("mouse_click")
  2517.         xy = x..","..y
  2518.        
  2519.         if x == w and y == 1 then
  2520.             ukonceni ()
  2521.         elseif x == w-1 and y == 1 then
  2522.             setupmenu ()
  2523.         elseif x == w-2 and y == 1 then
  2524.             minimalizace ()
  2525.         else
  2526.         display ()
  2527.             end
  2528.             end
  2529. end
  2530. end
  2531. end
  2532.  
  2533. function recovery()
  2534. funkce = "recovery"
  2535.         local myWindow = window.create(term.current(),1,1,15,h)
  2536.     myWindow.setBackgroundColor(nastaveni.barva)
  2537.     myWindow.clear()
  2538.     term.setBackgroundColor (nastaveni.barva)
  2539.     term.setTextColor(colors.lime)
  2540.     term.setCursorPos(2,3)
  2541.     write  "< System"
  2542.     term.setTextColor(text.barva)
  2543.     term.setCursorPos(2,6)
  2544.     write  "Update's"
  2545.     term.setCursorPos(2,8)
  2546.     write  "Monitor's"
  2547.     term.setCursorPos(2,10)
  2548.     write  "Recovery"
  2549.    
  2550.     local myWindow = window.create(term.current(),17,1,w-16,h)
  2551.     myWindow.setBackgroundColor(colors.white)
  2552.     myWindow.clear()
  2553.     term.setBackgroundColor(nastaveni.barva)
  2554.     term.setCursorPos(1,1)
  2555.     write  "               "
  2556.     paintutils.drawPixel(16, 1, colors.gray)
  2557.     term.setBackgroundColor(colors.white)
  2558.     term.setCursorPos(17,1)
  2559.     write  "                                   "
  2560.    
  2561.     myWindow.setTextColor(colors.black)
  2562.     myWindow.setCursorPos(2, 3)
  2563.     term.write "Select what to recover:"
  2564.    
  2565.     term.setBackgroundColor(colors.lightGray)
  2566.     term.setTextColor(colors.white)
  2567.     myWindow.setCursorPos(2, 5)
  2568.     term.write " - Users and Settings "
  2569.    
  2570.    
  2571.       while true do
  2572.     local event, button, x, y = os.pullEvent("mouse_click")
  2573.     xy = x..","..y
  2574.      
  2575.     if x >= 2 and x <= 16 and y >= 3 and y <= 4 and button == 1 then
  2576.     setupmenu ()
  2577.     elseif x >= 2 and x <= 16 and y == 6 and button == 1 then
  2578.     update ()
  2579.     elseif x >= 2 and x <= 16 and y == 8 and button == 1 then
  2580.     display()
  2581.     elseif x >= 2 and x <= 16 and y == 10 and button == 1 then
  2582.     recovery()
  2583.     elseif x >= 18 and x <= 39 and y == 5 and button == 1 then
  2584.     term.setBackgroundColor(colors.lightBlue)
  2585.     myWindow.setCursorPos(2, 5)
  2586.     term.write " - Users and Settings "
  2587.     sleep(0.1)
  2588.     fs.delete("/Users")
  2589.     fs.delete("/C/system/Users")
  2590.     if fs.exists ("/C/system/.core/defuser") then
  2591.         fs.delete("/C/system/.core/defuser")
  2592.     end
  2593.     local f=fs.open("/C/system/ducet","w")
  2594.     f.close()
  2595.     restartovat()
  2596.         else
  2597.     myWindow.setTextColor(colors.white)
  2598.     paintutils.drawLine(1, 1, w, 1, colors.black)
  2599.     paintutils.drawPixel (w,1, colors.red)
  2600.     term.setCursorPos (w,1)
  2601.     write  "*"
  2602.     paintutils.drawPixel (50,1, colors.lightGray)
  2603.     term.setCursorPos (w-1,1)
  2604.     write  "<"
  2605.     paintutils.drawPixel (49,1, colors.lightGray)
  2606.         term.setCursorPos (w-2,1)
  2607.         write  "_"
  2608.  
  2609.              while true do
  2610.         local event, button, x, y = os.pullEvent("mouse_click")
  2611.         xy = x..","..y
  2612.        
  2613.         if x == w and y == 1 then
  2614.             ukonceni ()
  2615.         elseif x == w-1 and y == 1 then
  2616.             setupmenu ()
  2617.         elseif x == w-2 and y == 1 then
  2618.             minimalizace ()
  2619.         else
  2620.         recovery ()
  2621.             end
  2622.             end
  2623. end
  2624. end
  2625. end
  2626.  
  2627. function setmonitor()
  2628.  
  2629.     if fs.exists("/C/system/.core/display") then
  2630.     fs.delete("/C/system/.core/display")   
  2631.     end
  2632.     local f=fs.open("/C/system/.core/display","w")
  2633.     f.writeLine(monitor)
  2634.     f.close()
  2635.     sleep(0.1)
  2636.     local data = fs.open ("/C/system/RAM/displayreboot", "w")
  2637.     data.close ()
  2638.     term.setBackgroundColor(colors.black)
  2639.     term.clear()
  2640.     os.reboot()
  2641. end
  2642.  
  2643. function startup ()
  2644. funkce = "startup"
  2645.    
  2646.     local function zapsat()
  2647.         local f=fs.open("/C/system/Users/"..user.."/startupProgram","w")
  2648.         f.writeLine (cestaProgramu)
  2649.         f.close()
  2650.         startup()
  2651.     end
  2652.    
  2653.     local myWindow = window.create(term.current(),1,1,16,h)
  2654.     myWindow.setBackgroundColor(colors.gray)
  2655.     myWindow.clear()
  2656.     local myWindow = window.create(term.current(),1,1,15,h)
  2657.     myWindow.setBackgroundColor(nastaveni.barva)
  2658.     myWindow.clear()
  2659.     term.setBackgroundColor (nastaveni.barva)
  2660.     term.setTextColor(colors.lime)
  2661.     term.setCursorPos(2,3)
  2662.     write  "< Startup"
  2663.     term.setTextColor(text.barva)
  2664.     term.setCursorPos(2,5)
  2665.     write  "Menu"  
  2666.     term.setCursorPos(2,7)
  2667.     write  "Startup"   
  2668.     local myWindow = window.create(term.current(),17,1,w-16,h)
  2669.     myWindow.setBackgroundColor(colors.white)
  2670.     myWindow.clear()
  2671.     term.setTextColor(colors.black)
  2672.     term.setBackgroundColor(colors.white)
  2673.     myWindow.setCursorPos(3,5)
  2674.     write("Start the program after startup")
  2675.     myWindow.setCursorPos(3,7)
  2676.     write("Run:")
  2677.    
  2678.     term.setBackgroundColor(colors.lightGray)
  2679.     term.setTextColor(colors.white)
  2680.     term.setCursorPos(37,7)
  2681.     write("      ")
  2682.  
  2683.     term.setTextColor(colors.white)
  2684.     term.setBackgroundColor(colors.gray)
  2685.     term.setCursorPos(43, 16)
  2686.     write " Restart "
  2687.     term.setCursorPos(43, 18)
  2688.     write " Log Out "
  2689.  
  2690.     if fs.exists("/C/system/Users/"..user.."/startupProgram") then
  2691.    
  2692.         if fs.exists("/C/system/Users/"..user.."/startupProgram") then
  2693.         local f=fs.open("/C/system/Users/"..user.."/startupProgram","r")
  2694.         afterstart=f.readLine()
  2695.         f.close()
  2696.         else
  2697.         afterstart= ""
  2698.         end
  2699.        
  2700.         paintutils.drawPixel (37, 7, colors.lime)
  2701.         paintutils.drawPixel (42, 7, colors.lightGray)
  2702.         spustitProgram = "ano"
  2703.         term.setBackgroundColor(colors.lightGray)
  2704.         term.setTextColor(colors.white)
  2705.         myWindow.setCursorPos(3,11)
  2706.         write("                               ")
  2707.         myWindow.setCursorPos(4,11)
  2708.         write(afterstart)
  2709.         term.setBackgroundColor(colors.white)
  2710.         term.setTextColor(colors.black)
  2711.         myWindow.setCursorPos(3,10)
  2712.         write("Path:") 
  2713.     else
  2714.         paintutils.drawPixel (42, 7, colors.red)
  2715.         paintutils.drawPixel (37, 7, colors.lightGray)
  2716.         spustitProgram = "ne"
  2717.     end
  2718.    
  2719.       while true do
  2720.     local event, button, x, y = os.pullEvent("mouse_click")
  2721.     xy = x..","..y
  2722.      
  2723.     if x >= 2 and x <= 16 and y == 3 and button == 1 then
  2724.     setupmenu ()
  2725.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  2726.     setprograms ()
  2727.     elseif x >= 43 and x <= 51 and y == 16 and button == 1 then
  2728.     restartovat()
  2729.     elseif x >= 43 and x <= 51 and y == 18 and button == 1 then
  2730.     logout()
  2731.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  2732.     startup ()
  2733.     elseif x >= 19 and x <= 49 and y == 11 and spustitProgram == "ano" and button == 1 then
  2734.         term.setBackgroundColor(colors.gray)
  2735.         term.setTextColor(colors.white)
  2736.         myWindow.setCursorPos(3,11)
  2737.         write("                               ")
  2738.         myWindow.setCursorPos(4,11)
  2739.         cestaProgramu = read()
  2740.        
  2741.         if fs.exists (cestaProgramu) then
  2742.             zapsat()
  2743.         else
  2744.             cestaProgramu1 = cestaProgramu
  2745.             cestaProgramu = ("/C/Programs/"..cestaProgramu)
  2746.                 if fs.exists (cestaProgramu) then
  2747.                 zapsat()
  2748.                 else
  2749.                 cestaProgramu = ("/C/Programs/pepeksoft/"..cestaProgramu1)
  2750.                 end
  2751.                
  2752.                 if fs.exists (cestaProgramu) then
  2753.                 zapsat()
  2754.                 else
  2755.                 term.setBackgroundColor(colors.white)
  2756.                 term.setTextColor(colors.red)
  2757.                 myWindow.setCursorPos(3,12)
  2758.                 write("The program could not be found.")
  2759.                 cestaProgramu = ""
  2760.                 sleep(0.5)
  2761.                 end
  2762.         end
  2763.         startup()
  2764.     elseif x >= 37 and x <= 42 and y == 7 and button == 1 then
  2765.         if fs.exists("/C/system/Users/"..user.."/startupProgram") then
  2766.         fs.delete("/C/system/Users/"..user.."/startupProgram")
  2767.         else
  2768.             local f=fs.open("/C/system/Users/"..user.."/startupProgram","w")
  2769.             f.close()
  2770.         end
  2771.         startup()
  2772.     else
  2773.     term.setTextColor(text.barva)
  2774.     paintutils.drawLine(1, 1, w, 1, colors.black)
  2775.     paintutils.drawPixel (w,1, colors.red)
  2776.     term.setCursorPos (w,1)
  2777.     write  "*"
  2778.     paintutils.drawPixel (50,1, colors.lightGray)
  2779.     term.setCursorPos (w-1,1)
  2780.     write  "<"
  2781.     paintutils.drawPixel (49,1, colors.lightGray)
  2782.         term.setCursorPos (w-2,1)
  2783.         write  "_"
  2784.  
  2785.              while true do
  2786.         local event, button, x, y = os.pullEvent("mouse_click")
  2787.         xy = x..","..y
  2788.        
  2789.         if x == w and y == 1 then
  2790.             ukonceni ()
  2791.         elseif x == w-1 and y == 1 then
  2792.             setupmenu ()
  2793.         elseif x == w-2 and y == 1 then
  2794.             minimalizace ()
  2795.         else
  2796.         startup ()
  2797.             end
  2798.             end
  2799. end
  2800. end
  2801. end
  2802.  
  2803. function setprograms ()
  2804. funkce = "setprograms"
  2805.     function apply ()
  2806.         data = fs.open ("/C/system/Users/"..user.."/lsprogram", "w")
  2807.         data.writeLine(nmenu1)
  2808.         data.writeLine(npath1)
  2809.         data.writeLine(nmenu2)
  2810.         data.writeLine(npath2)
  2811.         data.writeLine(nmenu3)
  2812.         data.writeLine(npath3)
  2813.         data.writeLine(nmenu4)
  2814.         data.writeLine(npath4)
  2815.         data.writeLine(nmenu5)
  2816.         data.writeLine(npath5)
  2817.         data.writeLine(nmenu6)
  2818.         data.writeLine(npath6)
  2819.         data.writeLine(nmenu7)
  2820.         data.writeLine(npath7)
  2821.         data.close ()
  2822.        
  2823.         if ok == "0" then
  2824.         term.setCursorPos (26, 13)
  2825.         term.setBackgroundColor(colors.white)
  2826.         term.setTextColor(colors.lime)
  2827.         write  "Successfull"
  2828.         term.setTextColor(colors.white)
  2829.         term.setBackgroundColor(colors.lightGray)
  2830.         term.setCursorPos (31,14)
  2831.         write "OK"
  2832.         else
  2833.         term.setCursorPos (26, 17)
  2834.         term.setBackgroundColor(colors.white)
  2835.         term.setTextColor(colors.lime)
  2836.         write  "Successfull"
  2837.         ok = "0"
  2838.         end
  2839.         sleep (0.5)
  2840.         setprograms ()
  2841.         end
  2842.  
  2843.         local data = fs.open ("/C/system/Users/"..user.."/lsprogram", "r")
  2844.         menu1 = data.readLine ()
  2845.         path1 = data.readLine ()
  2846.         menu2 = data.readLine ()
  2847.         path2 = data.readLine ()
  2848.         menu3 = data.readLine ()
  2849.         path3 = data.readLine ()
  2850.         menu4 = data.readLine ()
  2851.         path4 = data.readLine ()
  2852.         menu5 = data.readLine ()
  2853.         path5 = data.readLine ()
  2854.         menu6 = data.readLine ()
  2855.         path6 = data.readLine ()
  2856.         menu7 = data.readLine ()
  2857.         path7 = data.readLine ()
  2858.         data.close()
  2859.         nmenu1 = menu1
  2860.         npath1 = path1
  2861.         nmenu2 = menu2
  2862.         npath2 = path2
  2863.         nmenu3 = menu3
  2864.         npath3 = path3
  2865.         nmenu4 = menu4
  2866.         npath4 = path4
  2867.         nmenu5 = menu5
  2868.         npath5 = path5
  2869.         nmenu6 = menu6
  2870.         npath6 = path6
  2871.         nmenu7 = menu7
  2872.         npath7 = path7
  2873.  
  2874.    
  2875.     term.setBackgroundColor(nastaveni.barva)
  2876.        term.setCursorPos(1,1)
  2877.        write  "               "
  2878.        paintutils.drawPixel(16, 1, colors.gray)
  2879.     local myWindow = window.create(term.current(),17,1,w-16,h)
  2880.     myWindow.setBackgroundColor(colors.white)
  2881.     myWindow.clear()
  2882.     term.setTextColor(colors.black)
  2883.     term.setBackgroundColor(colors.white)
  2884.     myWindow.setCursorPos (4,3)
  2885.     write  "1.position"
  2886.     myWindow.setCursorPos (4,5)
  2887.     write  "2.position"
  2888.     myWindow.setCursorPos (4,7)
  2889.     write  "3.position"
  2890.     myWindow.setCursorPos (4,9)
  2891.     write  "4.position"
  2892.     myWindow.setCursorPos (4,11)
  2893.     write  "5.position"
  2894.     myWindow.setCursorPos (4,13)
  2895.     write  "6.position"
  2896.     myWindow.setCursorPos (4,15)
  2897.     write  "7.position"
  2898.     term.setTextColor(colors.white)
  2899.     term.setBackgroundColor(colors.lightGray)
  2900.     myWindow.setCursorPos (16,3)
  2901.     write "              "
  2902.     myWindow.setCursorPos (16,5)
  2903.     write "              "
  2904.     myWindow.setCursorPos (16,7)
  2905.     write "              "
  2906.     myWindow.setCursorPos (16,9)
  2907.     write "              "
  2908.     myWindow.setCursorPos (16,11)
  2909.     write "              "
  2910.     myWindow.setCursorPos (16,13)
  2911.     write "              "
  2912.     myWindow.setCursorPos (16,15)
  2913.     write "              "
  2914.     myWindow.setCursorPos (17,3)
  2915.     write (nmenu1)
  2916.     myWindow.setCursorPos (17,5)
  2917.     write (nmenu2)
  2918.     myWindow.setCursorPos (17,7)
  2919.     write (nmenu3)
  2920.     myWindow.setCursorPos (17,9)
  2921.     write (nmenu4)
  2922.     myWindow.setCursorPos (17,11)
  2923.     write (nmenu5)
  2924.     myWindow.setCursorPos (17,13)
  2925.     write (nmenu6)
  2926.     myWindow.setCursorPos (17,15)
  2927.     write (nmenu7)
  2928.     term.setBackgroundColor(colors.red)
  2929.     term.setTextColor(colors.white)
  2930.     myWindow.setCursorPos (30,3)
  2931.     write  "*"
  2932.     myWindow.setCursorPos (30,5)
  2933.     write  "*"
  2934.     myWindow.setCursorPos (30,7)
  2935.     write  "*"
  2936.     myWindow.setCursorPos (30,9)
  2937.     write  "*"
  2938.     myWindow.setCursorPos (30,11)
  2939.     write  "*"
  2940.     myWindow.setCursorPos (30,13)
  2941.     write  "*"
  2942.     myWindow.setCursorPos (30,15)
  2943.     write  "*"
  2944.  
  2945.     local myWindow = window.create(term.current(),1,1,16,h)
  2946.     myWindow.setBackgroundColor(colors.gray)
  2947.     myWindow.clear()
  2948.     local myWindow = window.create(term.current(),1,1,15,h)
  2949.     myWindow.setBackgroundColor(nastaveni.barva)
  2950.     myWindow.clear()
  2951.     term.setBackgroundColor (nastaveni.barva)
  2952.     term.setTextColor(colors.lime)
  2953.     term.setCursorPos(2,3)
  2954.     write  "< Programs"
  2955.     term.setTextColor(text.barva)
  2956.     term.setCursorPos(2,5)
  2957.     write  "Menu"
  2958.     term.setCursorPos(2,7)
  2959.     write  "Startup"   
  2960.    
  2961.     while true do
  2962.         local event, button, x, y = os.pullEvent("mouse_click")
  2963.         xy = x..","..y
  2964.  
  2965.     if x >= 2 and x <= 16 and y == 3 and button == 1 then
  2966.     setupmenu ()
  2967.     elseif x >= 2 and x <= 16 and y == 5 and button == 1 then
  2968.     setprograms ()
  2969.     elseif x >= 2 and x <= 16 and y == 7 and button == 1 then
  2970.     startup ()
  2971.     elseif x == 46 and y == 3 and button == 1 then
  2972.     nmenu1 = ""
  2973.     npath1 = ""
  2974.     ok = "1"
  2975.     apply ()
  2976.     elseif x == 46 and y == 5 and button == 1 then
  2977.     nmenu2 = ""
  2978.     npath2 = ""
  2979.     ok = "1"
  2980.     apply ()
  2981.     elseif x == 46 and y == 7 and button == 1 then
  2982.     nmenu3 = ""
  2983.     npath3 = ""
  2984.     ok = "1"
  2985.     apply ()
  2986.     elseif x == 46 and y == 9 and button == 1 then
  2987.     nmenu4 = ""
  2988.     npath4 = ""
  2989.     ok = "1"
  2990.     apply ()
  2991.     elseif x == 46 and y == 11 and button == 1 then
  2992.     nmenu5 = ""
  2993.     npath5 = ""
  2994.     ok = "1"
  2995.     apply ()
  2996.     elseif x == 46 and y == 13 and button == 1 then
  2997.     nmenu6 = ""
  2998.     npath6 = ""
  2999.     ok = "1"
  3000.     apply ()
  3001.     elseif x == 46 and y == 15 and button == 1 then
  3002.     nmenu7 = ""
  3003.     npath7 = ""
  3004.     ok = "1"
  3005.     apply ()
  3006.     elseif x >= 32 and x <= 45 and y == 3 and button == 1 then
  3007.     term.setBackgroundColor(colors.gray)
  3008.     term.setTextColor(colors.white)
  3009.     term.setCursorPos (32,3)
  3010.     write "              "
  3011.     term.setCursorPos (33,3)
  3012.     write (nmenu1)
  3013.     sleep(0.1)
  3014.     local myWindow = window.create(term.current(),22,7,22,10)
  3015.     myWindow.setBackgroundColor(colors.gray)
  3016.     myWindow.clear()
  3017.     local myWindow = window.create(term.current(),21,6,22,10)
  3018.     myWindow.setBackgroundColor(colors.lime)
  3019.     myWindow.clear()
  3020.     local myWindow = window.create(term.current(),22,7,20,8)
  3021.     myWindow.setBackgroundColor(colors.white)
  3022.     myWindow.clear()
  3023.     paintutils.drawPixel (42,6, colors.red)
  3024.     term.setCursorPos(42,6)
  3025.     write  "*"
  3026.     term.setBackgroundColor(colors.white)
  3027.     term.setTextColor(colors.black)
  3028.     myWindow.setCursorPos (6,1)
  3029.     write "1. Posion"
  3030.     myWindow.setCursorPos (2,3)
  3031.     write "Name"
  3032.     myWindow.setCursorPos (2,5)
  3033.     write "Path:"
  3034.     myWindow.setCursorPos (10,8)
  3035.     write "OK"
  3036.     term.setTextColor(colors.white)
  3037.     term.setBackgroundColor(colors.lightGray)
  3038.     myWindow.setCursorPos (2,4)
  3039.     write "            "
  3040.     myWindow.setCursorPos (2,4)
  3041.     write (menu1)
  3042.     myWindow.setCursorPos (2,6)
  3043.     write "                  "
  3044.     myWindow.setCursorPos (2,6)
  3045.     write (path1)
  3046.     term.setBackgroundColor(colors.gray)
  3047.     while true do
  3048.         local event, button, x, y = os.pullEvent("mouse_click")
  3049.         xy = x..","..y
  3050.  
  3051.             if x >= 23 and x <= 40 and y == 10 and button == 1 then
  3052.             myWindow.setCursorPos (2,4)
  3053.             write "            "
  3054.             myWindow.setCursorPos (2,4)
  3055.             nmenu1 = read ()
  3056.             elseif x >= 23 and x <= 40 and y == 12 and button == 1 then
  3057.             myWindow.setCursorPos (2,6)
  3058.             write "                  "
  3059.             myWindow.setCursorPos (2,6)
  3060.             npath1 = read ()
  3061.             elseif x == 42 and y == 6 and button == 1 then
  3062.            
  3063.             setprograms ()
  3064.             elseif x >= 30 and x <= 32 and y == 14 and button == 1 then
  3065.            
  3066.             apply ()
  3067.             end
  3068.             end
  3069.     elseif x >= 32 and x <= 45 and y == 5 and button == 1 then
  3070.     term.setBackgroundColor(colors.gray)
  3071.     term.setTextColor(colors.white)
  3072.     term.setCursorPos (32,5)
  3073.     write "              "
  3074.     term.setCursorPos (33,5)
  3075.     write (nmenu2)
  3076.     sleep(0.1)
  3077.     local myWindow = window.create(term.current(),22,7,22,10)
  3078.     myWindow.setBackgroundColor(colors.gray)
  3079.     myWindow.clear()
  3080.     local myWindow = window.create(term.current(),21,6,22,10)
  3081.     myWindow.setBackgroundColor(colors.lime)
  3082.     myWindow.clear()
  3083.     local myWindow = window.create(term.current(),22,7,20,8)
  3084.     myWindow.setBackgroundColor(colors.white)
  3085.     myWindow.clear()
  3086.     paintutils.drawPixel (42,6, colors.red)
  3087.     term.setCursorPos(42,6)
  3088.     write  "*"
  3089.     term.setBackgroundColor(colors.white)
  3090.     term.setTextColor(colors.black)
  3091.     myWindow.setCursorPos (6,1)
  3092.     write "2. Posion"
  3093.     myWindow.setCursorPos (2,3)
  3094.     write "Name"
  3095.     myWindow.setCursorPos (2,5)
  3096.     write "Path:"
  3097.     myWindow.setCursorPos (10,8)
  3098.     write "OK"
  3099.     term.setTextColor(colors.white)
  3100.     term.setBackgroundColor(colors.lightGray)
  3101.     myWindow.setCursorPos (2,4)
  3102.     write "            "
  3103.     myWindow.setCursorPos (2,4)
  3104.     write (menu2)
  3105.     myWindow.setCursorPos (2,6)
  3106.     write "                  "
  3107.     myWindow.setCursorPos (2,6)
  3108.     write (path2)
  3109.     term.setBackgroundColor(colors.gray)
  3110.     while true do
  3111.         local event, button, x, y = os.pullEvent("mouse_click")
  3112.         xy = x..","..y
  3113.  
  3114.             if x >= 23 and x <= 40 and y == 10 and button == 1 then
  3115.             myWindow.setCursorPos (2,4)
  3116.             write "            "
  3117.             myWindow.setCursorPos (2,4)
  3118.             nmenu2 = read ()
  3119.             elseif x >= 23 and x <= 40 and y == 12 and button == 1 then
  3120.             myWindow.setCursorPos (2,6)
  3121.             write "                  "
  3122.             myWindow.setCursorPos (2,6)
  3123.             npath2 = read ()
  3124.             elseif x == 42 and y == 6 and button == 1 then
  3125.            
  3126.             setprograms ()
  3127.             elseif x >= 30 and x <= 32 and y == 14 and button == 1 then
  3128.            
  3129.             apply ()
  3130.             end
  3131.             end
  3132.     elseif x >= 32 and x <= 45 and y == 7 and button == 1 then
  3133.     term.setBackgroundColor(colors.gray)
  3134.     term.setTextColor(colors.white)
  3135.     term.setCursorPos (32,7)
  3136.     write "              "
  3137.     term.setCursorPos (33,7)
  3138.     write (nmenu3)
  3139.     sleep(0.1)
  3140.     local myWindow = window.create(term.current(),22,7,22,10)
  3141.     myWindow.setBackgroundColor(colors.gray)
  3142.     myWindow.clear()
  3143.     local myWindow = window.create(term.current(),21,6,22,10)
  3144.     myWindow.setBackgroundColor(colors.lime)
  3145.     myWindow.clear()
  3146.     local myWindow = window.create(term.current(),22,7,20,8)
  3147.     myWindow.setBackgroundColor(colors.white)
  3148.     myWindow.clear()
  3149.     paintutils.drawPixel (42,6, colors.red)
  3150.     term.setCursorPos(42,6)
  3151.     write  "*"
  3152.     term.setBackgroundColor(colors.white)
  3153.     term.setTextColor(colors.black)
  3154.     myWindow.setCursorPos (6,1)
  3155.     write "3. Posion"
  3156.     myWindow.setCursorPos (2,3)
  3157.     write "Name"
  3158.     myWindow.setCursorPos (2,5)
  3159.     write "Path:"
  3160.     myWindow.setCursorPos (10,8)
  3161.     write "OK"
  3162.     term.setTextColor(colors.white)
  3163.     term.setBackgroundColor(colors.lightGray)
  3164.     myWindow.setCursorPos (2,4)
  3165.     write "            "
  3166.     myWindow.setCursorPos (2,4)
  3167.     write (menu3)
  3168.     myWindow.setCursorPos (2,6)
  3169.     write "                  "
  3170.     myWindow.setCursorPos (2,6)
  3171.     write (path3)
  3172.     term.setBackgroundColor(colors.gray)
  3173.     while true do
  3174.         local event, button, x, y = os.pullEvent("mouse_click")
  3175.         xy = x..","..y
  3176.  
  3177.             if x >= 23 and x <= 40 and y == 10 and button == 1 then
  3178.             myWindow.setCursorPos (2,4)
  3179.             write "            "
  3180.             myWindow.setCursorPos (2,4)
  3181.             nmenu3 = read ()
  3182.             elseif x >= 23 and x <= 40 and y == 12 and button == 1 then
  3183.             myWindow.setCursorPos (2,6)
  3184.             write "                  "
  3185.             myWindow.setCursorPos (2,6)
  3186.             npath3 = read ()
  3187.             elseif x == 42 and y == 6 and button == 1 then
  3188.            
  3189.             setprograms ()
  3190.             elseif x >= 30 and x <= 32 and y == 14 and button == 1 then
  3191.            
  3192.             apply ()
  3193.             end
  3194.             end
  3195.     elseif x >= 32 and x <= 45 and y == 9 and button == 1 then
  3196.     term.setBackgroundColor(colors.gray)
  3197.     term.setTextColor(colors.white)
  3198.     term.setCursorPos (32,9)
  3199.     write "              "
  3200.     term.setCursorPos (33,9)
  3201.     write (nmenu4)
  3202.     sleep(0.1)
  3203.     local myWindow = window.create(term.current(),22,7,22,10)
  3204.     myWindow.setBackgroundColor(colors.gray)
  3205.     myWindow.clear()
  3206.     local myWindow = window.create(term.current(),21,6,22,10)
  3207.     myWindow.setBackgroundColor(colors.lime)
  3208.     myWindow.clear()
  3209.     local myWindow = window.create(term.current(),22,7,20,8)
  3210.     myWindow.setBackgroundColor(colors.white)
  3211.     myWindow.clear()
  3212.     paintutils.drawPixel (42,6, colors.red)
  3213.     term.setCursorPos(42,6)
  3214.     write  "*"
  3215.     term.setBackgroundColor(colors.white)
  3216.     term.setTextColor(colors.black)
  3217.     myWindow.setCursorPos (6,1)
  3218.     write "4. Posion"
  3219.     myWindow.setCursorPos (2,3)
  3220.     write "Name"
  3221.     myWindow.setCursorPos (2,5)
  3222.     write "Path:"
  3223.     myWindow.setCursorPos (10,8)
  3224.     write "OK"
  3225.     term.setTextColor(colors.white)
  3226.     term.setBackgroundColor(colors.lightGray)
  3227.     myWindow.setCursorPos (2,4)
  3228.     write "            "
  3229.     myWindow.setCursorPos (2,4)
  3230.     write (menu4)
  3231.     myWindow.setCursorPos (2,6)
  3232.     write "                  "
  3233.     myWindow.setCursorPos (2,6)
  3234.     write (path4)
  3235.     term.setBackgroundColor(colors.gray)
  3236.     while true do
  3237.         local event, button, x, y = os.pullEvent("mouse_click")
  3238.         xy = x..","..y
  3239.  
  3240.             if x >= 23 and x <= 40 and y == 10 and button == 1 then
  3241.             myWindow.setCursorPos (2,4)
  3242.             write "            "
  3243.             myWindow.setCursorPos (2,4)
  3244.             nmenu4 = read ()
  3245.             elseif x >= 23 and x <= 40 and y == 12 and button == 1 then
  3246.             myWindow.setCursorPos (2,6)
  3247.             write "                  "
  3248.             myWindow.setCursorPos (2,6)
  3249.             npath4 = read ()
  3250.             elseif x == 42 and y == 6 and button == 1 then
  3251.             setprograms ()
  3252.             elseif x >= 30 and x <= 32 and y == 14 and button == 1 then
  3253.  
  3254.             apply ()
  3255.             end
  3256.             end
  3257.     elseif x >= 32 and x <= 45 and y == 11 and button == 1 then
  3258.     term.setBackgroundColor(colors.gray)
  3259.     term.setTextColor(colors.white)
  3260.     term.setCursorPos (32,11)
  3261.     write "              "
  3262.     term.setCursorPos (33,11)
  3263.     write (nmenu5)
  3264.     sleep(0.1)
  3265.     local myWindow = window.create(term.current(),22,7,22,10)
  3266.     myWindow.setBackgroundColor(colors.gray)
  3267.     myWindow.clear()
  3268.     local myWindow = window.create(term.current(),21,6,22,10)
  3269.     myWindow.setBackgroundColor(colors.lime)
  3270.     myWindow.clear()
  3271.     local myWindow = window.create(term.current(),22,7,20,8)
  3272.     myWindow.setBackgroundColor(colors.white)
  3273.     myWindow.clear()
  3274.     paintutils.drawPixel (42,6, colors.red)
  3275.     term.setCursorPos(42,6)
  3276.     write  "*"
  3277.     term.setBackgroundColor(colors.white)
  3278.     term.setTextColor(colors.black)
  3279.     myWindow.setCursorPos (6,1)
  3280.     write "5. Posion"
  3281.     myWindow.setCursorPos (2,3)
  3282.     write "Name"
  3283.     myWindow.setCursorPos (2,5)
  3284.     write "Path:"
  3285.     myWindow.setCursorPos (10,8)
  3286.     write "OK"
  3287.     term.setTextColor(colors.white)
  3288.     term.setBackgroundColor(colors.lightGray)
  3289.     myWindow.setCursorPos (2,4)
  3290.     write "            "
  3291.     myWindow.setCursorPos (2,4)
  3292.     write (menu5)
  3293.     myWindow.setCursorPos (2,6)
  3294.     write "                  "
  3295.     myWindow.setCursorPos (2,6)
  3296.     write (path5)
  3297.     term.setBackgroundColor(colors.gray)
  3298.     while true do
  3299.         local event, button, x, y = os.pullEvent("mouse_click")
  3300.         xy = x..","..y
  3301.  
  3302.             if x >= 23 and x <= 40 and y == 10 and button == 1 then
  3303.             myWindow.setCursorPos (2,4)
  3304.             write "            "
  3305.             myWindow.setCursorPos (2,4)
  3306.             nmenu5 = read ()
  3307.             elseif x >= 23 and x <= 40 and y == 12 and button == 1 then
  3308.             myWindow.setCursorPos (2,6)
  3309.             write "                  "
  3310.             myWindow.setCursorPos (2,6)
  3311.             npath5 = read ()
  3312.             elseif x == 42 and y == 6 and button == 1 then
  3313.            
  3314.             setprograms ()
  3315.             elseif x >= 30 and x <= 32 and y == 14 and button == 1 then
  3316.            
  3317.             apply ()
  3318.             end
  3319.             end    
  3320.     elseif x >= 32 and x <= 45 and y == 13 and button == 1 then
  3321.     term.setBackgroundColor(colors.gray)
  3322.     term.setTextColor(colors.white)
  3323.     term.setCursorPos (32,13)
  3324.     write "              "
  3325.     term.setCursorPos (33,13)
  3326.     write (nmenu6)
  3327.     sleep(0.1)
  3328.     local myWindow = window.create(term.current(),22,7,22,10)
  3329.     myWindow.setBackgroundColor(colors.gray)
  3330.     myWindow.clear()
  3331.     local myWindow = window.create(term.current(),21,6,22,10)
  3332.     myWindow.setBackgroundColor(colors.lime)
  3333.     myWindow.clear()
  3334.     local myWindow = window.create(term.current(),22,7,20,8)
  3335.     myWindow.setBackgroundColor(colors.white)
  3336.     myWindow.clear()
  3337.     paintutils.drawPixel (42,6, colors.red)
  3338.     term.setCursorPos(42,6)
  3339.     write  "*"
  3340.     term.setBackgroundColor(colors.white)
  3341.     term.setTextColor(colors.black)
  3342.     myWindow.setCursorPos (6,1)
  3343.     write "6. Posion"
  3344.     myWindow.setCursorPos (2,3)
  3345.     write "Name"
  3346.     myWindow.setCursorPos (2,5)
  3347.     write "Path:"
  3348.     myWindow.setCursorPos (10,8)
  3349.     write "OK"
  3350.     term.setTextColor(colors.white)
  3351.     term.setBackgroundColor(colors.lightGray)
  3352.     myWindow.setCursorPos (2,4)
  3353.     write "            "
  3354.     myWindow.setCursorPos (2,4)
  3355.     write (menu6)
  3356.     myWindow.setCursorPos (2,6)
  3357.     write "                  "
  3358.     myWindow.setCursorPos (2,6)
  3359.     write (path6)
  3360.     term.setBackgroundColor(colors.gray)
  3361.     while true do
  3362.         local event, button, x, y = os.pullEvent("mouse_click")
  3363.         xy = x..","..y
  3364.  
  3365.             if x >= 23 and x <= 40 and y == 10 and button == 1 then
  3366.             myWindow.setCursorPos (2,4)
  3367.             write "            "
  3368.             myWindow.setCursorPos (2,4)
  3369.             nmenu6 = read ()
  3370.             elseif x >= 23 and x <= 40 and y == 12 and button == 1 then
  3371.             myWindow.setCursorPos (2,6)
  3372.             write "                  "
  3373.             myWindow.setCursorPos (2,6)
  3374.             npath6 = read ()
  3375.             elseif x == 42 and y == 6 and button == 1 then
  3376.            
  3377.             setprograms ()
  3378.             elseif x >= 30 and x <= 32 and y == 14 and button == 1 then
  3379.            
  3380.             apply ()
  3381.             end
  3382.             end
  3383.         elseif x >= 32 and x <= 45 and y == 15 and button == 1 then
  3384.     term.setBackgroundColor(colors.gray)
  3385.     term.setTextColor(colors.white)
  3386.     term.setCursorPos (32,15)
  3387.     write "              "
  3388.     term.setCursorPos (33,15)
  3389.     write (nmenu7)
  3390.     sleep(0.1)
  3391.     local myWindow = window.create(term.current(),22,7,22,10)
  3392.     myWindow.setBackgroundColor(colors.gray)
  3393.     myWindow.clear()
  3394.     local myWindow = window.create(term.current(),21,6,22,10)
  3395.     myWindow.setBackgroundColor(colors.lime)
  3396.     myWindow.clear()
  3397.     local myWindow = window.create(term.current(),22,7,20,8)
  3398.     myWindow.setBackgroundColor(colors.white)
  3399.     myWindow.clear()
  3400.     paintutils.drawPixel (42,6, colors.red)
  3401.     term.setCursorPos(42,6)
  3402.     write  "*"
  3403.     term.setBackgroundColor(colors.white)
  3404.     term.setTextColor(colors.black)
  3405.     myWindow.setCursorPos (6,1)
  3406.     write "7. Posion"
  3407.     myWindow.setCursorPos (2,3)
  3408.     write "Name"
  3409.     myWindow.setCursorPos (2,5)
  3410.     write "Path:"
  3411.     myWindow.setCursorPos (10,8)
  3412.     write "OK"
  3413.     term.setTextColor(colors.white)
  3414.     term.setBackgroundColor(colors.lightGray)
  3415.     myWindow.setCursorPos (2,4)
  3416.     write "            "
  3417.     myWindow.setCursorPos (2,4)
  3418.     write (menu7)
  3419.     myWindow.setCursorPos (2,6)
  3420.     write "                  "
  3421.     myWindow.setCursorPos (2,6)
  3422.     write (path7)
  3423.     term.setBackgroundColor(colors.gray)
  3424.     while true do
  3425.         local event, button, x, y = os.pullEvent("mouse_click")
  3426.         xy = x..","..y
  3427.  
  3428.             if x >= 23 and x <= 40 and y == 10 and button == 1 then
  3429.             myWindow.setCursorPos (2,4)
  3430.             write "            "
  3431.             myWindow.setCursorPos (2,4)
  3432.             nmenu7 = read ()
  3433.             elseif x >= 23 and x <= 40 and y == 12 and button == 1 then
  3434.             myWindow.setCursorPos (2,6)
  3435.             write "                  "
  3436.             myWindow.setCursorPos (2,6)
  3437.             npath7 = read ()
  3438.             elseif x == 42 and y == 6 and button == 1 then
  3439.            
  3440.             setprograms ()
  3441.             elseif x >= 30 and x <= 32 and y == 14 and button == 1 then
  3442.            
  3443.             apply ()
  3444.             end
  3445.             end
  3446.     else
  3447.     paintutils.drawLine(1, 1, w, 1, colors.black)
  3448.     paintutils.drawPixel (w,1, colors.red)
  3449.     term.setTextColor(colors.white)
  3450.     term.setCursorPos (w,1)
  3451.     write  "*"
  3452.     paintutils.drawPixel (50,1, colors.lightGray)
  3453.     term.setCursorPos (w-1,1)
  3454.     write  "<"
  3455.     paintutils.drawPixel (49,1, colors.lightGray)
  3456.     term.setCursorPos (w-2,1)
  3457.     write  "_"
  3458.  
  3459.              while true do
  3460.         local event, button, x, y = os.pullEvent("mouse_click")
  3461.         xy = x..","..y
  3462.        
  3463.         if x == w and y == 1 then
  3464.             ukonceni ()
  3465.         elseif x == w-1 and y == 1 then
  3466.             apps ()
  3467.         elseif x == w-2 and y == 1 then
  3468.             minimalizace ()
  3469.         else
  3470.         setprograms ()
  3471.             end
  3472.             end
  3473. end
  3474. end
  3475. end
  3476.  
  3477.  
  3478. function odhlasit ()
  3479.     local data = fs.delete ("/C/system/RAM")
  3480.     term.setBackgroundColor(colors.lightGray)
  3481.     term.clear()
  3482.     sleep (0.1)
  3483.     term.setBackgroundColor(colors.gray)
  3484.     term.clear()
  3485.     sleep (0.1)
  3486.     term.setBackgroundColor(colors.white)
  3487.     term.setTextColor(colors.black)
  3488.     term.clear()
  3489.     term.setCursorPos(23, 7)
  3490.     prc "Logging out..."
  3491.     term.setBackgroundColor(colors.white)
  3492.     term.setTextColor(colors.blue)
  3493.     term.setCursorPos(20,18)
  3494.     write "  Pepek"
  3495.     term.setCursorPos(28,18)
  3496.     write "Soft  "
  3497.     term.setCursorPos(27,18)
  3498.     term.setTextColor(colors.lime)
  3499.     write "@"
  3500.     sleep (1)
  3501.     local data = fs.open ("/C/system/RAM/logout", "w")
  3502.     data.close ()
  3503.     shell.run("/startup.lua")
  3504. end
  3505.  
  3506. function restartovat()
  3507. os.reboot()
  3508. end
  3509.  
  3510. start ()
Add Comment
Please, Sign In to add comment