Advertisement
pepeknamornik

zaloha plocha

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