pepeknamornik

Verua Pro desktop

Apr 22nd, 2015 (edited)
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 45.75 KB | None | 0 0
  1. local login = 0
  2. local ds = 1
  3. local x = 1
  4. local userI = ""
  5. local vyhledat = "run command"
  6. --os.loadAPI ("/system/api/run")
  7. local passI = ""
  8. local userO = ""
  9. local passO = ""
  10. local data = ""
  11. local user = 0
  12. local pass = ""
  13. local vyhledatold = ""
  14. local sDrive = nil
  15. local tArgs = { ... }
  16. local nastaveni={barva=colors.blue}
  17.         local f=fs.open("system/.core/colors","r")
  18.         local cnt=f.readAll()
  19.         f.close()
  20.         local nastaveni=textutils.unserialize(cnt)
  21. local f=fs.open("system/.core/textcol","r")
  22. local tnt=f.readAll()
  23. f.close()
  24. local text=textutils.unserialize(tnt)
  25.  
  26. fs.delete ("/system/.core/Build")
  27. local na=fs.open("/system/.core/Build","w")
  28. na.writeLine ("Verua Pro")
  29. na.writeLine ("1631")
  30. na.close ()
  31. data = fs.open ("/system/.core/Build", "r")
  32. verze = data.readLine ()
  33. build = data.readLine ()
  34. data.close ()
  35.            
  36. if not fs.exists ("/system/.core/lsprogram") then
  37.         local data = fs.open ("/system/.core/lsprogram", "w")
  38.         data.writeLine("Pmanager")
  39.         data.writeLine()
  40.         data.writeLine("FileX")
  41.         data.writeLine("/system/programs/FileX")
  42.         data.writeLine("Firewolf")
  43.         data.writeLine("/system/api/internet")
  44.         data.writeLine("")
  45.         data.writeLine()
  46.         data.writeLine("")
  47.         data.writeLine()
  48.         data.writeLine("")
  49.         data.writeLine()
  50.         data.writeLine("Setting")
  51.         data.writeLine("/system/programs/setting")
  52.         data.close ()
  53.         end
  54.                    
  55. if fs.exists ("/system/.core/defuser") then
  56. local na=fs.open("/system/.core/defuser","r")
  57.     user = na.readLine ()
  58.     userI = user
  59.     na.close()
  60.     data = fs.open("/system/.ucet/"..userI.."/.data","r")
  61.     user = data.readLine ()
  62.     passI = data.readLine ()
  63.     data.close()
  64. end
  65.  
  66. if fs.exists ("/system/RAM/user") then
  67.     data = fs.open ("/system/RAM/user", "r")
  68.     user = data.readLine ()
  69.     pass = data.readLine ()
  70.     userI = user
  71.     data.close ()
  72.     end
  73.  
  74.  
  75. if not fs.exists ("/system/RAM/"..user) then
  76.     data = fs. open ("/system/RAM/"..user, "w")
  77.     data.close ()
  78.     end
  79.  
  80. local function prc(text, y)
  81.   local w = term.getSize()
  82.   local _, cy = term.getCursorPos()
  83.   term.setCursorPos(math.ceil((w-#text)/2), y or cy)
  84.   write(text)
  85. end
  86.  
  87.  
  88.    
  89. function clear()
  90.   term.clear()
  91.   term.setBackgroundColor(colors.white)
  92.   for i=1,w do
  93.     for j=1,h do
  94.       term.setCursorPos(i,j)
  95.       write(" ")
  96.     end
  97.   end
  98. end
  99.  
  100.    
  101. local function plocha ()
  102.     if fs.exists ("/system/RAM/desk") then
  103.     local data = fs.open("/system/RAM/desk", "r")
  104.     ds = data.readLine()
  105.     data.close ()
  106.    
  107.     if ds >= "0" then
  108.         ds = ds-"1"
  109.         else
  110.         ds = "1"
  111.         end
  112.     end
  113.                    
  114.         if ds < 0 then
  115.            
  116.             ds = 0
  117.             end
  118.            
  119. o=fs.open ("/system/RAM/setting", "w")
  120. o.writeLine (userI)
  121. o.writeLine (passI)
  122. o.close ()
  123.        
  124.  if fs.exists ("/system/Local/"..user.."/desktop/.list"..ds) then
  125.  data = fs.open("/system/Local/"..user.."/desktop/.list"..ds, "r")
  126.             fpath1 = data.readLine ()
  127.             fname1 = data.readLine ()
  128.             ftype1 = data.readLine ()
  129.             fpath2 = data.readLine ()
  130.             fname2 = data.readLine ()
  131.             ftype2 = data.readLine ()
  132.             fpath3 = data.readLine ()
  133.             fname3 = data.readLine ()
  134.             ftype3 = data.readLine ()
  135.             fpath4 = data.readLine ()
  136.             fname4 = data.readLine ()
  137.             ftype4 = data.readLine ()
  138.             fpath5 = data.readLine ()
  139.             fname5 = data.readLine ()
  140.             ftype5 = data.readLine ()
  141.             fpath6 = data.readLine ()
  142.             fname6 = data.readLine ()
  143.             ftype6 = data.readLine ()
  144.             fpath7 = data.readLine ()
  145.             fname7 = data.readLine ()
  146.             ftype7 = data.readLine ()
  147.             fpath8 = data.readLine ()
  148.             fname8 = data.readLine ()
  149.             ftype8 = data.readLine ()
  150.             fpath9 = data.readLine ()
  151.             fname9 = data.readLine ()
  152.             ftype9 = data.readLine ()
  153.             data.close()        
  154.      end
  155.      
  156. local f=fs.open("system/.core/colors","r")
  157. local cnt=f.readAll()
  158. f.close()
  159. local nastaveni=textutils.unserialize(cnt)
  160.  
  161. local f=fs.open("system/.core/textcol","r")
  162. local tnt=f.readAll()
  163. f.close()
  164. local text=textutils.unserialize(tnt)
  165.  
  166. if fs.exists ("/system/RAM/online") then
  167.    internetcon = ""
  168.    else
  169.    internetcon = " No internet connect!"
  170.    end
  171.    
  172. data = fs.open ("/system/RAM/user", "r")
  173.     user = data.readLine ()
  174.     pass = data.readLine ()
  175.     userI = user
  176.     data.close ()
  177.  
  178. min1 = ""
  179. min2 = ""
  180. min3 = ""
  181.  
  182.  
  183. if fs.exists ("/system/RAM/m1") then
  184.     data = fs.open ("/system/RAM/m1", "r")
  185.     min1 = data.readLine ()
  186.     data.close ()
  187.     end
  188. if fs.exists ("/system/RAM/m2") then
  189.     data = fs.open ("/system/RAM/m2", "r")
  190.     min2 = data.readLine ()
  191.     data.close ()
  192.     end
  193. if fs.exists ("/system/RAM/m3") then
  194.     data = fs.open ("/system/RAM/m3", "r")
  195.     min3 = data.readLine ()
  196.     data.close ()
  197.     end
  198.  
  199. if fs.exists ("/system/.ucet/"..user.."/bar.nfp") then
  200.         local image = paintutils.loadImage("/system/.ucet/"..user.."/bar.nfp")
  201.         paintutils.drawImage(image, 1, 1)
  202.     else
  203.         local myWindow = window.create(term.current(),1,1,51,19)
  204.         myWindow.setBackgroundColor(colors.cyan)
  205.         myWindow.clear()
  206.     end
  207.  
  208.     term.setTextColor(text.barva)
  209.     paintutils.drawLine(1, 19, 51, 19, nastaveni.barva)
  210.     term.setCursorPos(1,19)
  211.     term.write (verze.." "..build)
  212.     local time = os.time()
  213.     local formattedTime = textutils.formatTime(time, true)
  214.     term.setCursorPos(46,19)
  215.     term.write(formattedTime)
  216.     term.setCursorPos(30,18)
  217.     print (internetcon)
  218.     term.setCursorPos(1,13)
  219.     term.setTextColor(colors.white)
  220.     term.setBackgroundColor(colors.red)
  221.     term.setCursorPos(1,18)
  222.     print ">"
  223.     term.setBackgroundColor(nastaveni.barva)
  224.     term.setTextColor(text.barva)
  225.     term.setCursorPos(51,18)
  226.     print "<"
  227.     paintutils.drawPixel (51,19, colors.lightBlue)
  228.     term.setTextColor(colors.white)
  229.     if #tArgs > 0 then
  230.     sDrive = tostring( tArgs[1] )
  231. end
  232.  
  233. data = fs.open ("/system/RAM/explorer", "w")
  234. data.writeLine(".list"..ds)
  235. data.writeLine (user)
  236.     data.close ()
  237.    
  238.    
  239. function cteni ()
  240.     data = fs.open ("/system/RAM/explorer", "r")
  241. local ds = data.readLine ()
  242. local user = data.readLine ()
  243.     data.close ()
  244.  
  245. if fs.exists ("/system/local/"..user.."/desktop/"..ds) then
  246.     data = fs.open ("/system/local/"..user.."/desktop/"..ds, "r")
  247.         path1 = data.readLine ()
  248.         name1 = data.readLine ()
  249.         typ1 = data.readLine ()  
  250.     path2 = data.readLine ()
  251.     name2 = data.readLine ()
  252.     typ2 = data.readLine ()
  253.         path3 = data.readLine ()
  254.         name3 = data.readLine ()
  255.         typ3 = data.readLine ()
  256.     path4 = data.readLine ()
  257.     name4 = data.readLine ()
  258.     typ4 = data.readLine ()
  259.         path5 = data.readLine ()
  260.         name5 = data.readLine ()
  261.         typ5 = data.readLine ()
  262.     path6 = data.readLine ()
  263.     name6 = data.readLine ()
  264.     typ6 = data.readLine ()
  265.         path7 = data.readLine ()
  266.         name7 = data.readLine ()
  267.         typ7 = data.readLine ()
  268.     path8 = data.readLine ()
  269.     name8 = data.readLine ()
  270.     typ8 = data.readLine ()
  271.         path9 = data.readLine ()
  272.         name9 = data.readLine ()
  273.         typ9 = data.readLine ()
  274.     data.close ()
  275.     vypis ()
  276.     end
  277. end
  278.  
  279. function vypis ()
  280.     if typ1 == "folder" then
  281.         local ikona = paintutils.loadImage("/system/.core/ikon/folder.nft")
  282.         paintutils.drawImage(ikona, 5, 1)
  283.     term.setBackgroundColor(colors.gray)
  284.     term.setTextColor(colors.white)
  285.     term.setCursorPos(5,5)
  286.     print (name1)
  287.     elseif typ1 == "file" then
  288.         local ikona = paintutils.loadImage("/system/.core/ikon/file.nft")
  289.         paintutils.drawImage(ikona, 5, 1)
  290.     term.setBackgroundColor(colors.gray)
  291.     term.setTextColor(colors.white)
  292.     term.setCursorPos(5,5)
  293.     print (name1)
  294.     end
  295.    
  296.     if typ2 == "folder" then
  297.         local ikona = paintutils.loadImage("/system/.core/ikon/folder.nft")
  298.         paintutils.drawImage(ikona, 22, 1)
  299.     term.setBackgroundColor(colors.gray)
  300.     term.setTextColor(colors.white)
  301.     term.setCursorPos(22,5)
  302.     print (name2)
  303.     elseif typ2 == "file" then
  304.         local ikona = paintutils.loadImage("/system/.core/ikon/file.nft")
  305.         paintutils.drawImage(ikona, 22, 1)
  306.     term.setBackgroundColor(colors.gray)
  307.     term.setTextColor(colors.white)
  308.     term.setCursorPos(22,5)
  309.     print (name2)
  310.     end
  311.    
  312.     if typ3 == "folder" then
  313.         local ikona = paintutils.loadImage("/system/.core/ikon/folder.nft")
  314.         paintutils.drawImage(ikona, 39, 1)
  315.     term.setBackgroundColor(colors.gray)
  316.     term.setTextColor(colors.white)
  317.     term.setCursorPos(39,5)
  318.     print (name3)
  319.     elseif typ3 == "file" then
  320.         local ikona = paintutils.loadImage("/system/.core/ikon/file.nft")
  321.         paintutils.drawImage(ikona, 39, 1)
  322.     term.setBackgroundColor(colors.gray)
  323.     term.setTextColor(colors.white)
  324.     term.setCursorPos(39,5)
  325.     print (name3)
  326.     end
  327.    
  328.     if typ4 == "folder" then
  329.         local ikona = paintutils.loadImage("/system/.core/ikon/folder.nft")
  330.         paintutils.drawImage(ikona, 5, 7)
  331.     term.setBackgroundColor(colors.gray)
  332.     term.setTextColor(colors.white)
  333.     term.setCursorPos(5,11)
  334.     print (name4)
  335.     elseif typ4 == "file" then
  336.         local ikona = paintutils.loadImage("/system/.core/ikon/file.nft")
  337.         paintutils.drawImage(ikona, 5, 7)
  338.     term.setBackgroundColor(colors.gray)
  339.     term.setTextColor(colors.white)
  340.     term.setCursorPos(5,11)
  341.     print (name4)
  342.     end
  343.    
  344.     if typ5 == "folder" then
  345.         local ikona = paintutils.loadImage("/system/.core/ikon/folder.nft")
  346.         paintutils.drawImage(ikona, 22, 7)
  347.     term.setBackgroundColor(colors.gray)
  348.     term.setTextColor(colors.white)
  349.     term.setCursorPos(22,11)
  350.     print (name5)
  351.     elseif typ5 == "file" then
  352.         local ikona = paintutils.loadImage("/system/.core/ikon/file.nft")
  353.         paintutils.drawImage(ikona, 22, 7)
  354.     term.setBackgroundColor(colors.gray)
  355.     term.setTextColor(colors.white)
  356.     term.setCursorPos(22,11)
  357.     print (name5)
  358.     end
  359.    
  360.     if typ6 == "folder" then
  361.         local ikona = paintutils.loadImage("/system/.core/ikon/folder.nft")
  362.         paintutils.drawImage(ikona, 39, 7)
  363.     term.setBackgroundColor(colors.gray)
  364.     term.setTextColor(colors.white)
  365.     term.setCursorPos(39,11)
  366.     print (name6)
  367.     elseif typ6 == "file" then
  368.         local ikona = paintutils.loadImage("/system/.core/ikon/file.nft")
  369.         paintutils.drawImage(ikona, 39, 7)
  370.     term.setBackgroundColor(colors.gray)
  371.     term.setTextColor(colors.white)
  372.     term.setCursorPos(39,11)
  373.     print (name6)
  374.     end
  375.    
  376.     if typ7 == "folder" then
  377.         local ikona = paintutils.loadImage("/system/.core/ikon/folder.nft")
  378.         paintutils.drawImage(ikona, 5, 13)
  379.     term.setBackgroundColor(colors.gray)
  380.     term.setTextColor(colors.white)
  381.     term.setCursorPos(5,17)
  382.     print (name7)
  383.     elseif typ7 == "file" then
  384.         local ikona = paintutils.loadImage("/system/.core/ikon/file.nft")
  385.         paintutils.drawImage(ikona, 5, 13)
  386.     term.setBackgroundColor(colors.gray)
  387.     term.setTextColor(colors.white)
  388.     term.setCursorPos(5,17)
  389.     print (name7)
  390.     end
  391.    
  392.     if typ8 == "folder" then
  393.         local ikona = paintutils.loadImage("/system/.core/ikon/folder.nft")
  394.         paintutils.drawImage(ikona, 22, 13)
  395.     term.setBackgroundColor(colors.gray)
  396.     term.setTextColor(colors.white)
  397.     term.setCursorPos(22,17)
  398.     print (name8)
  399.     elseif typ8 == "file" then
  400.         local ikona = paintutils.loadImage("/system/.core/ikon/file.nft")
  401.         paintutils.drawImage(ikona, 22, 13)
  402.     term.setBackgroundColor(colors.gray)
  403.     term.setTextColor(colors.white)
  404.     term.setCursorPos(22,17)
  405.     print (name8)
  406.     end
  407.    
  408.     if typ9 == "folder" then
  409.         local ikona = paintutils.loadImage("/system/.core/ikon/folder.nft")
  410.         paintutils.drawImage(ikona, 39, 13)
  411.     term.setBackgroundColor(colors.gray)
  412.     term.setTextColor(colors.white)
  413.     term.setCursorPos(39,17)
  414.     print (name9)
  415.     elseif typ9 == "file" then
  416.         local ikona = paintutils.loadImage("/system/.core/ikon/file.nft")
  417.         paintutils.drawImage(ikona, 39, 13)
  418.     term.setBackgroundColor(colors.gray)
  419.     term.setTextColor(colors.white)
  420.     term.setCursorPos(39,17)
  421.     print (name9)
  422.     end
  423. end
  424.  
  425. cteni ()
  426.  
  427. term.setBackgroundColor(nastaveni.barva)
  428. term.setTextColor(text.barva)
  429. term.setCursorPos(51,2)
  430. print ">"
  431. term.setCursorPos(1,2)
  432. print "<"
  433. if ds == 0 then
  434. prc ("Apps for Pepdroll", 18)
  435. elseif ds > 0 then
  436. prc ("Desktop "..ds, 18)
  437. end
  438.  
  439. term.setBackgroundColor(colors.lightBlue)
  440. if fs.exists ("/system/RAM/m1") then
  441. if not min1 == "" then
  442. term.setCursorPos(15,19)
  443. write "          "
  444. end
  445. term.setCursorPos(15,19)
  446. write (min1)
  447. end
  448. if fs.exists ("/system/RAM/m2") then
  449. term.setBackgroundColor(colors.lightGray)
  450. if not min2 == "" then
  451. term.setCursorPos(25,19)
  452. write "          "
  453. end
  454. term.setCursorPos(25,19)
  455. write (min2)
  456. end
  457. if fs.exists ("/system/RAM/m3") then
  458. term.setBackgroundColor(colors.cyan)
  459. if not min3 == "" then
  460. term.setCursorPos(35,19)
  461. write "          "
  462. end
  463. term.setCursorPos(35,19)
  464. write (min3)
  465. end
  466.  
  467. local smodem = peripheral.find("modem")
  468.  
  469. if not smodem then
  470.   paintutils.drawPixel (45,19, colors.red)
  471.     term.setCursorPos(45,19)
  472.     term.write ("M")
  473.     else
  474.     paintutils.drawPixel (45,19, colors.lime)
  475.         term.setCursorPos(45,19)
  476.     term.write ("M")
  477. end
  478.  
  479. if rednet.isOpen('back') == true then
  480. a = 1
  481. elseif rednet.isOpen('left') == true then
  482. b = 1
  483. elseif rednet.isOpen('right') == true then
  484. c = 1
  485. elseif rednet.isOpen('top') == true then
  486. d = 1
  487. elseif rednet.isOpen('bottom') == true then
  488. e = 1
  489. elseif rednet.isOpen('front') == true then
  490. f = 1
  491. else
  492. a = 0
  493. b = 0
  494. c = 0
  495. d = 0
  496. e = 0
  497. f = 0
  498. end
  499.  
  500. if a == 1 then
  501.     pripojeni = 1
  502. elseif b == 1 then
  503.     pripojeni = 1
  504. elseif c == 1 then
  505.     pripojeni = 1
  506. elseif d == 1 then
  507.     pripojeni = 1
  508. elseif e == 1 then
  509.     pripojeni = 1
  510. elseif f == 1 then
  511.     pripojeni = 1
  512. else
  513.     pripojeni = 0
  514. end
  515.  
  516. if pripojeni == 0 then
  517.   paintutils.drawPixel (44,19, colors.red)
  518.     term.setCursorPos(44,19)
  519.     term.write ("W")
  520.     W = 0
  521. elseif pripojeni == 1 then
  522.   if not smodem then
  523.   paintutils.drawPixel (44,19, colors.red)
  524.     term.setCursorPos(44,19)
  525.     term.write ("W")
  526.     W = 0
  527.     else
  528.     paintutils.drawPixel (44,19, colors.lime)
  529.     term.setCursorPos(44,19)
  530.     term.write ("W")
  531.     W = 1
  532. end
  533. end
  534.  
  535. local label = os.getComputerLabel()
  536. if label then
  537.   paintutils.drawPixel (43,19, colors.lime)
  538.     term.setCursorPos(43,19)
  539.     term.write ("L")
  540.   elseif not label then
  541.   paintutils.drawPixel (43,19, colors.red)
  542.     term.setCursorPos(43,19)
  543.     term.write ("L")
  544. end
  545.     while true do
  546.        
  547.         local event, button, x, y = os.pullEvent("mouse_click")
  548.         xy = x..","..y
  549.        
  550.         if x == 51 and y == 18 and button == 1 then
  551.             local myWindow = window.create(term.current(),40,12,12,7)
  552.         myWindow.setBackgroundColor(nastaveni.barva)
  553.         myWindow.clear()
  554.         myWindow.setCursorPos(3,1)
  555.         myWindow.setTextColor(text.barva)
  556.         myWindow.write ("Network")
  557.         myWindow.setCursorPos(12,7)
  558.         print ">"
  559.         local myWindow = window.create(term.current(),41,13,10,6)
  560.         myWindow.setBackgroundColor(colors.gray)
  561.         myWindow.clear()
  562.         myWindow.setCursorPos(2,3)
  563.         myWindow.setTextColor(colors.white)
  564.         myWindow.write( "Label:" )
  565.                         if sDrive == nil then
  566.                     myWindow.setCursorPos(2,2)
  567.                     myWindow.setTextColor(colors.white)
  568.                     print( "ID "..os.getComputerID() )
  569.                    
  570.                     local label = os.getComputerLabel()
  571.                     if label then
  572.                     myWindow.setCursorPos(2,4)
  573.                     myWindow.setTextColor(colors.lime)
  574.                         myWindow.write( "Labeled" )
  575.                     myWindow.setTextColor(colors.white)
  576.                         myWindow.setCursorPos(2,5)
  577.                         myWindow.write(label)
  578.                     else
  579.                     myWindow.setCursorPos(2,4)
  580.                     myWindow.setTextColor(colors.red)
  581.                     myWindow.write( "Unlabeled" )
  582.                     myWindow.setTextColor(colors.white)
  583.                     end
  584.  
  585.                 else
  586.                     local bData = disk.hasData( sDrive )
  587.                     if not bData then
  588.                         print( "No disk in drive "..sDrive )
  589.                         return
  590.                     end
  591.                    
  592.                     print( "The disk is #"..disk.getID( sDrive ) )
  593.  
  594.                     local label = disk.getLabel( sDrive )
  595.                     if label then
  596.                         print( "The disk is labelled \""..label.."\"" )
  597.                     end
  598.                     end
  599.                    
  600.     while true do
  601.         local event, button, x, y = os.pullEvent("mouse_click")
  602.         xy = x..","..y
  603.        
  604.         if x >= 41 and x <= 50 and y >= 17 and y <= 18 and button == 1 then
  605.         myWindow.setCursorPos(1,5)
  606.         term.setBackgroundColor(colors.lightGray)
  607.         print "          "
  608.         myWindow.setCursorPos(2,5)
  609.         spojnice = read ()
  610.     if spojnice == "" then
  611.         os.setComputerLabel()
  612.     elseif spojnice == " " then
  613.         os.setComputerLabel()
  614.     else
  615.         os.setComputerLabel(spojnice)
  616.     end
  617.    
  618.         plocha ()
  619.         else
  620.         plocha ()
  621.         end
  622.     end
  623.         elseif x == 51 and y == 19 and button == 1 then
  624.             shell.run ("/system/desktop")  
  625.         elseif x == 45 and y == 19 and button == 1 then
  626.             if not smodem then
  627.             term.setCursorPos(28,1)
  628.             term.setBackgroundColor(colors.white)
  629.             term.setTextColor(colors.red)
  630.             print "  Modem is not connected"
  631.                 else
  632.             term.setCursorPos(28,1)
  633.             term.setBackgroundColor(colors.white)
  634.             term.setTextColor(colors.lime)
  635.             print "      Modem is connected"
  636.             end
  637.     elseif x == 44 and y == 19 and button == 1 then
  638.             if W == 0 then
  639.             term.setCursorPos(28,1)
  640.             term.setBackgroundColor(colors.white)
  641.             term.setTextColor(colors.red)
  642.             print "      Wireless disconect"
  643.             sleep (0.5)
  644.             pruvodcepr ()
  645.                 else
  646.             term.setCursorPos(28,1)
  647.             term.setBackgroundColor(colors.white)
  648.             term.setTextColor(colors.lime)
  649.             print "      Wireless connected"
  650.             end
  651. elseif x == 43 and y == 19 and button == 1 then
  652.             if not label then
  653.             term.setCursorPos(28,1)
  654.             term.setBackgroundColor(colors.white)
  655.             term.setTextColor(colors.red)
  656.             print " Computer is not labeled"
  657.             sleep (0.5)
  658.             propojeni ()
  659.                 else
  660.             term.setCursorPos(28,1)
  661.             term.setBackgroundColor(colors.white)
  662.             term.setTextColor(colors.lime)
  663.             print "       Computer is label"
  664.             end
  665.         elseif x == 1 and y == 18 and button == 1 then
  666.         menu ()
  667.         elseif x == 51 and y == 19 and button == 1 then
  668.         plocha ()
  669.         elseif x >= 15 and x <= 24 and y == 19 and button == 1 then
  670.             if fs.exists ("/system/RAM/m1") then
  671.                 data = fs.open ("/system/RAM/m1", "r")
  672.                 maxim = data.readLine ()
  673.                 data.close ()
  674.                 fs.delete ("/system/RAM/m1")
  675.         if fs.exists ("/system/.core/.registry/"..maxim..".regs") then
  676.         data = fs.open ("/system/.core/.registry/"..maxim..".regs", "r")
  677.         filename = data.readLine ()
  678.         path = data.readLine ()
  679.         data.close ()
  680.         shell.run (path)
  681.         else
  682.         term.setBackgroundColor(colors.white)
  683.         term.setTextColor(colors.red)
  684.         term.setCursorPos(31,1)
  685.         print " Registry not found! "
  686.         sleep (0.5)
  687.         plocha ()
  688.         end
  689.             else
  690.             return
  691.                 plocha ()
  692.                 end
  693.         elseif x >= 25 and x <= 34 and y == 19 and button == 1 then
  694.             if fs.exists ("/system/RAM/m2") then
  695.                 data = fs.open ("/system/RAM/m2", "r")
  696.                 maxim = data.readLine ()
  697.                 data.close ()
  698.                 fs.delete ("/system/RAM/m2")
  699.         if fs.exists ("/system/.core/.registry/"..maxim..".regs") then
  700.         data = fs.open ("/system/.core/.registry/"..maxim..".regs", "r")
  701.         filename = data.readLine ()
  702.         path = data.readLine ()
  703.         data.close ()
  704.         shell.run (path)
  705.         else
  706.         term.setBackgroundColor(colors.white)
  707.         term.setTextColor(colors.red)
  708.         term.setCursorPos(31,1)
  709.         print " Registry not found! "
  710.         sleep (0.5)
  711.         plocha ()
  712.         end
  713.             else
  714.             return
  715.                 plocha ()
  716.                 end
  717.         elseif x >= 35 and x <= 44 and y == 19 and button == 1 then
  718.             if fs.exists ("/system/RAM/m3") then
  719.                 data = fs.open ("/system/RAM/m3", "r")
  720.                 maxim = data.readLine ()
  721.                 data.close ()
  722.                 fs.delete ("/system/RAM/m3")
  723.         if fs.exists ("/system/.core/.registry/"..maxim..".regs") then
  724.         data = fs.open ("/system/.core/.registry/"..maxim..".regs", "r")
  725.         filename = data.readLine ()
  726.         path = data.readLine ()
  727.         data.close ()
  728.         shell.run (path)
  729.         else
  730.         term.setBackgroundColor(colors.white)
  731.         term.setTextColor(colors.red)
  732.         term.setCursorPos(31,1)
  733.         print " Registry not found! "
  734.         sleep (0.5)
  735.         plocha ()
  736.         end
  737.                  else
  738.                  return
  739.                 plocha ()
  740.                 end
  741.         elseif x == 51 and y == 2 and button == 1 then
  742.                 ds = ds+1
  743.                 local data = fs.open("/system/RAM/desk", "w")
  744.             data.writeLine (ds+"1")
  745.                 data.close ()
  746.                 plocha ()
  747.         elseif x == 1 and y == 2 and button == 1 then
  748.                 ds = ds-1
  749.                 local data = fs.open("/system/RAM/desk", "w")
  750.             data.writeLine (ds+"1")
  751.                 data.close ()
  752.                 plocha ()  
  753.         elseif x >= 29 and x <= 32 and y == 18 and button == 1 then
  754.             term.setBackgroundColor(nastaveni.barva)
  755.             term.setTextColor(text.barva)
  756.             term.setCursorPos(29,18)
  757.             print " "
  758.             term.setCursorPos(29,18)
  759.             lds = ds
  760.             ds = read ()
  761.            
  762.             if ds >= "0" or not ds == nil then
  763.                 local data = fs.open("/system/RAM/desk", "w")
  764.                 data.writeLine (ds+"1")
  765.                 data.close ()
  766.                 plocha ()
  767.             elseif not ds == "0" then
  768.                 ds = "1"
  769.             else
  770.                 ds = lds
  771.                 plocha ()
  772.             end
  773.            
  774.         elseif x >= 5 and x <= 15 and y >= 1 and y <= 5 and button == 1 then
  775.            if ftype1 == "file" then
  776.            if fs.exists (fpath1) then
  777.         local data = fs.open ("/system/RAM/startprogram", "w")
  778.         data.writeLine (fname1)
  779.         data.writeLine (fpath1)
  780.         data.close ()
  781.                shell.exit ()
  782.                shell.run ("/system/api/startprogram")
  783.                else
  784.                plocha ()
  785.                end
  786.                end
  787.         elseif x >= 22 and x <= 32 and y >= 1 and y <= 5 and button == 1 then
  788.            if ftype2 == "file" then
  789.            if fs.exists (fpath2) then
  790.         local data = fs.open ("/system/RAM/startprogram", "w")
  791.         data.writeLine (fname2)
  792.         data.writeLine (fpath2)
  793.         data.close ()
  794.                shell.exit ()
  795.                shell.run ("/system/api/startprogram")
  796.                else
  797.                plocha ()
  798.                end
  799.                end
  800.          elseif x >= 39 and x <= 49 and y >= 1 and y <= 5 and button == 1 then
  801.            if ftype3 == "file" then
  802.            if fs.exists (fpath3) then
  803.         local data = fs.open ("/system/RAM/startprogram", "w")
  804.         data.writeLine (fname3)
  805.         data.writeLine (fpath3)
  806.         data.close ()
  807.                shell.exit ()
  808.                shell.run ("/system/api/startprogram")
  809.                else
  810.                plocha ()
  811.                end
  812.                end
  813.                
  814.                
  815.         elseif x >= 5 and x <= 15 and y >= 7 and y <= 12 and button == 1 then
  816.            if ftype4 == "file" then
  817.            if fs.exists (fpath4) then
  818.         local data = fs.open ("/system/RAM/startprogram", "w")
  819.         data.writeLine (fname4)
  820.         data.writeLine (fpath4)
  821.         data.close ()
  822.                shell.exit ()
  823.                shell.run ("/system/api/startprogram")
  824.                else
  825.                plocha ()
  826.                end
  827.                end
  828.         elseif x >= 22 and x <= 32 and y >= 7 and y <= 12 and button == 1 then
  829.            if ftype5 == "file" then
  830.            if fs.exists (fpath5) then
  831.         local data = fs.open ("/system/RAM/startprogram", "w")
  832.         data.writeLine (fname5)
  833.         data.writeLine (fpath5)
  834.         data.close ()
  835.                shell.exit ()
  836.                shell.run ("/system/api/startprogram")
  837.                else
  838.                plocha ()
  839.                end
  840.                end
  841.          elseif x >= 39 and x <= 49 and y >= 7 and y <= 12 and button == 1 then
  842.            if ftype6 == "file" then
  843.            if fs.exists (fpath6) then
  844.         local data = fs.open ("/system/RAM/startprogram", "w")
  845.         data.writeLine (fname6)
  846.         data.writeLine (fpath6)
  847.         data.close ()
  848.                shell.exit ()
  849.                shell.run ("/system/api/startprogram")
  850.                else
  851.                plocha ()
  852.                end
  853.                end
  854.                
  855.         elseif x >= 5 and x <= 15 and y >= 13 and y <= 18 and button == 1 then
  856.            if ftype7 == "file" then
  857.            if fs.exists (fpath7) then
  858.         local data = fs.open ("/system/RAM/startprogram", "w")
  859.         data.writeLine (fname7)
  860.         data.writeLine (fpath7)
  861.         data.close ()
  862.                shell.exit ()
  863.                shell.run ("/system/api/startprogram")
  864.                else
  865.                plocha ()
  866.                end
  867.                end      
  868.         elseif x >= 22 and x <= 32 and y >= 13 and y <= 18 and button == 1 then
  869.            if ftype8 == "file" then
  870.            if fs.exists (fpath8) then
  871.         local data = fs.open ("/system/RAM/startprogram", "w")
  872.         data.writeLine (fname8)
  873.         data.writeLine (fpath8)
  874.         data.close ()
  875.                shell.exit ()
  876.                shell.run ("/system/api/startprogram")
  877.                else
  878.                plocha ()
  879.                end
  880.                end    
  881.          elseif x >= 39 and x <= 49 and y >= 13 and y <= 18 and button == 1 then
  882.            if ftype9 == "file" then
  883.            if fs.exists (fpath9) then
  884.         local data = fs.open ("/system/RAM/startprogram", "w")
  885.         data.writeLine (fname9)
  886.         data.writeLine (fpath9)
  887.         data.close ()
  888.                shell.exit ()
  889.                shell.run ("/system/api/startprogram")
  890.                else
  891.                plocha ()
  892.                end  
  893.                end
  894.                
  895.         elseif button == 2 then
  896.             if x >= 41 then
  897.                 x = 40
  898.                 end
  899.             if y >= 15 then
  900.                 y = 14
  901.                 end
  902.                
  903.             local myWindow = window.create(term.current(),x,y,12,4)
  904.             myWindow.setBackgroundColor(colors.white)
  905.             myWindow.clear()
  906.             paintutils.drawLine(x, y, x, y+3, nastaveni.barva)
  907.             paintutils.drawLine(x, y-1, x+11, y-1, nastaveni.barva)
  908.             term.setTextColor(text.barva)
  909.             term.setCursorPos (x,y)
  910.             write ">"
  911.             term.setCursorPos (x,y+1)
  912.             write ">"
  913.             term.setCursorPos (x,y+2)
  914.             write ">"
  915.             term.setCursorPos (x,y+3)
  916.             write ">"
  917.             term.setBackgroundColor(colors.white)
  918.             term.setTextColor(colors.black)
  919.             term.setCursorPos (x+1,y)
  920.             write "New Folder"
  921.             term.setCursorPos (x+1,y+1)
  922.             write "New File"
  923.             term.setCursorPos (x+1,y+2)
  924.             write "Delete"
  925.             term.setCursorPos (x+1,y+3)
  926.             write "Theme"
  927.             PosX = x
  928.             PosY = y
  929.       while true do
  930.         local event, button, x, y = os.pullEvent("mouse_click")
  931.         xy = x..","..y
  932.        
  933.         if x >= PosX and x <= PosX+10 and y == PosY and button == 1 then
  934.             local myWindow = window.create(term.current(),PosX,PosY-1,12,7)
  935.             myWindow.setBackgroundColor(colors.black)
  936.             myWindow.clear()
  937.             local myWindow = window.create(term.current(),PosX+1,PosY,10,5)
  938.             myWindow.setBackgroundColor(colors.white)
  939.             myWindow.clear()
  940.             term.setCursorPos (PosX+1,PosY+1)
  941.             term.setBackgroundColor(colors.yellow)
  942.             term.setTextColor(colors.black)
  943.             print "Fold. name"
  944.             term.setBackgroundColor(colors.gray)
  945.             term.setTextColor(colors.white)
  946.             term.setCursorPos (PosX+1,PosY+3)
  947.             print "          "
  948.             term.setCursorPos (PosX+1,PosY+3)
  949.             novaslozka = nil
  950.             novaslozka = read ()
  951.             if novaslozka == "" then
  952.                 plocha ()
  953.                 else
  954.             fs.delete ("/system/RAM/novydokument")
  955.             local data = fs.open("/system/RAM/novydokument", "w")
  956.             data.writeLine ("/system/local/"..user.."/desktop/"..novaslozka)
  957.             data.writeLine (novaslozka)
  958.             data.writeLine ("folder")
  959.             data.writeLine (user)
  960.             data.writeLine (ds+"1")
  961.                 data.close ()
  962.  
  963.             shell.run ("/system/api/novydok")
  964.                 end
  965.         elseif x >= PosX and x <= PosX+10 and y == PosY+1 and button == 1 then
  966.             local myWindow = window.create(term.current(),PosX,PosY-1,12,7)
  967.             myWindow.setBackgroundColor(colors.black)
  968.             myWindow.clear()
  969.             local myWindow = window.create(term.current(),PosX+1,PosY,10,5)
  970.             myWindow.setBackgroundColor(colors.white)
  971.             myWindow.clear()
  972.             term.setCursorPos (PosX+1,PosY+1)
  973.             term.setBackgroundColor(colors.yellow)
  974.             term.setTextColor(colors.black)
  975.             print "File name "
  976.             term.setBackgroundColor(colors.lightGray)
  977.             term.setTextColor(colors.white)
  978.             term.setCursorPos (PosX+1,PosY+3)
  979.             print "          "
  980.             term.setCursorPos (PosX+1,PosY+3)
  981.             novysoubor = nil
  982.             novysoubor = read ()
  983.             if novysoubor == "" then
  984.                 plocha ()
  985.             elseif novysoubor == " " then
  986.                 plocha ()
  987.             else
  988.             fs.delete ("/system/RAM/novydokument")
  989.             local data = fs.open("/system/RAM/novydokument", "w")
  990.             data.writeLine ("/system/local/"..user.."/desktop/"..novysoubor)
  991.             data.writeLine (novysoubor)
  992.             data.writeLine ("file")
  993.             data.writeLine (user)
  994.             data.writeLine (ds+"1")
  995.             data.close ()
  996.                
  997.             shell.run ("/system/api/novydok")
  998.             end
  999.         elseif x >= PosX and x <= PosX+10 and y == PosY+2 and button == 1 then
  1000.             local myWindow = window.create(term.current(),PosX,PosY-1,12,7)
  1001.             myWindow.setBackgroundColor(colors.black)
  1002.             myWindow.clear()
  1003.             local myWindow = window.create(term.current(),PosX+1,PosY,10,5)
  1004.             myWindow.setBackgroundColor(colors.white)
  1005.             myWindow.clear()
  1006.             term.setCursorPos (PosX+1,PosY+1)
  1007.             term.setBackgroundColor(colors.yellow)
  1008.             term.setTextColor(colors.black)
  1009.             print " Filename "
  1010.             term.setCursorPos (PosX+1,PosY+3)
  1011.             print "File      "
  1012.             term.setCursorPos (PosX+1,PosY+4)
  1013.             print "Folder    "
  1014.             term.setBackgroundColor(colors.lightGray)
  1015.             term.setTextColor(colors.white)
  1016.             term.setCursorPos (PosX+1,PosY+2)
  1017.             print "          "
  1018.             term.setCursorPos (PosX+1,PosY+2)
  1019.             smazat = nil
  1020.             smazat = read ()
  1021.             if smazat == "" then
  1022.                 plocha ()
  1023.             elseif smazat == " " then
  1024.                 plocha ()
  1025.             end
  1026.            
  1027.             while true do
  1028.                
  1029.                 local event, button, x, y = os.pullEvent("mouse_click")
  1030.                     xy = x..","..y
  1031.                    
  1032.                     if x >= PosX+1 and x <= PosX+10 and y == PosY+3 and button == 1 then
  1033.                             typ = "file"
  1034.                     elseif x >= PosX+1 and x <= PosX+10 and y == PosY+4 and button == 1 then
  1035.                             typ = "folder"
  1036.                     end
  1037.                    
  1038.             local data = fs.open("/system/RAM/delete", "w")
  1039.             data.writeLine (smazat)
  1040.             data.writeLine (user)
  1041.             data.writeLine (typ)
  1042.             data.writeLine (ds+"1")
  1043.                 data.close ()
  1044.                
  1045.                 local data = fs.open("/system/RAM/deletes", "w")
  1046.             data.writeLine (smazat)
  1047.             data.writeLine (user)
  1048.             data.writeLine (typ)
  1049.             data.writeLine (ds+"1")
  1050.                 data.close ()
  1051.             shell.run ("/system/api/delete")
  1052.             end
  1053.         elseif x >= PosX and x <= PosX+10 and y == PosY+3 and button == 1 then
  1054.             local data = fs.open ("/system/RAM/setdata", "w")
  1055.             data.writeLine("theme")
  1056.             data.close ()
  1057.         local data = fs.open ("/system/RAM/startprogram", "w")
  1058.         data.writeLine ("setting")
  1059.         data.writeLine ("/system/programs/setting")
  1060.         data.close ()    
  1061.         o=fs.open ("/system/RAM/setting", "w")
  1062.         o.writeLine (userI)
  1063.         o.writeLine (passI)
  1064.         o.close ()  
  1065.         shell.run ("/system/api/startprogram")
  1066.         else
  1067.         plocha ()
  1068.             end
  1069.             end
  1070.             else
  1071.             plocha ()
  1072.         end
  1073.     end
  1074. end
  1075.  
  1076. function maximalizace ()
  1077.     if fs.exists ("/system/.core/.registry/"..maxim..".regs") then
  1078.         data = fs.open ("/system/.core/.registry/"..maxim..".regs", "r")
  1079.         filename = data.readLine ()
  1080.         path = data.readLine ()
  1081.         data.close ()
  1082.         shell.run (path)
  1083.         else
  1084.         term.setBackgroundColor(colors.white)
  1085.         term.setTextColor(colors.red)
  1086.         term.setCursorPos(31,1)
  1087.         print " Registry not found! "
  1088.         sleep (0.5)
  1089.         plocha ()
  1090.         end
  1091.         end
  1092.                
  1093. function pruvodcepr ()
  1094.     local myWindow = window.create(term.current(),17,7,22,10)
  1095.     myWindow.setBackgroundColor(colors.gray)
  1096.     myWindow.clear()
  1097.     local myWindow = window.create(term.current(),16,6,22,10)
  1098.     myWindow.setBackgroundColor(colors.lime)
  1099.     myWindow.clear()
  1100.     local myWindow = window.create(term.current(),17,7,20,8)
  1101.     myWindow.setBackgroundColor(colors.white)
  1102.     myWindow.clear()
  1103.     paintutils.drawPixel (37,6, colors.red)
  1104.     term.setCursorPos(37,6)
  1105.     print "*"
  1106.    
  1107.     term.setBackgroundColor(colors.lightGray)
  1108.     if pripojka == "top" then
  1109.         myWindow.setCursorPos(2,4)
  1110.         print "Top"
  1111.     else
  1112.     term.setBackgroundColor(colors.gray)
  1113.     myWindow.setCursorPos(4,8)
  1114.     print " Auto  Repair "
  1115.     term.setBackgroundColor(colors.white)
  1116.     term.setTextColor(colors.black)
  1117.     myWindow.setCursorPos(2,1)
  1118.     print "Connection Manager"
  1119.     myWindow.setCursorPos(2,3)
  1120.     print "  Manual connect  "
  1121.     myWindow.setCursorPos(2,4)
  1122.     print "Top         Bottom"
  1123.     myWindow.setCursorPos(2,5)
  1124.     print "Left         Right"
  1125.     myWindow.setCursorPos(2,6)
  1126.     print "Front         Back"
  1127.     end
  1128.    
  1129.     while true do
  1130.     local event, button, x, y = os.pullEvent("mouse_click")
  1131.         xy = x..","..y
  1132.        
  1133.         if x >= 37 and x <= 37 and y == 6 and button == 1 then
  1134.         plocha ()
  1135.         elseif x >= 18 and x <= 20 and y == 10 and button == 1 then
  1136.         pripojka = "top"
  1137.         connecting ()
  1138.         elseif x >= 18 and x <= 21 and y == 11 and button == 1 then
  1139.         pripojka = "left"
  1140.         connecting ()
  1141.         elseif x >= 18 and x <= 21 and y == 12 and button == 1 then
  1142.         pripojka = "front"
  1143.         connecting ()
  1144.         elseif x >= 30 and x <= 36 and y == 10 and button == 1 then
  1145.         pripojka = "bottom"
  1146.         connecting ()
  1147.         elseif x >= 31 and x <= 36 and y == 11 and button == 1 then
  1148.         pripojka = "right"
  1149.         connecting ()
  1150.         elseif x >= 32 and x <= 36 and y == 12 and button == 1 then
  1151.         pripojka = "back"
  1152.         connecting ()
  1153.         elseif x >= 20 and x <= 33 and y == 14 and button == 1 then
  1154.        
  1155.         local function openRednet()
  1156.   for _,side in ipairs({"top", "bottom", "back", "left", "right", "front"}) do
  1157.         if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
  1158.           rednet.open(side)
  1159.           return side
  1160.         end
  1161.   end
  1162. end
  1163.  
  1164. modemSide = openRednet()
  1165. if modemSide == nil then
  1166.     term.setCursorPos(18,13)
  1167.         term.setTextColor(colors.red)
  1168.         print "No modem found!"
  1169.         sleep (1)
  1170.         plocha ()
  1171. else
  1172.   term.setCursorPos(17,13)
  1173.         term.setTextColor(colors.lime)
  1174.         print ("Connected on: "..modemSide)
  1175.         sleep (1)
  1176.         plocha ()
  1177. end
  1178.  
  1179.         end
  1180.     end
  1181.    
  1182. end
  1183.  
  1184. function connecting ()
  1185.     local function openRednet()
  1186.   for _,side in ipairs({pripojka}) do
  1187.         if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
  1188.           rednet.open(side)
  1189.           return side
  1190.         end
  1191.   end
  1192. end
  1193.  
  1194. modemSide = openRednet()
  1195. if modemSide == nil then
  1196.   term.setCursorPos(18,13)
  1197.         term.setTextColor(colors.red)
  1198.         print "Error - Bad modem!"
  1199.         sleep (1)
  1200.         plocha ()
  1201. else
  1202.         term.setCursorPos(18,13)
  1203.         term.setTextColor(colors.lime)
  1204.         print "Successful"
  1205.         sleep (1)
  1206.         plocha ()
  1207. end
  1208.     end
  1209.  
  1210. function propojeni()
  1211.     local myWindow = window.create(term.current(),17,7,22,10)
  1212.     myWindow.setBackgroundColor(colors.gray)
  1213.     myWindow.clear()
  1214.     local myWindow = window.create(term.current(),16,6,22,10)
  1215.     myWindow.setBackgroundColor(colors.lime)
  1216.     myWindow.clear()
  1217.     local myWindow = window.create(term.current(),17,7,20,8)
  1218.     myWindow.setBackgroundColor(colors.white)
  1219.     myWindow.clear()
  1220.     paintutils.drawPixel (37,6, colors.red)
  1221.     term.setCursorPos(37,6)
  1222.     print "*"
  1223.    
  1224.     term.setBackgroundColor(colors.gray)
  1225.     myWindow.setCursorPos(4,8)
  1226.     print "   Set Label  "
  1227.     term.setBackgroundColor(colors.white)
  1228.     term.setTextColor(colors.black)
  1229.     myWindow.setCursorPos(2,1)
  1230.     print "Connection Manager"
  1231.     myWindow.setCursorPos(2,3)
  1232.     print "  Manual label  "
  1233.     myWindow.setCursorPos(2,5)
  1234.     term.setTextColor(colors.white)
  1235.     term.setBackgroundColor(colors.lightGray)
  1236.     print "                  "
  1237.     myWindow.setCursorPos(3,5)
  1238.     print (spojovak)
  1239.    
  1240.     while true do
  1241.     local event, button, x, y = os.pullEvent("mouse_click")
  1242.         xy = x..","..y
  1243.        
  1244.         if x >= 37 and x <= 37 and y == 6 and button == 1 then
  1245.         plocha ()
  1246.         elseif x >= 18 and x <= 36 and y == 11 and button == 1 then
  1247.         myWindow.setCursorPos(2,5)
  1248.         term.setBackgroundColor(colors.gray)
  1249.         print "                  "
  1250.         myWindow.setCursorPos(3,5)
  1251.         spojovak = read ()
  1252.         elseif x >= 20 and x <= 33 and y == 14 and button == 1 then
  1253.     if spojovak == "" then
  1254.         os.setComputerLabel()
  1255.     elseif spojovak == " " then
  1256.         os.setComputerLabel()
  1257.     else
  1258.         os.setComputerLabel(spojovak)
  1259.     end
  1260.     plocha ()
  1261. end
  1262. end
  1263. end
  1264.    
  1265. function menu ()
  1266.     if fs.exists ("/system/.core/lsprogram") then
  1267.         local data = fs.open ("/system/.core/lsprogram", "r")
  1268.                 menu1 = data.readLine ()
  1269.                 path1 = data.readLine ()
  1270.                 menu2 = data.readLine ()
  1271.                 path2 = data.readLine ()
  1272.                 menu3 = data.readLine ()
  1273.                 path3 = data.readLine ()
  1274.                 menu4 = data.readLine ()
  1275.                 path4 = data.readLine ()
  1276.                 menu5 = data.readLine ()
  1277.                 path5 = data.readLine ()
  1278.                 menu6 = data.readLine ()
  1279.                 path6 = data.readLine ()
  1280.                 menu7 = data.readLine ()
  1281.                 path7 = data.readLine ()
  1282.             data.close ()
  1283.         end
  1284.     local myWindow = window.create(term.current(),1,8,15,19)
  1285.     myWindow.setBackgroundColor(colors.gray)
  1286.     myWindow.clear()
  1287.     term.setCursorPos(1,18)
  1288.     term.setBackgroundColor(colors.white)
  1289.     term.setTextColor(colors.lightGray)
  1290.     write "           "
  1291.     term.setCursorPos(1,18)
  1292.     write (vyhledatold)
  1293.     term.setBackgroundColor(colors.gray)
  1294.     term.setTextColor(colors.white)
  1295.     term.setCursorPos(2,19)
  1296.     write "Power"
  1297.      term.setCursorPos(13,18)
  1298.     write "->"
  1299.     term.setCursorPos(4,8)
  1300.     print (user)
  1301.     term.setCursorPos(2,10)
  1302.     print (menu1)
  1303.     term.setCursorPos(2,11)
  1304.     print (menu2)
  1305.     term.setCursorPos(2,12)
  1306.     print (menu3)
  1307.     term.setCursorPos(2,13)
  1308.     print (menu4)
  1309.     term.setCursorPos(2,14)
  1310.     print (menu5)
  1311.     term.setCursorPos(2,15)
  1312.     print (menu6)
  1313.     term.setCursorPos(2,16)
  1314.     print (menu7)
  1315.     term.setTextColor(colors.lightGray)
  1316.     term.setCursorPos(1,17)
  1317.     print "Managment"
  1318.     term.setCursorPos(1,9)
  1319.     print "Menu"
  1320.    
  1321.     while true do
  1322.     local event, button, x, y = os.pullEvent("mouse_click")
  1323.     xy = x..","..y
  1324.    
  1325.         if x == 2 and y >= 2 and y <= 7 and button == 1 then
  1326.         plocha ()
  1327.         elseif x >= 1 and x <= 15 and y == 10 and button == 1 then
  1328.         if menu1 == "" then
  1329.         plocha ()
  1330.         else
  1331.         path = menu1
  1332.         pathr = path1
  1333.         end
  1334.         elseif x >= 1 and x <= 15 and y == 11 and button == 1 then
  1335.         if menu2 == "" then
  1336.         plocha ()
  1337.         else
  1338.         path = menu2
  1339.         pathr = path2
  1340.         end
  1341.         elseif x >= 1 and x <= 15 and y == 12 and button == 1 then
  1342.         if menu3 == "" then
  1343.         plocha ()
  1344.         else
  1345.         path = menu3
  1346.         pathr = path3
  1347.         end
  1348.         elseif x >= 1 and x <= 15 and y == 13 and button == 1 then
  1349.         if menu4 == "" then
  1350.         plocha ()
  1351.         else
  1352.         path = menu4
  1353.         pathr = path4
  1354.         end
  1355.         elseif x >= 1 and x <= 15 and y == 14 and button == 1 then
  1356.         if menu5 == "" then
  1357.         plocha ()
  1358.         else
  1359.         path = menu5
  1360.         pathr = path5
  1361.         end
  1362.         elseif x >= 1 and x <= 15 and y == 15 and button == 1 then
  1363.         if menu6 == "" then
  1364.         plocha ()
  1365.         else
  1366.         path = menu6
  1367.         pathr = path6
  1368.         end
  1369.         elseif x >= 1 and x <= 15 and y == 16 and button == 1 then
  1370.         if menu7 == "" then
  1371.         plocha ()
  1372.         else
  1373.         path = menu7
  1374.         pathr = path7
  1375.         end
  1376.         elseif x >= 1 and x <= 15 and y == 19 and button == 1 then
  1377.         local myWindow = window.create(term.current(),2,17,8,19)
  1378.         myWindow.setBackgroundColor(colors.lightGray)
  1379.         myWindow.clear()
  1380.         term.setBackgroundColor(colors.lightGray)
  1381.         term.setCursorPos(2,17)
  1382.         write " Sleep    "
  1383.         term.setCursorPos(2,18)
  1384.         write " Restart  "
  1385.         term.setCursorPos(2,19)
  1386.         write " Shutdown "
  1387.         while true do
  1388.         local event, button, x, y = os.pullEvent("mouse_click")
  1389.         xy = x..","..y
  1390.        
  1391.         if x >= 2 and x <= 11 and y == 17 and button == 1 then
  1392.         spanek ()
  1393.         elseif x >= 2 and x <= 11 and y == 18 and button == 1 then
  1394.         fs.makeDir("/system/RAM/restart")
  1395.         shell.run ("/system/api/modes")
  1396.         elseif x >= 2 and x <= 11 and y == 19 and button == 1 then
  1397.         fs.makeDir("/system/RAM/vypnout")
  1398.         shell.run ("/system/api/modes")
  1399.         else
  1400.         plocha ()
  1401.         end
  1402.         end
  1403.         elseif x >= 1 and x <= 11 and y == 18 and button == 1 then
  1404.         term.setCursorPos(1,18)
  1405.         term.setBackgroundColor(colors.white)
  1406.         write "           "
  1407.         term.setCursorPos(1,18)
  1408.         vyhledat = read ()
  1409.             if vyhledat == "cmd" then
  1410.                 shell.run ("/system/api/commander")
  1411.             elseif vyhledat == "net" then
  1412.                 shell.run ("/system/api/internet")
  1413.             elseif vyhledat == "shut" then
  1414.                 fs.makeDir("/system/RAM/vypnout")
  1415.                 shell.run ("/system/api/modes")
  1416.             elseif vyhledat == "hshut" then
  1417.                 os.shutdown ()
  1418.             elseif vyhledat == "hrest" then
  1419.                 os.reboot ()
  1420.                 shell.run ("/system/api/modes")
  1421.             elseif vyhledat == "rest" then
  1422.                 fs.makeDir("/system/RAM/restart")
  1423.                 shell.run ("/system/api/modes")
  1424.             elseif vyhledat == "setting" then
  1425.                 shell.run ("/system/local/programs/setting")
  1426.             else
  1427.         vyhledatold = vyhledat
  1428.         vyhledat = nil
  1429.         plocha ()
  1430.         end
  1431.         end
  1432.        
  1433.         if path == "" then
  1434.             plocha ()
  1435.         elseif path == nil then
  1436.             plocha ()
  1437.         end
  1438.        
  1439. local data = fs.open ("/system/RAM/startprogram", "w")
  1440.         data.writeLine (path)
  1441.         data.writeLine (pathr)
  1442.         data.close ()
  1443.         path = nil
  1444.         pathr = nil
  1445.         spustit ()
  1446.        
  1447.        
  1448. end
  1449. end
  1450.  
  1451. function chyba ()
  1452.            term.setBackgroundColor(colors.red)
  1453.     term.setTextColor(colors.white)
  1454.     prc ("   Error = Program not found   ", 9)
  1455.     sleep (0.5)
  1456.     plocha ()
  1457.     end
  1458.    
  1459. menuname = nil
  1460. pathr = nil
  1461.  
  1462. function spustit ()
  1463. term.setBackgroundColor(colors.white)
  1464. local image = paintutils.loadImage("/system/.core/ikon/logo.nft")
  1465.     term.setBackgroundColor(colors.white)
  1466.     term.setTextColor (colors.black)
  1467.     term.clear ()
  1468.     paintutils.drawImage(image, 12, 4)
  1469.     term.setBackgroundColor(colors.white)
  1470.     prc ("Loading program ...", 15)
  1471.     term.setCursorPos(1,17)
  1472.    
  1473.     local data = fs.open ("/system/RAM/startprogram", "r")
  1474.         menuname = data.readLine ()
  1475.         pathr = data.readLine ()
  1476.         data.close ()
  1477.         fs.delete ("/system/RAM/startprogram")
  1478.    
  1479.        
  1480.    if not menuname == nil then
  1481.        chyba ()
  1482.    end
  1483.    
  1484.    if not fs.exists ("/system/.core/.registry/"..menuname..".regs") then
  1485.        if fs.exists (pathr) then
  1486.            sleep (0.3)
  1487.         shell.run (pathr)
  1488.         else
  1489.         chyba ()
  1490.         end
  1491.       chyba ()
  1492.    end
  1493.        
  1494.      local data = fs.open ("/system/.core/.registry/"..menuname..".regs", "r")
  1495.         filename = data.readLine ()
  1496.         cesta = data.readLine ()
  1497.         pastebincode = data.readLine ()
  1498.         menuname = data.readLine ()
  1499.         poradi = data.readLine ()
  1500.     data.close ()
  1501.     sleep (0.3)
  1502.     shell.run (cesta)
  1503.     shell.run ("/system/api/bluescreen")
  1504.    
  1505. end  
  1506.    
  1507. function spanek ()
  1508. term.setBackgroundColor(colors.lightGray)
  1509. term.clear()
  1510. sleep (0.1)
  1511. term.setBackgroundColor(colors.gray)
  1512. term.clear()
  1513. sleep (0.1)
  1514. term.setBackgroundColor(colors.black)
  1515. term.setTextColor(colors.black)
  1516. term.clear()
  1517. while true do
  1518.   local event, button, xPos, yPos = os.pullEvent("mouse_click")
  1519.   plocha ()
  1520. end
  1521. end
  1522.  
  1523. plocha ()
Add Comment
Please, Sign In to add comment