Advertisement
pepeknamornik

Uživatelské prostředí

Jun 19th, 2019 (edited)
9,993
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 74.78 KB | None | 0 0
  1. verze = "23.0402.R3"
  2. local w, h = term.getSize()
  3. local nastaveni={barva=colors.blue}
  4. local lastprikaz = ""
  5. local anim = 0.1
  6. local d = 0
  7. local computerMode = 0
  8. local ADC = false
  9. local idPC = os.getComputerID()
  10. local sound = false
  11. local koncovka = ""
  12. local smbMode = false
  13. local FirstLogin = false
  14. local Anim = true
  15. local ExDisplay = false
  16. local stin = false
  17.  
  18. BPozadi = 128
  19.  
  20. dofile("/C/system/api/APIS.lua")
  21. if not pocket then
  22. filePos = {
  23.   [1] = {3,2},
  24.   [2] = {15,2},
  25.   [3] = {27,2},
  26.   [4] = {39,2},
  27.   [5] = {3,6},
  28.   [6] = {15,6},
  29.   [7] = {27,6},
  30.   [8] = {39,6},
  31.   [9] = {3,10},
  32.   [10] = {15,10},
  33.   [11] = {27,10},
  34.   [12] = {39,10},
  35.   [13] = {3,14},
  36.   [14] = {15,14},
  37.   [15] = {27,14},
  38.   [16] = {39,14}
  39. }
  40. else
  41. filePos = {
  42.   [1] = {2,3},
  43.   [2] = {14,3},
  44.   [3] = {2,7},
  45.   [4] = {14,7},
  46.   [5] = {2,11},
  47.   [6] = {14,11},
  48.   [7] = {2,15},
  49.   [8] = {14,15},
  50. }
  51. end
  52.  
  53. local diskPos = {
  54.       [1] = {26,10},
  55.       [2] = {39,10},
  56.       [3] = {13,12},
  57.       [4] = {26,12},
  58.       [5] = {39,12},
  59.       [6] = {13,14},
  60.       [7] = {26,14},
  61.       [8] = {39,14},
  62.       [9] = {13,16},
  63.       [10] = {26,16},
  64.       [11] = {39,16},
  65.     }
  66. k = 0
  67. local vyber = 0
  68. local cPage = 1
  69. local nPage = 1
  70. local vystrih = ""
  71. local trash = false
  72. local FileMenu = true
  73.  
  74. local function bgc(barvaP) term.setBackgroundColor(barvaP) end
  75. local function txc(barvaP) term.setTextColor(barvaP) end
  76. local function curs(xi,yi) term.setCursorPos(xi,yi) end
  77.  
  78. local function Barvy()
  79.     if fs.exists ("/C/system/Users/"..user.."/.Registry/colors") then
  80.     local data = fs.open("/C/system/Users/"..user.."/.Registry/colors", "r")
  81.     BarPoz = tonumber(data.readLine())
  82.     BarTxt = tonumber(data.readLine())
  83.     data.close()
  84.     end
  85.     if BarPoz == nil or BarTxt == nil then BarPoz = 2048 BarTxt = 1 end
  86.    
  87.     if fs.exists ("/C/system/Users/"..user.."/.Registry/.shadow") then stin = true else stin = false end
  88.    
  89. end
  90.  
  91.  
  92.  
  93. local function prc(text, y)
  94.   local w = term.getSize()
  95.   local _, cy = term.getCursorPos()
  96.   curs(math.ceil((w-#text)/2), y or cy)
  97.   write(text)
  98. end
  99.  
  100. function song(type)
  101. if sound and not fs.exists("/C/system/Users/"..user.."/.Registry/.disableSound") then RunApp("/C/system/api/sound.api "..type) end
  102. end
  103.  
  104. function dns_check(dns)
  105.     if fs.exists("/C/system/api/dns_check.api") then
  106.         if fs.exists("/C/system/.core/.Registry/defdns.cfg") then local data = fs.open("/C/system/.core/.Registry/defdns.cfg", "r") DNS_SRV = tonumber(data.readLine()) data.close()
  107.         else
  108.             DNS_SRV = 0
  109.         end
  110.         shell.run("/C/system/api/dns_check.api get "..DNS_SRV.." "..dns)
  111.         if fs.exists("/C/system/RAM/dns_check.tmp") then
  112.             local data = fs.open("/C/system/RAM/dns_check.tmp", "r")
  113.             local dnsV = tonumber(data.readLine())
  114.             data.close()
  115.             return dnsV
  116.         end
  117.     end
  118. end
  119.  
  120.  
  121. if fs.exists("/C/system/.core/system") then
  122.     local data = fs.open ("/C/system/.core/system", "r")
  123.     edice = data.readLine()
  124.     data.close()
  125. else
  126.     edice = "Standard"
  127. end
  128.  
  129. if fs.exists("/C/system/RAM/online") then
  130.     local data = fs.open("/C/system/RAM/online", "r")
  131.     local Conser = data.readLine()
  132.     if (Conser == "pastebin.com") then PastebinMode = true  DevbinMode = false
  133.     elseif (Conser == "devbin.dev") then DevbinMode = true PastebinMode = false
  134.     else DevbinMode = false PastebinMode = false end
  135.     data.close()
  136. else DevbinMode = false PastebinMode = false end
  137.  
  138. if fs.exists("/C/system/RAM/FirstLogin") then
  139. fs.delete("/C/system/RAM/FirstLogin")
  140. FirstLogin = true
  141. end
  142.  
  143.  
  144. if (edice == "Server") then ServerMode = true end
  145.  
  146. if fs.exists("/C/system/.core/defmodem") then
  147.         local data = fs.open ("/C/system/.core/defmodem","r")
  148.         modemPos = data.readLine()
  149.         data.close()
  150.         modem = peripheral.wrap(modemPos)
  151.         modem.open(idPC)
  152.         if not modemPos then
  153.         fs.delete("/C/system/.core/defmodem")
  154.         modemPos = "offline"
  155.         end
  156.     else
  157.         modemPos = "offline"
  158. end
  159.    
  160. if fs.exists ("/C/system/.core/AD") then
  161.     ADC = true
  162.     local f=fs.open("/C/system/.core/AD","r")
  163.     ADServer=f.readLine()
  164.     f.close()
  165. end
  166.    
  167.  
  168. local function downloading(dkod, cestaP)
  169.     RunApp("/C/system/api/stahni.api get "..dkod.." "..cestaP)
  170. end
  171.  
  172. function cbarva()
  173. txc(colors.gray)
  174. bgc(colors.lightGray)
  175. end
  176.            
  177. function vyvinfo()
  178.     curs(1,1)
  179.     bgc(colors.lightBlue)
  180.     txc(colors.white)
  181.     write (w..", "..h)
  182.     curs(1,2)
  183.    
  184.     if computerMode == 0 then
  185.         write ("Monitor")
  186.     elseif computerMode == 1 then
  187.         write ("Computer")
  188.     elseif computerMode == 2 then
  189.         write ("Pocket")
  190.     else
  191.         write ("Other")
  192.     end
  193. end
  194.  
  195. function pripona(cest)
  196. koncovka =""
  197. local q = #cest
  198.     repeat
  199.     q = q-1
  200.     hledej = string.sub(cest,q,q);
  201.     if (hledej==".") then
  202.     koncovka = string.sub(cest,q+1,#cest)
  203.     q = 0
  204.     end
  205.     until q == 0
  206.    
  207.     return cest:sub(-3)
  208.    
  209. end
  210.  
  211.     function RunApp(Rcesta, closeApp)
  212.     --shell.run(Rcesta) -- doplnit detekci chyb. hlaseni
  213.     state,err = pcall(function() shell.run(Rcesta) end )
  214.                 local data = fs.open("/C/system/RAM/err.txt", "w")
  215.                 data.writeLine("state: "..tostring(state))
  216.                 data.writeLine("err: "..tostring(err))
  217.                 data.close()
  218.    
  219.     if closeApp then shell.run("/C/system/api/closeApp") end
  220.     end
  221.  
  222. function spustitprikaz()
  223. curs(1,-10)
  224. if not fs.exists("/C/system/RAM/command") then fs.delete("/C/system/RAM/command") end
  225.     local prikazdoc = fs.open ("/C/system/RAM/command", "w")
  226.     prikazdoc.writeLine (prikaz)
  227.     prikazdoc.writeLine (verze)
  228.     prikazdoc.close ()
  229.     if not fs.exists("/C/system/api/commands.lua") then downloading("r18V4xrG", "/C/system/api/commands.lua") end
  230.     RunApp("/C/system/api/commands.lua")
  231. end
  232.  
  233. function synchronizace()
  234.  
  235.     if not (modemPos == "offline") then
  236.         modem.transmit(tonumber(ADServer),554,idPC)
  237.         modem.transmit(tonumber(ADServer),555, user) --sync plocha
  238.        
  239.         if fs.exists("/C/system/Users/"..user.."/.Registry/bar.nfp") then
  240.         local f=fs.open("/C/system/Users/"..user.."/.Registry/bar.nfp","r")
  241.         sync_object=f.readAll()
  242.         f.close()
  243.         modem.transmit(tonumber(ADServer),560, sync_object) --sync plocha
  244.         end
  245.  
  246.         if fs.exists("/C/system/Users/"..user.."/.Registry/colors") then
  247.         local f=fs.open("/C/system/Users/"..user.."/.Registry/colors","r")
  248.         sync_object=f.readAll()
  249.         f.close()
  250.         modem.transmit(tonumber(ADServer),561, sync_object) --sync barva pozadi
  251.         end
  252.     end
  253. end
  254.  
  255. function desktop()
  256.     w, h = term.getSize()
  257.     trash = false
  258.     curs(1,1)
  259.     txc(colors.black)
  260.     bgc(colors.black)
  261.     local f=fs.open("/C/system/RAM/user","r")
  262.     user=f.readLine()
  263.     f.close()
  264.    
  265.     if fs.exists("/C/system/RAM/devices/speaker.tmp") and not fs.exists("/C/system/Users/"..user.."/.Registry/.disableSound") then
  266.     sound = true
  267.     end
  268.  
  269.     if fs.exists("/C/system/RAM/versions.tmp") then
  270.     local x = fs.open("/C/system/RAM/versions.tmp","r")
  271.     local startupVer = x.readLine()
  272.     local desktopVer = x.readLine()
  273.     x.close()
  274.     if (desktopVer == nil) then
  275.     local v = fs.open("/C/system/RAM/versions.tmp","a")
  276.     v.writeLine(verze)
  277.     v.close()
  278.     end
  279.     end
  280.    
  281.     if not fs.exists("/C/system/Users/"..user.."/vyvoj") then
  282.         vyvoj = false
  283.     else
  284.         vyvoj = true
  285.     end
  286.    
  287.     if not fs.exists("/C/system/Users/"..user.."/.Registry/colors") then
  288.         local data = fs.open("/C/system/Users/"..user.."/.Registry/colors", "w")
  289.         data.writeLine("2048")
  290.         data.writeLine("1")
  291.         data.close ()
  292.     end
  293.     Barvy()
  294.     plocha()
  295. end
  296.  
  297. function cas()
  298.     txc(BarTxt)
  299.     bgc(BarPoz)
  300.         if fs.exists("/C/system/Users/"..user.."/.Registry/.realTime") then
  301.         curs(w-5,h) write(os.date("%H:%M"))
  302.         else
  303.         if os.time() > 10 then
  304.         curs(w-5,h)
  305.         write(textutils.formatTime(os.time(), true))
  306.         else
  307.         curs(w-5,h)
  308.         write(" ")
  309.         write(textutils.formatTime(os.time(), true))
  310.         end
  311.     end
  312.     w, h = term.getSize()
  313. end
  314.  
  315. function lista()
  316.         Barvy()
  317.         paintutils.drawLine(4, h, w, h, BarPoz)
  318.         cas()
  319.         bgc(colors.lightBlue)
  320.         curs(1,h)
  321.         write"MENU"
  322.         bgc(BarPoz)
  323.         if ExDisplay then curs(w-2,h-1) write"dsc" end
  324.         local smodem = peripheral.find("modem")
  325.  
  326.             if not smodem then
  327.                 txc(colors.red)
  328.                 curs(w-8,h)
  329.                 term.write ("M")
  330.                 else
  331.                 txc(32)
  332.                    curs(w-8,h)
  333.                 term.write ("M")
  334.             end
  335.  
  336.     local label = os.getComputerLabel()
  337.     if label then
  338.         txc(32)
  339.         curs(w-9,h)
  340.         term.write ("L")
  341.       elseif not label then
  342.         txc(colors.red)
  343.         curs(w-9,h)
  344.         term.write ("L")
  345.     end
  346.    
  347.     if not sound then
  348.         txc(colors.red)
  349.         curs(w-10,h)
  350.         term.write ("S")
  351.       else
  352.         txc(32)
  353.         curs(w-10,h)
  354.         term.write ("S")
  355.     end
  356.    
  357.     if PastebinMode then
  358.         txc(32)
  359.         curs(w-7,h)
  360.         term.write ("P")
  361.     elseif DevbinMode then
  362.         txc(32)
  363.         curs(w-7,h)
  364.         term.write ("D")
  365.     else
  366.         txc(colors.red)
  367.         curs(w-7,h)
  368.         term.write ("X")
  369.     end
  370. end
  371.  
  372. function panel()
  373.         cas()
  374.         kurzor()
  375.        
  376.         if event == "mouse_click" then
  377.                 if x == w-8 and y == h then
  378.                     if not smodem and fs.exists("/C/system/api/setting.lua")then
  379.                     RunApp("/C/system/api/setting.lua network")
  380.                     plocha()
  381.                     end
  382.                 elseif x == w-7 and y == h then
  383.                     curs(w-21,h-1)
  384.                     bgc(colors.white)
  385.                         if PastebinMode then
  386.                         write(" Connected to Pastebin ")
  387.                         elseif DevbinMode then
  388.                         write("  Connected to Devbin ")
  389.                         else write ("          Disconected!") end
  390.                         sleep(1)
  391.                         plocha()
  392.                 elseif x >= w-2 and y == h-1 and ExDisplay then
  393.                     song("hwout")
  394.                     local data = fs.open ("/C/system/RAM/displayreboot", "w")
  395.                     data.close ()
  396.                     curs(31,14)
  397.                     write" Disconect "
  398.                     if fs.exists("/C/system/.core/display") then
  399.                     fs.delete("/C/system/.core/display")
  400.                     end
  401.                     bgc(colors.black)
  402.                     term.clear()
  403.                     os.reboot()
  404.                 elseif x == w-9 and y == h then
  405.                     if not label and fs.exists("/C/system/api/setting.lua")then
  406.                         RunApp("/C/system/api/setting.lua network")
  407.                         plocha()
  408.                         end
  409.                 elseif x == w-10 and y == h then
  410.                     if fs.exists("/C/system/api/setting.lua") then
  411.                         RunApp("/C/system/api/setting.lua Sounds")
  412.                         plocha()
  413.                     end
  414.                 elseif x >= w-5 and y == h then
  415.                     for i=1, 4 do paintutils.drawLine(w-10, h-i, w, h-i, BPozadi) if Anim then sleep(0.05) end end
  416.                     txc(BarTxt) curs(w-4,h-3) write(os.date("%H:%M"))
  417.                     curs(w-9,h-2) write(os.date("%d.%m.%Y"))
  418.                 end
  419.         end
  420. end
  421.  
  422. function sColor(color)
  423.   bgc(color)
  424. end
  425.  
  426. cesta = {}
  427. typ = {}
  428.  
  429. function chyba(duvod)
  430.    
  431.     myWindow = window.create(term.current(),w/2-8,h/2-2,20,6)
  432.     myWindow.setBackgroundColor(colors.gray)
  433.     myWindow.setTextColor(colors.white)
  434.     myWindow.clear()
  435.     myWindow.setBackgroundColor(colors.red)
  436.     myWindow.setCursorPos (20, 1)
  437.     myWindow.write"×"
  438.     myWindow.setCursorPos (1, 1)
  439.     myWindow.setBackgroundColor(BarPoz)
  440.     myWindow.setTextColor(BarTxt)
  441.     myWindow.write"       Error!      "
  442.     myWindow.setBackgroundColor(colors.gray)
  443.     myWindow.setTextColor(colors.red)
  444.    
  445.     if duvod == "timeOut" then
  446.     myWindow.setCursorPos (1, 3)
  447.     myWindow.write"     Timed out!      "
  448.     myWindow.setTextColor(colors.black)
  449.     myWindow.setBackgroundColor(colors.lightGray)
  450.     myWindow.setCursorPos (3, 5)
  451.     myWindow.write" Retry "
  452.     myWindow.setCursorPos (11, 5)
  453.     myWindow.write" Storno "
  454.     end
  455.    
  456.     song("stop")
  457.  
  458.      while true do
  459.             local event, button, x, y = os.pullEvent("mouse_click")
  460.             xy = x..","..y
  461.            
  462.             if event == "mouse_click" and x == math.floor(w/2+11) and  y == math.floor(h/2-2) and button == 1 then
  463.             plocha()
  464.             elseif event == "mouse_click" and x >= math.floor(w/2-6) and x <= math.floor(w/2) and  y == math.floor(h/2+2) and button == 1 then
  465.             myWindow.setBackgroundColor(colors.gray)
  466.             myWindow.setCursorPos (3, 5)
  467.             myWindow.write" Retry "
  468.             sleep(0.2)
  469.             pruzkumniksmb("//"..SMBserver..SMBPath)
  470.             elseif event == "mouse_click" and x >= math.floor(w/2+2) and x <= math.floor(w/2+9) and  y == math.floor(h/2+2) and button == 1 then
  471.             myWindow.setBackgroundColor(colors.gray)
  472.             myWindow.setCursorPos (11, 5)
  473.             myWindow.write" Storno "
  474.             sleep(0.2)
  475.             plocha()
  476.             end
  477.     end
  478. end
  479.  
  480. function vypis()
  481.  
  482.     bgc(colors.white)
  483.     txc(colors.black)
  484.         if pocket then
  485.         maX = 8
  486.         else
  487.         maX = 16
  488.         end
  489.        
  490. if (smbMode) then
  491.     if fs.exists("/C/system/RAM/struktura.tmp") then
  492.     local q = 1
  493.  
  494.         local data = fs.open("/C/system/RAM/struktura.tmp", "r")
  495.        
  496.         for i =1, 100 do
  497.         cDir[i] = nil
  498.         end
  499.        
  500.        
  501.             repeat
  502.             local souborText = data.readLine()
  503.                 if not (souborText == nil) then
  504.                 cDir[q] = souborText
  505.                 if (cDir[1] == "TimeOut") then
  506.                 for i =1, 100 do
  507.                 cDir[i] = nil
  508.                 end
  509.                 chyba("timeOut") end
  510.                 q = q+1
  511.                 else
  512.                 q = 0
  513.                 end
  514.             until q == 0
  515.        
  516.         data.close()
  517.     elseif fs.exists("/C/system/RAM/smbError.tmp") then
  518.     fs.delete("/C/system/RAM/smbError.tmp")
  519.     SMBUser = user
  520.     SMBPass = pass
  521.    
  522.     Swin = window.create(term.current(),w/2-8,h/2-4,20,10)
  523.     Swin.setBackgroundColor(colors.gray)
  524.     Swin.setTextColor(colors.white)
  525.     Swin.clear()
  526.         function okno()
  527.         Swin.setBackgroundColor(colors.gray)
  528.         Swin.setTextColor(colors.white)
  529.         Swin.setCursorPos (2, 3)
  530.         Swin.write("Username:")
  531.         Swin.setCursorPos (2, 6)
  532.         Swin.write("Password:")
  533.         Swin.setBackgroundColor(colors.red)
  534.         Swin.setCursorPos (20, 1)
  535.         Swin.setTextColor(BarTxt)
  536.         Swin.write"×"
  537.         Swin.setCursorPos (1, 1)
  538.         Swin.setBackgroundColor(BarPoz)
  539.         Swin.write("                   ")
  540.         Swin.setCursorPos (2, 1)
  541.         Swin.write("Login failed")
  542.         Swin.setTextColor(colors.black)
  543.         Swin.setBackgroundColor(colors.lightGray)
  544.         Swin.setCursorPos (2, 4)
  545.         Swin.write("                  ")
  546.         Swin.setCursorPos (3, 4)
  547.         Swin.write(SMBUser)
  548.         Swin.setCursorPos (2, 7)
  549.         Swin.write("                  ")
  550.         if SMBPass == nil then SMBPass = "" end
  551.         Swin.setCursorPos (3, 7) Swin.write(SMBPass)
  552.         Swin.setCursorPos (9, 9)
  553.         Swin.write" OK "
  554.         bgc(colors.lightBlue)
  555.         end
  556.    
  557.     okno()
  558.    
  559.      while true do
  560.             local event, button, x, y = os.pullEvent()
  561.            
  562.             if event == "mouse_click" and button == 1 then
  563.                 if x == math.floor(w/2+11) and  y == math.floor(h/2-4)  then
  564.                 smbMode = false pruzkumnik()
  565.                 elseif  x >= math.floor(w/2-7) and x <= math.floor(w/2+10) and  y == math.floor(h/2-1) then
  566.                 Swin.setBackgroundColor(colors.lightBlue)
  567.                 Swin.setCursorPos (2, 4) Swin.write("                  ") Swin.setCursorPos (3, 4)
  568.                 SMBUser = read()
  569.                 okno()
  570.                 elseif  x >= math.floor(w/2-7) and x <= math.floor(w/2+10) and  y == math.floor(h/2+2) then
  571.                 Swin.setBackgroundColor(colors.lightBlue)
  572.                 Swin.setCursorPos (2, 7) Swin.write("                  ") Swin.setCursorPos (3, 7)
  573.                 SMBPass = read()
  574.                 okno()
  575.                 elseif  x >= math.floor(w/2) and x <= math.floor(w/2+3) and  y == math.floor(h/2+4) then Swin.setBackgroundColor(colors.gray) Swin.setCursorPos (9, 9)
  576.                 Swin.write" OK "
  577.                 sleep(0.1)
  578.                 local f=fs.open("/C/system/RAM/userSMB","w") f.writeLine(SMBUser) f.writeLine(SMBPass) f.close()
  579.                 os.startTimer(1) pruzkumniksmb("//"..SMBserver..SMBPath)
  580.             end
  581.             elseif event == "key" and (button == keys.enter or button == keys.numEnter) then Swin.setCursorPos (9, 9)
  582.                 Swin.write" OK "
  583.                 sleep(0.1)
  584.                 local f=fs.open("/C/system/RAM/userSMB","w") f.writeLine(SMBUser) f.writeLine(SMBPass) f.close()
  585.                 os.startTimer(1) pruzkumniksmb("//"..SMBserver..SMBPath)
  586.         end
  587.     end
  588.    
  589.    
  590.     end
  591.    
  592. else   
  593.     cDir = fs.list(shell.dir())
  594.    
  595.     if not fs.exists ("/C/system/Users/"..user.."/.Registry/.showItem") then
  596.     local sItem = false
  597.         if #cDir > 0 then
  598.         repeat
  599.             if (string.sub(cDir[1],1,1) == ".") then
  600.                 for i=1, #cDir-1 do
  601.                 cDir[i] = cDir[i+1]
  602.                 end
  603.                 cDir[#cDir] = nil
  604.             else sItem = true
  605.             end
  606.         until sItem
  607.         end
  608.     end
  609.    
  610. end
  611.     for i = 1, #cDir do
  612.     maxFil = #cDir/maX
  613.     local num = i
  614.     local a = i+maX*(cPage-1)
  615.     local name = tostring(cDir[a])
  616.     if name == "nil" then break end  
  617.     local TK = string.sub(name,#name-3,#name)
  618.         if #name > 9 then
  619.             if TK == ".src" or TK == ".lua" then
  620.                 if #name <= 13 then
  621.                 text = string.sub(name,1,#name-4)
  622.                 else
  623.                 text = string.sub(name,1,6).."..."
  624.                 end
  625.             else
  626.             text = string.sub(name,1,6).."..."
  627.             end
  628.         else
  629.           text = name
  630.         end
  631.         if not (i == nil) then
  632.         cesta[i] = name
  633.         end
  634.        
  635.         local slozka = false
  636.        
  637.         if smbMode then
  638.             if (string.sub(name,#name,#name) == "*") then text = string.sub(name,1,#name-1) cesta[i] = text slozka = true end
  639.         end
  640.        
  641.     if (fs.isDir(shell.dir().."/"..name)) or slozka then
  642.         if (text == "_Trash") then
  643.             sColor(colors.brown)
  644.         else
  645.             sColor(colors.yellow)
  646.         end
  647.       typ[i] = "folder"
  648.     else
  649.         if (text == "This PC") then
  650.             sColor(BarPoz)
  651.         elseif (TK == ".src") then
  652.             sColor(colors.lime)
  653.         elseif (TK == ".lua") then
  654.             sColor(colors.gray)
  655.         elseif (TK == ".txt") then
  656.             sColor(colors.orange)
  657.         else
  658.             sColor(colors.lightGray)
  659.         end
  660.         typ[i] = "file"
  661.     end
  662.    
  663.     if i > maX then break end
  664.     x = filePos[i][1]
  665.     y = filePos[i][2]
  666.     curs(x,y)
  667.     term.write(string.rep(" ",11))
  668.     curs(x,y+1)
  669.     term.write(string.rep(" ",math.floor(5.5-#tostring(text)/2)))
  670.     term.write(text)
  671.     term.write(string.rep(" ",math.ceil(5.5-#tostring(text)/2)))
  672.     curs(x,y+2)
  673.     term.write(string.rep(" ",11))
  674.     if (typ[i] == "file") then
  675.         if not (text=="This PC") then
  676.         curs(x+2,y+2)
  677.   if not smbMode then term.write(math.ceil((fs.getSize(shell.dir().."/"..cesta[i]))/1000).." KB") end
  678.         end
  679.     end
  680.   end  
  681.     if (zpet == "pruzkumnik") then
  682.         bgc(colors.white)
  683.         if (cPage > 9) then curs(w-1,h/2-1)
  684.         else curs(w,h/2-1) end
  685.         write(math.ceil(cPage))
  686.         curs(w,h/2)
  687.         write("/")
  688.         if (maxFil > 9) then curs(w-1,h/2+1)
  689.         else curs(w,h/2+1) end
  690.         if (maxFil == nil) then
  691.         write("1")
  692.         else
  693.         write(math.ceil(maxFil))
  694.         end
  695.     end
  696.    
  697.     lista()
  698.     txc(colors.black)
  699.    
  700. end
  701.  
  702. function mrizka()
  703.    
  704.     if fs.exists("/C/system/Users/"..user.."/.Registry/.disableAnim") then Anim = false end
  705.    
  706.     if not pocket then
  707.         if x >= (filePos[1][1]) and x <= ((filePos[1][1])+10) and y >= (filePos[1][2]) and y <= ((filePos[1][2])+2) then
  708.         vyber = 1  
  709.         elseif x >= (filePos[2][1]) and x <= ((filePos[2][1])+10) and y >= (filePos[2][2]) and y <= ((filePos[2][2])+2) then
  710.         vyber = 2
  711.         elseif x >= (filePos[3][1]) and x <= ((filePos[3][1])+10) and y >= (filePos[3][2]) and y <= ((filePos[3][2])+2) then
  712.         vyber = 3
  713.         elseif x >= (filePos[4][1]) and x <= ((filePos[4][1])+10) and y >= (filePos[4][2]) and y <= ((filePos[4][2])+2) then
  714.         vyber = 4
  715.         elseif x >= (filePos[5][1]) and x <= ((filePos[5][1])+10) and y >= (filePos[5][2]) and y <= ((filePos[5][2])+2) then
  716.         vyber = 5  
  717.         elseif x >= (filePos[6][1]) and x <= ((filePos[6][1])+10) and y >= (filePos[6][2]) and y <= ((filePos[6][2])+2) then
  718.         vyber = 6
  719.         elseif x >= (filePos[7][1]) and x <= ((filePos[7][1])+10) and y >= (filePos[7][2]) and y <= ((filePos[7][2])+2) then
  720.         vyber = 7
  721.         elseif x >= (filePos[8][1]) and x <= ((filePos[8][1])+10) and y >= (filePos[8][2]) and y <= ((filePos[8][2])+2) then
  722.         vyber = 8
  723.         elseif x >= (filePos[9][1]) and x <= ((filePos[9][1])+10) and y >= (filePos[9][2]) and y <= ((filePos[9][2])+2) then
  724.         vyber = 9  
  725.         elseif x >= (filePos[10][1]) and x <= ((filePos[10][1])+10) and y >= (filePos[10][2]) and y <= ((filePos[10][2])+2) then
  726.         vyber = 10
  727.         elseif x >= (filePos[11][1]) and x <= ((filePos[11][1])+10) and y >= (filePos[11][2]) and y <= ((filePos[11][2])+2) then
  728.         vyber = 11
  729.         elseif x >= (filePos[12][1]) and x <= ((filePos[12][1])+10) and y >= (filePos[12][2]) and y <= ((filePos[12][2])+2) then
  730.         vyber = 12
  731.         elseif x >= (filePos[13][1]) and x <= ((filePos[13][1])+10) and y >= (filePos[13][2]) and y <= ((filePos[13][2])+2) then
  732.         vyber = 13
  733.         elseif x >= (filePos[14][1]) and x <= ((filePos[14][1])+10) and y >= (filePos[14][2]) and y <= ((filePos[14][2])+2) then
  734.         vyber = 14
  735.         elseif x >= (filePos[15][1]) and x <= ((filePos[15][1])+10) and y >= (filePos[15][2]) and y <= ((filePos[15][2])+2) then
  736.         vyber = 15
  737.         elseif x >= (filePos[16][1]) and x <= ((filePos[16][1])+10) and y >= (filePos[16][2]) and y <= ((filePos[16][2])+2) then
  738.         vyber = 16
  739.         else
  740.         vyber = 0  
  741.         end
  742.     else
  743.         if x >= (filePos[1][1]) and x <= ((filePos[1][1])+10) and y >= (filePos[1][2]) and y <= ((filePos[1][2])+2) then
  744.         vyber = 1  
  745.         elseif x >= (filePos[2][1]) and x <= ((filePos[2][1])+10) and y >= (filePos[2][2]) and y <= ((filePos[2][2])+2) then
  746.         vyber = 2
  747.         elseif x >= (filePos[3][1]) and x <= ((filePos[3][1])+10) and y >= (filePos[3][2]) and y <= ((filePos[3][2])+2) then
  748.         vyber = 3
  749.         elseif x >= (filePos[4][1]) and x <= ((filePos[4][1])+10) and y >= (filePos[4][2]) and y <= ((filePos[4][2])+2) then
  750.         vyber = 4
  751.         elseif x >= (filePos[5][1]) and x <= ((filePos[5][1])+10) and y >= (filePos[5][2]) and y <= ((filePos[5][2])+2) then
  752.         vyber = 5  
  753.         elseif x >= (filePos[6][1]) and x <= ((filePos[6][1])+10) and y >= (filePos[6][2]) and y <= ((filePos[6][2])+2) then
  754.         vyber = 6
  755.         elseif x >= (filePos[7][1]) and x <= ((filePos[7][1])+10) and y >= (filePos[7][2]) and y <= ((filePos[7][2])+2) then
  756.         vyber = 7
  757.         elseif x >= (filePos[8][1]) and x <= ((filePos[8][1])+10) and y >= (filePos[8][2]) and y <= ((filePos[8][2])+2) then
  758.         vyber = 8
  759.         else
  760.         vyber = 0
  761.         end
  762.     end
  763.    
  764.     if not smbMode then
  765.     if (vyber > #fs.list(shell.dir())) then vyber = 0 end
  766.     end
  767.    
  768.     if vyber == 0 or (cesta[vyber]) == nil then
  769.     FileMenu = false
  770.     else
  771.     pripona(cesta[vyber])
  772.     FileMenu = true
  773.     if cesta[vyber] == "/C/system/Users/"..user.."/Desktop/_Trash" then trash = true end
  774.     end
  775.    
  776.    
  777.     if vyvoj then
  778.         curs(1,1)
  779.         if (vyber<10) then
  780.         write("0"..vyber)
  781.         else
  782.         write(vyber)
  783.         end
  784.     end
  785.    
  786. end
  787.  
  788. function zpatky()
  789. vyber = 0
  790.     if (zpet == "plocha") then
  791.     plocha()
  792.     elseif (zpet == "pruzkumniksmb") then
  793.     os.startTimer(1)
  794.     pruzkumniksmb("//"..SMBserver..SMBPath)
  795.     else
  796.     if fs.exists("/C/system/RAM/back.tmp") then
  797.         local data = fs.open("/C/system/RAM/back.tmp", "r")
  798.         zpatecka = data.readLine()
  799.         data.close()
  800.         fs.delete("/C/system/RAM/back.tmp")
  801.     end
  802.     shell.run("cd /"..zpatecka)
  803.     pruzkumnik()
  804.     end
  805. end
  806.  
  807. function overit(exist_cesta)
  808.     q = 0
  809.     if fs.exists(exist_cesta) then
  810.         q = 1
  811.         while fs.exists(exist_cesta.."("..q..")") do
  812.         q = q+1
  813.         end
  814.     end
  815. end
  816.  
  817. function RunAppSpec(program)
  818.  
  819.     function findWordInQuotes(str)  -- najde výraz mezi uvozovkami!
  820.         local start_idx, end_idx, word = str:find('"([^"]+)"')
  821.         if start_idx ~= nil then
  822.             return word
  823.         else
  824.             return nil
  825.         end
  826.     end
  827.  
  828.     --pripona(program)
  829.     local FolderResult = ""
  830.    
  831.     if not fs.exists("/C/system/.core/.Registry/ProgramList.cfg") then downloading("M3B1ACvb", "/C/system/.core/.Registry/ProgramList.cfg") end
  832.                    
  833.     if fs.exists("/C/system/.core/.Registry/ProgramList.cfg") then
  834.    
  835.    
  836.         if (pripona(program) == "src") then
  837.             local FolderScan = fs.open(shell.dir().."/"..program, "r")
  838.             FolderResult = findWordInQuotes(FolderScan.readLine())
  839.             FolderScan.close()
  840.            
  841.             if (string.sub(FolderResult, 1, 2) == "//") then
  842.             smbMode = true
  843.                
  844.                 if (FolderResult:sub(-1) == "/") then
  845.                 pruzkumniksmb(FolderResult)
  846.                 else
  847.                
  848.                     function parsePath(path)
  849.                         local _, _, num, rest = string.find(path, "^//(%d+)/(.*)")
  850.                         if not num then
  851.                             return nil, path, ""
  852.                         end
  853.                        
  854.                         local _, _, file, other = string.find(rest, "(.-)/([^/]+)$")
  855.                         if not file then
  856.                             return num, rest, ""
  857.                         end
  858.                        
  859.                         return num, file, other
  860.                     end
  861.                    
  862.                     SMBserver, SMBPath, cesta[vyber] = parsePath(FolderResult)
  863.                    
  864.                     SMBPath = SMBPath.."/"
  865.                    
  866.                     SMBrun()
  867.  
  868.                    
  869.                    
  870.                     zpatky()
  871.                 end
  872.             end
  873.            
  874.             if fs.exists(FolderResult) then
  875.            
  876.                 if (fs.isDir(FolderResult)) then
  877.                     pruzkumnik(FolderResult)
  878.                 end        
  879.                
  880.             else
  881.             dialog(BarPoz,BarTxt, "File not found!", "  Check the file ","     location",false) pruzkumniksmb(shell.dir())
  882.             end
  883.         end
  884.            
  885.             local data = fs.open("/C/system/.core/.Registry/ProgramList.cfg", "r")
  886.                            
  887.             local pri = ""
  888.             local prog = ""
  889.                                    
  890.             repeat
  891.                 pri = data.readLine()
  892.                 prog = data.readLine()
  893.                     if pri ~= nil then
  894.                         if koncovka == pri then
  895.                             RunApp(prog.." "..program)
  896.                             kurzor()
  897.                         end
  898.                     end
  899.        
  900.                 until pri == nil
  901.                     data.close()
  902.                     RunApp(program)
  903.                     else
  904.                     RunApp(program)
  905.                 end
  906.                    
  907.         cPage = 1
  908. end
  909.  
  910.  
  911. function kurzor()
  912.     event, p1, p2,p3 = os.pullEvent()
  913.     button = p1
  914.     x = p2
  915.     y = p3
  916.        
  917.         if event == "mouse_click" and x >= 1 and x <= 5 and y == h and button == 1 then menu()
  918.         elseif event == "mouse_click" and x >= 1 and x <= 5 and y == h and button == 2 then power()
  919.         elseif event == "key" and (p1 == keys.leftCtrl or p1 == keys.rightCtrl) then menu()
  920.         elseif event == "key_up" and p1 == 290 then if PastebinMode then curs(1,-3) shell.run("pastebin run WBE35q0m") end zpatky()
  921.         end
  922.  
  923.        
  924.         if event == "mouse_click" then
  925.         mrizka()
  926.         end
  927.        
  928.         if event == "mouse_click" and vyber > 0 and button == 1 then
  929.             if not (cesta[vyber] == nil) then
  930.                 if (cesta[vyber] == "This PC.src") then
  931.                 thisPC()
  932.                 elseif (typ[vyber] == "folder") then
  933.                 cPage = 1
  934.                 if smbMode then
  935.                 os.startTimer(1)
  936.                     pruzkumniksmb("//"..SMBserver..SMBPath..cesta[vyber])
  937.                 else
  938.                     shell.run("cd "..cesta[vyber].."/")
  939.                     pruzkumnik()
  940.                 end
  941.                 elseif (typ[vyber] == "file") then
  942.                     if not trash then
  943.                         if smbMode then SMBrun()
  944.                         else RunAppSpec(cesta[vyber])
  945.                         end
  946.                     end
  947.                     zpatky()
  948.                 end
  949.             end
  950.         end
  951.        
  952.     if (cesta[vyber] == "_Trash") then
  953.         trash = true
  954.     end
  955.        
  956.         if event == "mouse_click" and y < h and button == 2 then
  957.         zpatecka = shell.dir()
  958.         Xe = x
  959.         Ye = y
  960.        
  961.        
  962.         bgc(BMenu)
  963.             if (x > w-9) then
  964.             x = w-9
  965.             end
  966.             if (y > h-7) then
  967.             y = h-7
  968.             end
  969.             if Anim then for i=0, 7 do paintutils.drawLine(x, y+i, x+9, y+i, BMenu) sleep(0.05) end end
  970.            
  971.             if stin then
  972.             menu_win = window.create(term.current(),x+1,y+1,10,8)
  973.             menu_win.setBackgroundColor(colors.lightGray)
  974.             menu_win.clear()
  975.             end
  976.             menu_win = window.create(term.current(),x,y,10,8)
  977.             menu_win.setBackgroundColor(BMenu)
  978.             menu_win.setTextColor(Btextmenu)
  979.             menu_win.clear()
  980.             menu_win.setCursorPos(2,1)
  981.             menu_win.write "Run"
  982.             menu_win.setCursorPos(2,2)
  983.             menu_win.write"New     >"
  984.             menu_win.setCursorPos(2,3)
  985.             menu_win.write "Open/Edit"
  986.             menu_win.setCursorPos(2,4)
  987.             if trash then menu_win.write ("Spill out") else menu_win.write ("Delete") end
  988.             menu_win.setCursorPos(2,5)
  989.             menu_win.write "Action  >"
  990.             curs(1,1)
  991.             menu_win.setCursorPos(2,6)
  992.             if FileMenu and koncovka == "nfp" then menu_win.write "Set Backg" else menu_win.write "Pastebin" end
  993.             menu_win.setCursorPos(2,7)
  994.             if not smbMode then  menu_win.write ("Terminal") else menu_win.write ("Con. DRV") end
  995.             menu_win.setCursorPos(2,8)
  996.             if FileMenu and (koncovka == "lua" or koncovka == "txt") then menu_win.write "Print" elseif shell.dir() == ("C/system/Users/"..user.."/Desktop") then menu_win.write ("Theme") else menu_win.write ("Setting") end
  997.             menu_win.setBackgroundColor(colors.lightGray)
  998.             if vyvoj then
  999.             curs(1,1)write ("x:"..x.." y: "..y)
  1000.             end
  1001.             PosX = x
  1002.             PosY = y
  1003.             PosXc = PosX
  1004.             PosYc = PosY
  1005.            
  1006.             while true do
  1007.                 event, button, x,y = os.pullEvent()
  1008.                
  1009.                 if event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+1 and button == 1 then
  1010.                         if (PosXc > w-19) then
  1011.                         PosX = w-29
  1012.                         end
  1013.                         if (y > h-5) then
  1014.                         y = h-5
  1015.                         end
  1016.                        
  1017.                         menu_win.setCursorPos(1,2)
  1018.                         menu_win.write "·New     >"
  1019.                         if stin then
  1020.                             new_menu = window.create(term.current(),PosX+11,y+1,10,3)
  1021.                             new_menu.setBackgroundColor(colors.lightGray)
  1022.                             new_menu.clear()
  1023.                         end
  1024.                         new_menu = window.create(term.current(),PosX+10,y,10,3)
  1025.                         new_menu.setBackgroundColor(BMenu)
  1026.                         new_menu.setTextColor(Btextmenu)
  1027.                         new_menu.clear()
  1028.                         new_menu.setCursorPos(2,1)
  1029.                         new_menu.write "File"
  1030.                         new_menu.setCursorPos(2,2)
  1031.                         new_menu.write "Folder"
  1032.                         new_menu.setCursorPos(2,3)
  1033.                         new_menu.setTextColor(Btextmenu)
  1034.                         new_menu.write "Shortcut"
  1035.                         new_menu.setTextColor(Btextmenu)
  1036.                         curs(1,1)
  1037.                         if vyvoj then
  1038.                         write ("x:"..x.." y: "..y)
  1039.                         end
  1040.                         PosX = PosX+10
  1041.                         PosY = y
  1042.                         new_file = ""
  1043.                         while true do
  1044.                         event, button, x,y = os.pullEvent()
  1045.                        
  1046.                         if event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY and button == 1 then
  1047.                                 new_menu.setCursorPos(1,1)
  1048.                                 new_menu.write"          "
  1049.                                 new_menu.setCursorPos(1,1)
  1050.                                 new_file = read()
  1051.                            
  1052.                             if (new_file == "") then
  1053.                                 new_menu.setCursorPos(1,1)
  1054.                                 new_menu.write" Error    "
  1055.                                 sleep(0.2)
  1056.                                 zpatky()
  1057.                             end
  1058.                             pripona(new_file)
  1059.                            
  1060.                             if smbMode then
  1061.                                                    
  1062.                                 if koncovka == "" then
  1063.                                     new_file = (new_file..".lua")
  1064.                                 end
  1065.                            
  1066.                             RunApp("/C/system/api/smbc.lua "..SMBserver.." newFile "..SMBPath.."/"..new_file)
  1067.  
  1068.  
  1069.  
  1070.                             else
  1071.                             new_file = (shell.dir().."/"..new_file)
  1072.                            
  1073.                                 if not fs.exists(new_file) then
  1074.                                     if koncovka == "" then
  1075.                                     create_file = fs.open(new_file..".lua","w")
  1076.                                     else
  1077.                                     create_file = fs.open(new_file,"w")
  1078.                                     create_file.close()
  1079.                                     end
  1080.                                     new_menu.setCursorPos(1,1)
  1081.                                     new_menu.write" Created  "
  1082.                                     sleep(0.2)
  1083.                                     zpatky()
  1084.                                    
  1085.                                 else
  1086.                                     new_menu.setCursorPos(1,1)
  1087.                                     new_menu.write" Error    "
  1088.                                     sleep(0.2)
  1089.                                     zpatky()
  1090.                                 end            
  1091.                             end
  1092.                                     zpatky()
  1093.                         elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+1 and button == 1 then
  1094.                                 new_menu.setCursorPos(1,2)
  1095.                                 new_menu.write"          "
  1096.                                 new_menu.setCursorPos(1,2)
  1097.                                 new_file = read()
  1098.                             if (new_file == "") then
  1099.                                 new_menu.setCursorPos(1,2)
  1100.                                 new_menu.write" Error    "
  1101.                                 song("error")
  1102.                                 sleep(0.2)
  1103.                                 zpatky()
  1104.                             end
  1105.                            
  1106.                             if smbMode then
  1107.                             RunApp("/C/system/api/smbc.lua "..SMBserver.." newFolder "..SMBPath.."/"..new_file)
  1108.                             else
  1109.                                 if not fs.exists(shell.dir().."/"..new_file) then
  1110.                                     fs.makeDir(shell.dir().."/"..new_file)
  1111.                                     new_menu.setCursorPos(1,2)
  1112.                                     new_menu.write" Created  "
  1113.                                     sleep(0.2)
  1114.                                     zpatky()
  1115.                                 else
  1116.                                     new_menu.setCursorPos(1,2)
  1117.                                     new_menu.write" Error    "
  1118.                                     song("stop")
  1119.                                     sleep(0.2)
  1120.                                     zpatky()
  1121.                                 end
  1122.                             end
  1123.                             zpatky()
  1124.                         elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+2 and button == 1 then -- and not smbMode
  1125.                                
  1126.                                
  1127.                                 pripona(shell.dir().."/"..cesta[vyber])
  1128.                                
  1129.                                     local exists = fs.exists(shell.dir() .. "/" .. cesta[vyber] .. ".src")
  1130.                                     local is_dir = fs.isDir(shell.dir() .. "/" .. cesta[vyber])
  1131.                                     local is_src = koncovka == "src"
  1132.                                     local is_trash = cesta[vyber] == "_Trash"
  1133.                                     local is_file = typ[vyber] == "file"
  1134.                                    
  1135.  
  1136.                                     if not exists and not is_src and not is_trash then
  1137.                                       local create_short = fs.open(shell.dir() .. "/" .. cesta[vyber] .. ".src", "w")
  1138.                                       if smbMode then
  1139.                                                                                
  1140.                                         if is_file then
  1141.                                           create_short.writeLine("shell.run(\"//" .. SMBserver .. SMBPath .. cesta[vyber] .. "\")")
  1142.                                         else
  1143.                                           create_short.writeLine("shell.run(\"//" .. SMBserver .. SMBPath .. cesta[vyber] .. "/\")")
  1144.                                         end
  1145.                                        
  1146.                                       else
  1147.                                         if is_dir then
  1148.                                           create_short.writeLine("shell.run(\"/" .. shell.dir() .. "/" .. cesta[vyber] .. "/\")")
  1149.                                         else
  1150.                                           create_short.writeLine("shell.run(\"/" .. shell.dir() .. "/" .. cesta[vyber] .. "\")")
  1151.                                         end
  1152.                                       end
  1153.                                       create_short.close()
  1154.  
  1155.                                       new_menu.setCursorPos(1, 3)
  1156.                                       new_menu.setBackgroundColor(colors.lightGray)
  1157.                                       new_menu.write(" Created  ")
  1158.                                       sleep(0.2)
  1159.                                       zpatky()
  1160.                                     else
  1161.                                       new_menu.setCursorPos(1, 3)
  1162.                                       new_menu.setBackgroundColor(colors.lightGray)
  1163.                                       --song("error")
  1164.                                       new_menu.write(" Error!   ")
  1165.                                       dialog(BarPoz,BarTxt, "Explorer", "    The file"," already exists!",false)
  1166.                                       sleep(0.2)
  1167.                                       zpatky()
  1168.                                     end
  1169.  
  1170.                         elseif event == "mouse_click" then
  1171.                         zpatky()
  1172.                         end
  1173.                     end
  1174.                 elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY and button == 1 then
  1175.                 bgc(colors.lightGray)
  1176.                 curs(PosX,y)
  1177.                 write" Run      "
  1178.                 sleep(0.1)
  1179.                     if not (cesta[vyber] == nil) and not trash then
  1180.                         if (typ[vyber] == "file") then
  1181.                        
  1182.                             if smbMode then FromSMB = true SMBrun()
  1183.                             else RunApp(cesta[vyber], true)
  1184.                             end
  1185.                            
  1186.                         else plocha ()
  1187.                         end
  1188.                     end
  1189.                 elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY and button == 2 then
  1190.                 bgc(colors.lime)
  1191.                 curs(PosX,y)
  1192.                 write" Run      "
  1193.                 sleep(0.1)
  1194.                     if not (cesta[vyber] == nil) then
  1195.                         if (typ[vyber] == "file") then shell.openTab( cesta[vyber]) plocha() else plocha () end
  1196.                        
  1197.                     end
  1198.                    
  1199.                 zpatky()
  1200.                 elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+4 and button == 1 then
  1201.                 if (PosXc > w-16) then
  1202.                     PosX = w-26
  1203.                     end
  1204.                    
  1205.                 menu_win.setCursorPos(1,5)
  1206.                 menu_win.write "·Action  >"
  1207.                         if stin then
  1208.                             new_menu = window.create(term.current(),PosX+11,y-1,8,4)
  1209.                             new_menu.setBackgroundColor(colors.lightGray)
  1210.                             new_menu.clear()
  1211.                         end
  1212.                         new_menu = window.create(term.current(),PosX+10,y-2,8,4)
  1213.                         new_menu.setBackgroundColor(BMenu)
  1214.                         new_menu.setTextColor(Btextmenu)
  1215.                         new_menu.clear()
  1216.                         new_menu.setCursorPos(2,1)
  1217.                         new_menu.write "Cut"
  1218.                         new_menu.setCursorPos(2,2)
  1219.                         new_menu.write "Copy"
  1220.                         new_menu.setCursorPos(2,3)
  1221.                         new_menu.write "Paste"
  1222.                         new_menu.setCursorPos(2,4)
  1223.                         new_menu.write "Rename"
  1224.                        
  1225.                         PosX = PosX+10
  1226.                         PosY = y-2
  1227.                         new_file = ""
  1228.                         while true do
  1229.                         event, button, x,y = os.pullEvent()
  1230.                        
  1231.                             if event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY and button == 1 then
  1232.                                 new_menu.setCursorPos(1,1)
  1233.                                 new_menu.write "·Cut    "
  1234.                                 if fs.exists("/C/system/RAM/cut/") then fs.delete("/C/system/RAM/cut/") end
  1235.                                 FromSMB = false
  1236.                                 if not (cesta[vyber] == nil) then
  1237.                                 if smbMode then  FromSMB = true SMBcut() else fs.move("/"..shell.dir().."/"..cesta[vyber], "/C/system/RAM/cut/"..cesta[vyber]) end
  1238.                                 vystrih = cesta[vyber]
  1239.                                 sleep(0.1)
  1240.                                 end
  1241.                                 zpatky()
  1242.                             elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+1 and button == 1 then
  1243.                                 new_menu.setCursorPos(1,2)
  1244.                                 new_menu.write "·Copy   "
  1245.                                 FromSMB = false
  1246.                                 if fs.exists("/C/system/RAM/cut/") then fs.delete("/C/system/RAM/cut/") end
  1247.                                 if not (cesta[vyber] == nil) then
  1248.                                 if smbMode then FromSMB = true SMBcopy() else fs.copy("/"..shell.dir().."/"..cesta[vyber], "/C/system/RAM/cut/"..cesta[vyber]) end
  1249.                                 vystrih = cesta[vyber]
  1250.                                 sleep(0.1)
  1251.                                 end
  1252.                                 zpatky()
  1253.                             elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+2 and button == 1 then
  1254.                                 new_menu.setCursorPos(1,3)
  1255.                                 new_menu.write "·Paste  "
  1256.                                 sleep(0.1)
  1257.                                 if not (vystrih == "" or vystrih == nil) then
  1258.                                 if smbMode then
  1259.                                     SMBpaste()
  1260.                                 else
  1261.                                     overit("/"..shell.dir().."/"..vystrih)
  1262.                                         if (q<=0) then
  1263.                                         fs.move("/C/system/RAM/cut/"..vystrih, "/"..shell.dir().."/"..vystrih)
  1264.                                         else
  1265.                                         fs.move("/C/system/RAM/cut/"..vystrih, "/"..shell.dir().."/"..vystrih.."("..q..")")
  1266.                                         end
  1267.                                         fs.delete("/C/system/RAM/cut/")
  1268.                                         end
  1269.                                 end
  1270.                                 vystrih = ""
  1271.                                 zpatky()
  1272.                             elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+3 and button == 1 and not (cesta[vyber] == nil) then
  1273.                                 new_menu.setCursorPos(1,4)
  1274.                                 new_menu.write "        "
  1275.                                 new_menu.setCursorPos(1,4)
  1276.                                 newName = read()
  1277.                                 pripona(cesta[vyber])
  1278.                                 oldKoncovka = "."..koncovka
  1279.                                 if koncovka == "" then
  1280.                                     fs.move("/"..shell.dir().."/"..cesta[vyber], "/"..shell.dir().."/"..newName)
  1281.                                 else
  1282.                                     pripona(newName)
  1283.                                     if koncovka == "" then
  1284.                                     fs.move("/"..shell.dir().."/"..cesta[vyber], "/"..shell.dir().."/"..newName..oldKoncovka)
  1285.                                     else
  1286.                                     fs.move("/"..shell.dir().."/"..cesta[vyber], "/"..shell.dir().."/"..newName)
  1287.                                     end
  1288.                                 end
  1289.                                
  1290.                                 zpatky()
  1291.                             elseif event == "mouse_click" then
  1292.                                 zpatky()
  1293.                             end
  1294.                         end
  1295.                 sleep(1)
  1296.                 zpatky()
  1297.                 elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+5 and button == 1 then
  1298.                 bgc(colors.lightGray)
  1299.                 if FileMenu and koncovka == "nfp" then
  1300.                 menu_win.setCursorPos(1,6)             
  1301.                 menu_win.write "·Set Backg"
  1302.                 sleep(anim)
  1303.                 local BarPath = "/C/system/Users/"..user.."/.Registry/bar.nfp"
  1304.                 if fs.exists(BarPath) then fs.delete(BarPath) end
  1305.                     if smbMode then
  1306.                     RunApp("/C/system/api/smbc.lua "..SMBserver.." copy "..SMBPath..cesta[vyber].." "..BarPath)
  1307.                     else
  1308.                     RunApp("copy "..cesta[vyber].." "..BarPath)
  1309.                     end
  1310.                 else
  1311.                 menu_win.setCursorPos(1,5)
  1312.                 menu_win.write " Code     "
  1313.                 menu_win.setCursorPos(1,6)
  1314.                 menu_win.write "          "
  1315.                 menu_win.setCursorPos(1,6)
  1316.                 kod = read()
  1317.                 menu_win.setCursorPos(1,5)
  1318.                 menu_win.write " Name     "
  1319.                 menu_win.setCursorPos(1,6)
  1320.                 menu_win.write "          "
  1321.                 menu_win.setCursorPos(1,6)
  1322.                 newName = read()
  1323.                 sleep(0.2)
  1324.                 downloading(kod, tostring(newName))
  1325.                 end
  1326.                 zpatky()
  1327.                 elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+6 and button == 1 then
  1328.                     menu_win.setCursorPos(1,7)
  1329.                     if not smbMode then
  1330.                     menu_win.write ("·Terminal ")
  1331.                     sleep(anim)
  1332.                     if not fs.exists("/C/system/api/commander.lua") then
  1333.                     downloading("LY8cUArW", "/C/system/api/commander.lua")
  1334.                     end
  1335.                     RunApp("/C/system/api/commander.lua")
  1336.                     else
  1337.                        
  1338.                         if (cesta[vyber] == nil and SMBPath == "/") then
  1339.                             local data = fs.open("/C/system/Users/"..user.."/.Registry/siteMap/"..SMBserver, "w")
  1340.                             data.writeLine(SMBserver)
  1341.                             data.writeLine("/")
  1342.                             menu_win.write ("·Connected ")
  1343.                         end
  1344.                                                
  1345.                         if (typ[vyber] == "folder") then
  1346.                            
  1347.                             local data = fs.open("/C/system/Users/"..user.."/.Registry/siteMap/"..cesta[vyber], "w")
  1348.                             data.writeLine(SMBserver)
  1349.                             data.writeLine(SMBPath..cesta[vyber])
  1350.                             data.close()
  1351.                             menu_win.write ("·Connected ")
  1352.                         end
  1353.                     end
  1354.                     sleep(anim*2)
  1355.                     zpatky()                   
  1356.                 elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+7 and button == 1 then
  1357.                 menu_win.setCursorPos(1,8)
  1358.                 if FileMenu and (koncovka == "lua" or koncovka == "txt") then
  1359.                     menu_win.write "·Print    "
  1360.                     sleep(0.2)
  1361.                     x = Xe
  1362.                     y = Ye
  1363.                     mrizka()
  1364.                     if not (cesta[vyber] == nil) then
  1365.                         if (typ[vyber] == "file") then
  1366.                         RunApp("/C/system/api/print.api "..shell.dir().."/"..cesta[vyber])
  1367.                         else
  1368.                         song("stop")
  1369.                         end
  1370.                     end
  1371.                 elseif shell.dir() == ("C/system/Users/"..user.."/Desktop") then
  1372.                     menu_win.write ("·Theme    ")
  1373.                     sleep(anim)
  1374.                     RunApp("/C/system/api/setting.lua appearance") 
  1375.                 else
  1376.                     menu_win.write ("·Setting  ")
  1377.                     sleep(anim)
  1378.                     RunApp("/C/system/api/setting.lua system") 
  1379.                 end
  1380.                 zpatky()
  1381.                 elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+3 and button == 1 then
  1382.                 menu_win.setCursorPos(1,4)
  1383.                 if not (cesta[vyber] == nil) then
  1384.                     if (trash) then
  1385.                     fs.delete(shell.dir().."/"..cesta[vyber])
  1386.                     menu_win.write "·Spill out"
  1387.                     song("trash")
  1388.                     trash = false
  1389.                     sleep(0.1)
  1390.                     plocha()
  1391.                     else
  1392.                     if smbMode then
  1393.                         SMBdelete()
  1394.                     else
  1395.                         overit("/C/system/Users/"..user.."/Desktop/_Trash/"..cesta[vyber])
  1396.                         if (q<=0) then
  1397.                         fs.move("/"..shell.dir().."/"..cesta[vyber], "/C/system/Users/"..user.."/Desktop/_Trash/"..cesta[vyber])
  1398.                         else
  1399.                         fs.move("/"..shell.dir().."/"..cesta[vyber], "/C/system/Users/"..user.."/Desktop/_Trash/"..cesta[vyber].."("..q..")")
  1400.                         end
  1401.                     end
  1402.                     menu_win.write "·Delete   "
  1403.                     sleep(0.1)
  1404.                     end
  1405.                 end
  1406.                 zpatky()
  1407.                 elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+2 and button == 1 then
  1408.                 menu_win.setCursorPos(1,3)
  1409.                 menu_win.write "·Open/Edit"
  1410.                 sleep(0.2)
  1411.                 x = Xe
  1412.                 y = Ye
  1413.                 mrizka()
  1414.                 if not (cesta[vyber] == nil) then
  1415.                     if (typ[vyber] == "file") then
  1416.                    
  1417.                     if smbMode then
  1418.                     SMBopenEdit ()
  1419.                     else
  1420.                     RunApp("edit "..cesta[vyber])
  1421.                     end
  1422.                    
  1423.                     elseif (typ[vyber] == "folder") then
  1424.                    
  1425.                         if smbMode then
  1426.                         os.startTimer(1)
  1427.                         pruzkumniksmb("//"..SMBserver..SMBPath..cesta[vyber])
  1428.                         else
  1429.                         pruzkumnik(typ[vyber])
  1430.                         end
  1431.                     end
  1432.                 end
  1433.                 zpatky()
  1434.                 elseif event == "mouse_click" then
  1435.                 trash = false
  1436.                 zpatky()
  1437.                 end
  1438.             end
  1439.         end
  1440.     end
  1441.    
  1442.     function logy(text)
  1443.         local data = fs.open("/log.txt", "w")
  1444.         data.writeLine(text)
  1445.         data.close()
  1446.    
  1447.     end
  1448.    
  1449.     function SMBnewFile(filename)
  1450.     RunApp("/C/system/api/smbc.lua "..SMBserver.." newFile "..SMBPath..filename)
  1451.     end
  1452.    
  1453.     function SMBnewFolder(foldername)
  1454.     RunApp("/C/system/api/smbc.lua "..SMBserver.." newFolder "..SMBPath..foldername)
  1455.     end
  1456.    
  1457.     function SMBrun ()
  1458.        
  1459.         RunApp("/C/system/api/smbc.lua "..SMBserver.." copy "..SMBPath..cesta[vyber].." /C/system/RAM/smbTemp/"..cesta[vyber])
  1460.         RunAppSpec("/C/system/RAM/smbTemp/"..cesta[vyber])
  1461.         RunApp("/C/system/api/smbc.lua "..SMBserver.." paste /C/system/RAM/smbTemp/"..cesta[vyber].." "..SMBPath..cesta[vyber])
  1462.         fs.delete(" /C/system/RAM/smbTemp")
  1463.         zpatky()
  1464.     end
  1465.    
  1466.     function SMBopenEdit ()
  1467.     RunApp("/C/system/api/smbc.lua "..SMBserver.." copy "..SMBPath..cesta[vyber].." /C/system/RAM/smbTemp/run.lua")
  1468.     RunApp("edit /C/system/RAM/smbTemp/run.lua")
  1469.     SMBdelete ()
  1470.     RunApp("/C/system/api/smbc.lua "..SMBserver.." paste /C/system/RAM/smbTemp/run.lua "..SMBPath..cesta[vyber])
  1471.     fs.delete(" /C/system/RAM/smbTemp/run.lua")
  1472.     zpatky()
  1473.     end
  1474.    
  1475.     function SMBdelete ()
  1476.     RunApp("/C/system/api/smbc.lua "..SMBserver.." delete "..SMBPath..cesta[vyber])
  1477.     end
  1478.    
  1479.     function SMBcopy()
  1480.     RunApp("/C/system/api/smbc.lua "..SMBserver.." copy "..SMBPath..cesta[vyber].." /C/system/RAM/cut/"..cesta[vyber])
  1481.     end
  1482.    
  1483.     function SMBcut()
  1484.     RunApp("/C/system/api/smbc.lua "..SMBserver.." cut "..SMBPath..cesta[vyber].." /C/system/RAM/cut/"..cesta[vyber])
  1485.     end
  1486.    
  1487.     function SMBpaste()
  1488.     RunApp("/C/system/api/smbc.lua "..SMBserver.." paste /C/system/RAM/cut/"..vystrih.." "..SMBPath..vystrih)
  1489.     end
  1490.    
  1491. function pozadiexp()
  1492.     local myWindow = window.create(term.current(),1,1,w,h-1)
  1493.     myWindow.setBackgroundColor(colors.white)
  1494.     myWindow.clear()
  1495.     paintutils.drawLine(1, 1, w, 1, BarPoz)
  1496.     bgc(colors.lightBlue)
  1497.     txc(colors.black)
  1498.     curs (2,1)
  1499.     write" UP "
  1500.     curs (7,1)
  1501.     write" This PC "
  1502.     paintutils.drawPixel (w,3, BarPoz)
  1503.     curs (w,3)
  1504.     write"^"
  1505.     paintutils.drawPixel (w,h-4, BarPoz)
  1506.     curs (w,h-4)
  1507.     write"v"
  1508.     txc(BarTxt)
  1509.     paintutils.drawPixel (w,1, colors.red)
  1510.     curs (w,1)
  1511.     write "×"
  1512.     curs (19,1)
  1513.     bgc(BarPoz)
  1514.     txc(BarTxt)
  1515.     write (#fs.list(shell.dir()))
  1516.     if ((#fs.list(shell.dir())) == 1) then
  1517.     write " Item"
  1518.     else
  1519.     write " Items"
  1520.     end
  1521.  
  1522.     if vyvoj then
  1523.     curs(w, h/2)
  1524.     write(cPage)
  1525.     end
  1526. end
  1527.  
  1528.  
  1529. function pruzkumniksmb(smbcesta)
  1530. if not (smbMode) then pruzkumnik() end
  1531.  
  1532.     if not fs.exists("/C/system/.core/defmodem") then song("stop")
  1533.     dialog(BarPoz,BarTxt, "Chyba site", "The modem is not ","configured!",false) smbMode = false plocha()
  1534.     elseif not fs.exists("/C/system/RAM/devices/modem.tmp") then song("stop")
  1535.     dialog(BarPoz,BarTxt, "Chyba site", "Modem not found!","",false) smbMode = false plocha()
  1536.     end
  1537.  
  1538. if not fs.exists("/C/system/api/smbc.lua") then
  1539.     if PastebinMode then
  1540.         downloading("gQVYieMJ", "/C/system/api/smbc.lua")
  1541.     else
  1542.         RunApp("wget https://devbin.dev/raw/CAn5MlRD /C/system/api/smbc.lua")
  1543.     end
  1544. end
  1545.  
  1546. local q = 3
  1547. local qmax = #smbcesta
  1548. if not (string.sub(smbcesta,qmax,qmax) == "/") then smbcesta = (smbcesta.."/") qmax = #smbcesta end
  1549.  
  1550.         repeat
  1551.             hledej = string.sub(smbcesta,q,q);
  1552.             q = q+1
  1553.             if (hledej=="/") then
  1554.                 SMBserver = string.sub(smbcesta,3,q-2)
  1555.                 SMBserverT = SMBserver
  1556.                 if tonumber(SMBserver) == nil then SMBserver = dns_check(SMBserver) end
  1557.                 if SMBserver == nil then return end
  1558.                 SMBPath = string.sub(smbcesta,q-1, qmax)
  1559.                 RunApp("/C/system/api/smbc.lua "..SMBserver.." signature ".. SMBPath)
  1560.                 q = qmax + 1
  1561.             end
  1562.         until q == qmax + 1
  1563.     zpet = "pruzkumniksmb"
  1564.     pozadiexp()
  1565.     song("folder")
  1566.     vypis()
  1567.    
  1568.     paintutils.drawLine(1, h-1, w, h-1, colors.lightGray)
  1569.     curs(1, h-1)
  1570.     write("//"..SMBserverT..SMBPath)
  1571.     lista()
  1572.    
  1573.         while true do
  1574.         if event == "timer" then os.startTimer(1) cas() end
  1575.         agentpruzkumnik()
  1576.         end
  1577.        
  1578. end
  1579.  
  1580.     local function UPAccess()
  1581.     local testString = ""
  1582.     if smbMode then testString =  ("//"..SMBserver..SMBPath) if testString == ("//"..SMBserver.."/") then pruzkumniksmb("//"..SMBserver) end else testString = "/"..shell.dir() end
  1583.  
  1584.     local q = #testString-1
  1585.         repeat
  1586.             hledej = string.sub(testString,q,q);
  1587.             q = q-1
  1588.             if (hledej=="/") then
  1589.             if smbMode then pruzkumniksmb(string.sub(testString,1,q+1)) else shell.run("cd "..string.sub(testString,1,q+1)) end
  1590.             q =0
  1591.         end
  1592.         until q == 0
  1593.     end
  1594.    
  1595. function pruzkumnik(pru)
  1596.  
  1597.  
  1598. zpatecka = shell.dir()
  1599.     if (pru == "") then
  1600.     pru = zpatecka
  1601.         if (pru == "/C/system/Users/"..user.."/Desktop/") then
  1602.         shell.run("cd /C/system/Users/"..user.."/Desktop/")
  1603.         desktop()
  1604.         end
  1605.     end
  1606.  
  1607. if pru ~= nil then shell.run("cd "..pru) end
  1608. if (smbMode) then pruzkumniksmb(smbcesta) end
  1609.    
  1610.     zpet = "pruzkumnik"
  1611.     pozadiexp()
  1612.     song("folder")
  1613.     vypis()
  1614.        
  1615.     paintutils.drawLine(1, h-1, w, h-1, colors.lightGray)
  1616.     curs(1, h-1)
  1617.     write("/"..shell.dir())
  1618.     lista()
  1619.      
  1620.     while true do
  1621.         if event == "timer" then os.startTimer(1) cas() end
  1622.         agentpruzkumnik()
  1623.         end
  1624. end
  1625.  
  1626. function agentpruzkumnik()
  1627.         kurzor()
  1628.     ------------------------------------------------------------------------------------- NEFUNGUJE        
  1629.             if event == "mouse_scroll" and p1 == -1 then
  1630.                 if (cPage >= 2) then
  1631.                     cPage = cPage - 1
  1632.                     pozadiexp()
  1633.                     vypis()
  1634.                 end
  1635.             elseif event == "mouse_scroll" and p1 == 1 then
  1636.                 if (cPage <= maxFil) then
  1637.                     cPage = cPage + 1
  1638.                     pozadiexp()
  1639.                     vypis()
  1640.                 end        
  1641.             elseif event == "mouse_click" and x == w and y == 1 and button == 1 then
  1642.             trash = false
  1643.             shell.run("cd /C/system/Users/"..user.."/Desktop/")
  1644.             cPage = 1
  1645.             desktop()
  1646.             elseif event == "key" and p1 == keys.q then
  1647.             trash = false
  1648.             shell.run("cd /C/system/Users/"..user.."/Desktop/")
  1649.             cPage = 1
  1650.             desktop()
  1651.             elseif event == "key" and p1 == keys.backspace then
  1652.                 UPAccess()
  1653.                 pruzkumnik()
  1654.             elseif event == "mouse_click" and x >= 2 and x<=5 and y == 1 and button == 1 then
  1655.                 UPAccess()
  1656.                 bgc(colors.lightGray)
  1657.                 txc(colors.black)
  1658.                 curs (2,1)
  1659.                 write" UP "
  1660.                 zpatecka = shell.dir()
  1661.                 sleep(anim)
  1662.                 pruzkumnik()
  1663.             elseif event == "mouse_click" and x >= 7 and x<=15 and y == 1 and button == 1 then
  1664.                 bgc(colors.lightGray)
  1665.                 txc(colors.black)
  1666.                 curs (7,1)
  1667.                 write" This PC "
  1668.                 sleep(anim)
  1669.                 thisPC()
  1670.             elseif event == "mouse_click" and x == w and y == 3 and button == 1 then
  1671.                 if (cPage >= 2) then
  1672.                 cPage = cPage - 1
  1673.                 pozadiexp()
  1674.                 vypis()
  1675.                 end
  1676.             elseif event == "mouse_click" and x == w and y == h-4 and button == 1 then
  1677.                 if (cPage <= maxFil) then
  1678.                 cPage = cPage + 1
  1679.                 pozadiexp()
  1680.                 vypis()
  1681.                 end
  1682.             elseif event == "mouse_click" and y == h-1 and button == 1 then
  1683.             paintutils.drawLine(1, h-1, w, h-1, colors.gray)
  1684.             txc(colors.white)
  1685.             curs(1, h-1)
  1686.             nova_cesta = read()
  1687.                 if (string.sub(nova_cesta,1,2)=="//") then
  1688.                     smbMode = true
  1689.                     os.startTimer(1)
  1690.                     pruzkumniksmb(nova_cesta)
  1691.                     else
  1692.                     smbMode = false
  1693.                     shell.run("cd "..nova_cesta)
  1694.                     pruzkumnik()
  1695.                 end
  1696.             end
  1697. end
  1698.  
  1699. function diskCheck()
  1700.     repeat
  1701.   d = d + 1
  1702.     until not fs.exists("/disk"..d)
  1703.     d = d-1
  1704.    
  1705.     if d > 5 then d = 5 end
  1706.    
  1707.     for k = 2,d do
  1708.     x = diskPos[k][1]
  1709.     y = diskPos[k][2]
  1710.     curs (x,y)
  1711.     if k<10 then
  1712.     write(" Disk "..k..":/ ")
  1713.     else
  1714.     write(" Disk "..k..":/")
  1715.     end
  1716.     end
  1717.     return
  1718. end
  1719.  
  1720. function icona (px,py,bar,tbar, text) bgc(bar) txc(tbar) curs (px,py) write"  " curs (px,py+1 ) write"      " curs (px,py+2 ) write"      " bgc(1) curs (px,py+3) write(text) end
  1721.  
  1722.  function openShareFolder(Sfolder)
  1723.    
  1724.     if fs.exists("/C/system/Users/"..user.."/.Registry/siteMap/"..Sfolder) then
  1725.         local data = fs.open("/C/system/Users/"..user.."/.Registry/siteMap/"..Sfolder, "r")
  1726.         SMBserver = data.readLine()
  1727.         SMBPath = data.readLine()
  1728.         data.close()
  1729.         smbMode=true
  1730.         pruzkumniksmb("//"..SMBserver..SMBPath)
  1731.     end
  1732. end
  1733.                                
  1734. function thisPC()
  1735.     smbMode = false
  1736.     paintutils.drawLine(1, 1, w, 1, BarPoz)
  1737.     barW = window.create(term.current(),1,2,10,1)
  1738.     barW.setBackgroundColor(colors.gray)
  1739.     barW.clear()
  1740.     barW.setTextColor(1)
  1741.     barW.setCursorPos(2,1)
  1742.     barW.write"This PC >"
  1743.     paintutils.drawPixel (w,1, colors.red)
  1744.     txc(BarTxt)
  1745.     curs (w,1)
  1746.     write "×"
  1747.     local myWindow = window.create(term.current(),1,3,10,h-1) myWindow.setBackgroundColor(BarPoz) myWindow.clear()
  1748.     local myWindow = window.create(term.current(),11,2,w,h-1) myWindow.setBackgroundColor(colors.white) myWindow.clear()
  1749.     icona (13,3,8192,32768," Data ")
  1750.     if ServerMode then icona (23,3,2,32768," Svcs ") icona (33,3,16,32768," SrvF ") end
  1751.     txc(1) bgc(BarPoz) curs (1,5)
  1752.     write"- Setting"
  1753.     curs (1,7)
  1754.     write"- Desktop"
  1755.     curs (13,10)
  1756.     write" Disk C:/ "
  1757.         d = 0
  1758.     if fs.exists("/disk") then
  1759.         d = 1
  1760.         curs (26,10)
  1761.         write(" Disk 1:/ ")
  1762.         diskCheck()
  1763.     end
  1764.  
  1765.     bgc(1)
  1766.     txc(colors.black)
  1767.  
  1768.     curs(12,8)
  1769.     write("Devices and drivers ("..(1+d)..")")
  1770.  if fs.exists("/C/system/Users/"..user.."/.Registry/siteMap/") then
  1771.     cSfolder = fs.list("/C/system/Users/"..user.."/.Registry/siteMap/")
  1772.    
  1773.     SfolderPos = {
  1774.   [1] = {13,15},
  1775.   [2] = {21,15},
  1776.   [3] = {29,15},
  1777.   [4] = {37,15},
  1778.   [5] = {45,15},
  1779. }
  1780.  
  1781.     if #cSfolder > 0 then
  1782.     curs(12,14)
  1783.     write("Network folders ("..#cSfolder..")")
  1784.    
  1785.     for i=1,5 do
  1786.     if cSfolder[i] ~= nil then icona (SfolderPos[i][1],SfolderPos[i][2],2,32768,cSfolder[i]) end
  1787.     end
  1788.     end
  1789.     end
  1790.    
  1791.     lista()
  1792.      
  1793.     while true do
  1794.      
  1795.             event, p1, p2,p3 = os.pullEvent()
  1796.             button = p1 x = p2 y = p3
  1797.            
  1798.             if event == "timer" then os.startTimer(1) cas() end
  1799.                
  1800.                 if x == w and y == 1 and button == 1 then plocha ()
  1801.                 elseif event == "key" and p1 == keys.q then plocha()
  1802.                 elseif event == "mouse_click" and button == 1 then
  1803.                             os.startTimer(1)
  1804.                             if  x >= 13 and x <= 18 and y >= 3 and y <= 5 then
  1805.                                 pruzkumnik("/C/system/Users/"..user)
  1806.                             elseif  x >= 23 and x <= 28 and y >= 3 and y <= 5 and ServerMode then
  1807.                                 pruzkumnik("/C/Service/")
  1808.                             elseif  x >= 33 and x <= 38 and y >= 3 and y <= 5 and ServerMode then
  1809.                                 pruzkumnik("/C/system/server")
  1810.                             elseif  x >= 1 and x <= 12 and y == h then
  1811.                                 menu ()
  1812.                             elseif x >= 1 and x <= 10 and y == 5 then
  1813.                                 cbarva()
  1814.                                 curs (1,5)
  1815.                                 write"- Setting"
  1816.                                 sleep(0.1)
  1817.                                 RunApp("/C/setting")
  1818.                             elseif x >= 1 and x <= 10 and y == 7 then
  1819.                                 cbarva()
  1820.                                 curs (1,7)
  1821.                                 write"- Desktop"
  1822.                                 sleep(0.1)
  1823.                                 plocha()
  1824.                             elseif x >= 13 and x <= 23 and y == 10 then
  1825.                                 cbarva()
  1826.                                 curs (13,10)
  1827.                                 write" Disk C:/ "
  1828.                                 sleep(0.1)
  1829.                                 RunApp("cd /C")
  1830.                                 pruzkumnik()
  1831.                             elseif x >= 10 and x <= w and y >= h/2 and y <= h-1 then
  1832.                                 if x >= 26 and x <= 36 and y == 10 then
  1833.                                 k = 1
  1834.                                 elseif x >= 39 and x <= 49 and y == 10 then
  1835.                                 k = 2
  1836.                                 elseif x >= 13 and x <= 23 and y == 12 then
  1837.                                 k = 3
  1838.                                 elseif x >= 26 and x <= 36 and y == 12 then
  1839.                                 k = 4
  1840.                                 elseif x >= 39 and x <= 49 and y == 12 then
  1841.                                 k = 5
  1842.                                 else
  1843.                                 thisPC()
  1844.                                 end
  1845.                             elseif x >= 13 and x <= 18 and y >= 15 and y <= 17 then
  1846.                                 openShareFolder(cSfolder[1])
  1847.                                 os.reboot()
  1848.                                 elseif x >= 21 and x <= 26 and y >= 15 and y <= 17 then
  1849.                                 openShareFolder(cSfolder[2])
  1850.                                 elseif x >= 29 and x <= 35 and y >= 15 and y <= 17 then
  1851.                                 openShareFolder(cSfolder[3])
  1852.                                 elseif x >= 37 and x <= 43 and y >= 15 and y <= 17 then
  1853.                                 openShareFolder(cSfolder[4])
  1854.                                 elseif x >= 45 and x <= 50 and y >= 15 and y <= 17 then
  1855.                                 openShareFolder(cSfolder[5])
  1856.                             end
  1857.                                
  1858.                                 function seldisk()
  1859.                                     cbarva()
  1860.                                     x = diskPos[k][1]
  1861.                                     y = diskPos[k][2]
  1862.                                     curs (x,y)
  1863.                                     if k<10 then
  1864.                                         write(" Disk "..k..":/ ")
  1865.                                     else
  1866.                                         write(" Disk "..k..":/")
  1867.                                     end
  1868.                                     sleep(0.1)
  1869.                                 end
  1870.                                    
  1871.                                     if k==1 then
  1872.                                         if fs.exists("/disk") then
  1873.                                             seldisk()
  1874.                                             shell.run("cd /disk")
  1875.                                             pruzkumnik()
  1876.                                         end
  1877.                                     else
  1878.                                         if fs.exists("/disk"..k) then
  1879.                                             seldisk()
  1880.                                             shell.run("cd /disk"..k)
  1881.                                             pruzkumnik()
  1882.                                         end
  1883.                                     end
  1884.                 else
  1885.                     thisPC()
  1886.                 end
  1887.                
  1888.         end
  1889. end
  1890.  
  1891. function whimage(Iuser)
  1892.     bgc(colors.lightBlue)
  1893.     term.clear()
  1894.     local data = fs.open("/C/system/Users/"..Iuser.."/.Registry/bar.nfp", "r")
  1895.         local i = 0
  1896.         local mw = 0
  1897.         local mh = {}
  1898.         repeat
  1899.         i = i+1
  1900.         mh[i] = data.readLine()
  1901.         until mh[i] == nil
  1902.     data.close()
  1903.     for i=1, #mh do if #mh[i] > mw then mw = #mh[i] end end
  1904.     local image = paintutils.loadImage("/C/system/Users/"..Iuser.."/.Registry/bar.nfp")
  1905.     w, h = term.getSize()
  1906.     paintutils.drawImage(image, w/2-mw/2+1, h/2-#mh/2+1)
  1907. end
  1908.    
  1909. function plocha()
  1910. checkBarva()
  1911. smbMode = false
  1912. lista()
  1913. zpet = "plocha"
  1914. w, h = term.getSize()
  1915. nPage = 1
  1916.  
  1917. if fs.exists ("/C/system/Users/"..user.."/.Registry/.menuColor") then BMenu = (BarPoz) Btextmenu = (BarTxt) CCM = true else CCM = false BMenu = (colors.gray) Btextmenu = (colors.white) end
  1918.  
  1919.     if fs.exists ("/C/system/Users/"..user.."/.Registry/bar.nfp") then
  1920.         whimage(user)
  1921.     else
  1922.         if (h == 19) and (w == 51) then
  1923.             computerMode = 1
  1924.             bgc(colors.black)
  1925.             term.clear ()
  1926.         elseif ServerMode then
  1927.             computerMode = 1
  1928.             bgc(colors.cyan)
  1929.             term.clear ()
  1930.         elseif (h == 20) and (w == 26) then
  1931.             computerMode = 2
  1932.             bgc(colors.lightBlue)
  1933.             term.clear ()
  1934.             paintutils.drawImage(image, (w/2)-25, (h/2)-9)    
  1935.         else
  1936.             computerMode = 0
  1937.             bgc(colors.lightBlue)
  1938.             term.clear ()
  1939.         end
  1940.        
  1941.         if fs.exists("/C/system/.core/display") then ExDisplay = true else ExDisplay = false end
  1942.  
  1943.         if ServerMode then
  1944.             local myWindow = window.create(term.current(),1,1,w,h)
  1945.             myWindow.setBackgroundColor(colors.cyan)
  1946.             myWindow.clear()
  1947.             myWindow.setTextColor(colors.white)
  1948.             myWindow.setCursorPos(w-19,h-1)
  1949.             myWindow.setBackgroundColor(colors.cyan)
  1950.             myWindow.write("Pepdroll 7 Server R1")
  1951.         else
  1952.             local myWindow = window.create(term.current(),1,1,w,h)
  1953.             if (user == "pepeksoft") then
  1954.             myWindow.setBackgroundColor(colors.cyan)
  1955.             else
  1956.                     local colorPath = ("/C/system/Users/"..user.."/.Registry/.BackgroundColor")
  1957.                     if fs.exists(colorPath) then
  1958.                     local data =fs.open(colorPath, "r")
  1959.                     myWindow.setBackgroundColor(tonumber(data.readAll()))
  1960.                     data.close()
  1961.                 else
  1962.                     myWindow.setBackgroundColor(colors.black)
  1963.                 end
  1964.             end
  1965.             myWindow.clear()
  1966.             myWindow.setTextColor(colors.white)
  1967.             myWindow.setCursorPos(w-(#("Pepdroll 7 "..edice))+1,h-1)
  1968.             myWindow.write ("Pepdroll 7 "..edice)
  1969.             myWindow.setCursorPos(1,5)
  1970.         end
  1971.     end
  1972.  
  1973. if vyvoj then
  1974. vyvinfo()
  1975. end
  1976. ----------- ikony
  1977. if not fs.exists("/C/system/Users/"..user.."/Desktop/.folder") then
  1978. local create_folder = fs.open("/C/system/Users/"..user.."/Desktop/.folder","w")
  1979. create_folder.close()
  1980. fs.delete("/C/system/Users/"..user.."/Desktop/.folder")
  1981. end
  1982. shell.run("cd /C/system/Users/"..user.."/Desktop/")
  1983.    
  1984.     if not fs.exists("/C/system/Users/"..user.."/Desktop/_Trash") then
  1985.         fs.makeDir("/C/system/Users/"..user.."/Desktop/_Trash")
  1986.     end
  1987.    
  1988. vypis()
  1989.  
  1990. while true do
  1991. x,y = term.getSize()
  1992. os.startTimer(1)
  1993.  
  1994. if event == "mouse_click" then
  1995.         mrizka()
  1996.         end
  1997.        
  1998. if ServerMode and fs.exists("/C/system/RAM/shutdown.pdr") then
  1999.     vypnout()
  2000. end
  2001. oldW = w
  2002. oldH = h
  2003. w, h = term.getSize()
  2004.  
  2005. if oldW ~= w or oldH ~= h then
  2006. plocha()
  2007. end
  2008.  
  2009. panel()
  2010.  
  2011.     end
  2012. end
  2013.  
  2014. function defaultMenu()
  2015.     local data = fs.open ("/C/system/Users/"..user.."/.Registry/lsprogram", "w")
  2016.     if ServerMode then
  2017.         data.writeLine("Server Manager")
  2018.         data.writeLine("/C/Programs/PepekSoft/smanager.lua")
  2019.         else
  2020.         data.writeLine("")
  2021.         data.writeLine("")
  2022.     end
  2023.     for i=1, 8 do
  2024.     data.writeLine("")
  2025.     end
  2026.     data.writeLine("Setting")
  2027.     data.writeLine("/C/system/api/setting.lua")
  2028.     data.close ()
  2029. end
  2030.  
  2031. local mName = {}
  2032. local mPath = {}
  2033.  
  2034. function changeMenu()
  2035.         local data = fs.open ("/C/system/Users/"..user.."/.Registry/lsprogram", "w")
  2036.             for i=1, 6 do
  2037.             data.writeLine(mName[i])
  2038.             data.writeLine(mPath[i])
  2039.             end
  2040.         data.close()
  2041. end
  2042.  
  2043. function downProg(name, path)
  2044.     if (name == "Server Manager") then
  2045.         downloading("z02yAN3M", path)
  2046.     elseif (name == "Setting") then
  2047.         downloading("vxJjQzem", path)
  2048.     elseif (name == "Program Manager") then
  2049.         downloading("5eSpGpGa", path)
  2050.     elseif (name == "Help") then
  2051.         downloading("LcUc1VTZ", path)
  2052.     end
  2053. end
  2054.  
  2055. function checkBarva()
  2056. if fs.exists ("/C/system/Users/"..user.."/.Registry/.menuColor") then BPozadi = (BarPoz) Btext = (BarTxt) CCM = true else CCM = false BPozadi = (colors.gray) Btext = (colors.white) end
  2057. end
  2058.  
  2059. function menu()
  2060.  
  2061.     if fs.exists("/C/system/Users/"..user.."/.Registry/.disableAnim") then Anim = false end
  2062.    
  2063.     local function cmdAccess(pr)
  2064.             prikaz = pr
  2065.             nabidka.setBackgroundColor(colors.lightGray)
  2066.             nabidka.setTextColor(colors.white)
  2067.             shell.run("cd /C/")
  2068.             nabidka.setCursorPos(1,12)
  2069.             nabidka.write "                "
  2070.             nabidka.setCursorPos(1,12)
  2071.             bgc(colors.lightGray)
  2072.             if prikaz == nil then prikaz = read() else write(lastprikaz) end
  2073.             lastprikaz = prikaz
  2074.            
  2075.             if prikaz == "version" then nabidka.setCursorPos(1,12) nabidka.setBackgroundColor(colors.lightGray) nabidka.setTextColor(colors.white) lastprikaz = (verze) menu()
  2076.             elseif prikaz == "explorer" then thisPC()
  2077.             elseif string.sub(prikaz,1,2) == "//" then smbMode = true os.startTimer(1) pruzkumniksmb(prikaz)
  2078.             elseif string.sub(prikaz,1,1) == "/" then shell.run("cd "..prikaz) pruzkumnik()
  2079.             elseif prikaz == "logout" then logout()
  2080.             else
  2081.                 local data = fs.open("/C/system/RAM/back.tmp", "w")
  2082.                 data.writeLine(zpatecka)
  2083.                 data.close()
  2084.                 spustitprikaz()
  2085.             end
  2086.                 zpatky()
  2087.     end
  2088.    
  2089. w, h = term.getSize()
  2090. mNameNew =""
  2091. mPathNew =""
  2092.  
  2093. if not fs.exists ("/C/system/Users/"..user.."/.Registry/lsprogram") then defaultMenu() end
  2094.  
  2095. customMenu = false
  2096. checkBarva()
  2097.    
  2098.     if Anim then for i=1, 12 do paintutils.drawLine(1, h-i, 17, h-i, BPozadi) sleep(0.05) end end
  2099.            
  2100.     nabidka = window.create(term.current(),1,h-12,17,h)
  2101.     nabidka.setBackgroundColor(BPozadi)
  2102.     nabidka.clear()
  2103.     nabidka.setTextColor(Btext)
  2104.     nabidka.setCursorPos(17,12)
  2105.     nabidka.write ">"
  2106.     nabidka.setCursorPos(math.ceil((17-#user)/2),1)
  2107.     nabidka.write(user)
  2108.     nabidka.setCursorPos(2,13)
  2109.     nabidka.write "Power"
  2110.    
  2111.    if fs.exists ("/C/system/Users/"..user.."/.Registry/lsprogram") then
  2112.        local data = fs.open ("/C/system/Users/"..user.."/.Registry/lsprogram", "r")
  2113.            for i=1, 6 do
  2114.             mName[i] = data.readLine()
  2115.             mPath[i] = data.readLine()
  2116.             nabidka.setCursorPos(1,i+4)
  2117.             if fs.exists(mPath[i]) then
  2118.             nabidka.setTextColor(Btext)
  2119.             else
  2120.             nabidka.setTextColor(colors.red)
  2121.             end
  2122.             nabidka.write(mName[i])
  2123.            end
  2124.        data.close()
  2125.     else
  2126.     for i=1, 7 do
  2127.     mName[i] = ""
  2128.     mPath[i] = ""
  2129.     end
  2130.    end
  2131.    
  2132.     if not CCM then nabidka.setTextColor(colors.lightGray) else nabidka.setTextColor(Btext) end
  2133.     nabidka.setCursorPos(1,2)
  2134.     nabidka.write  "-> This PC"
  2135.     nabidka.setCursorPos(1,11)
  2136.     nabidka.write  "-> Managment"
  2137.     nabidka.setCursorPos(1,3)
  2138.     --nabidka.write  "Apps            >"
  2139.     nabidka.setCursorPos(1,12)
  2140.     nabidka.setBackgroundColor(colors.white)
  2141.     txc(colors.lightGray)
  2142.     nabidka.write "                "
  2143.     nabidka.setCursorPos(1,12)
  2144.     nabidka.setBackgroundColor(colors.white)
  2145.     nabidka.setTextColor(colors.lightGray)
  2146.     nabidka.write (lastprikaz)
  2147.     nabidka.setBackgroundColor(colors.gray)
  2148.    
  2149.     while true do
  2150.     event, p1, p2,p3 = os.pullEvent()
  2151.     button = p1
  2152.     x = p2
  2153.     y = p3
  2154.          
  2155.          if event == "timer" then os.startTimer(1) cas() end
  2156.          
  2157.         if event == "mouse_click" and x >= 1 and x <= 17 and y >= h-8 and y <= h-3 then
  2158.         if x>8 then PosX = 8 else PosX = x end
  2159.         PosY = y
  2160.        
  2161.         y=(y-h)+9
  2162.             if (button == 1) and (#mName[y]>=1) then
  2163.                 nabidka.setBackgroundColor(colors.lightGray)
  2164.                 nabidka.setCursorPos(1,y+4)
  2165.                 nabidka.write("                 ")
  2166.                 nabidka.setCursorPos(1,y+4)
  2167.                 nabidka.setTextColor(colors.gray)
  2168.                 nabidka.write(mName[y])
  2169.                 sleep(anim)
  2170.                 if not fs.exists(mPath[y]) then downProg(mName[y], mPath[y]) end               
  2171.                 RunApp(mPath[y])
  2172.                 plocha()
  2173.             elseif (button == 2) then
  2174.                 local nab_win = window.create(term.current(),PosX,PosY-1,10,3)
  2175.                 nab_win.setBackgroundColor(colors.lightGray)
  2176.                 nab_win.clear()
  2177.                 nab_win.setCursorPos(2,1)
  2178.                 nab_win.write"Rename"
  2179.                 nab_win.setCursorPos(1,2)
  2180.                 nab_win.write"Add/Change"
  2181.                 nab_win.setCursorPos(2,3)
  2182.                 nab_win.write"Delete"
  2183.                 nab_win.setBackgroundColor(colors.lightBlue)
  2184.            
  2185.                 while true do
  2186.                     local event, button, x, y = os.pullEvent("mouse_click")
  2187.                    
  2188.                     if x >= PosX and x <= PosX+10 and y == PosY-1 and button == 1 then
  2189.                     nab_win.setCursorPos(1,1)
  2190.                     nab_win.write" Rename   "
  2191.                     sleep(anim)
  2192.                     nab_win.setBackgroundColor(colors.lightGray)
  2193.                     nab_win.setCursorPos(1,1)
  2194.                     nab_win.write" New name "
  2195.                     bgc(colors.lightBlue)
  2196.                     txc(colors.black)
  2197.                     curs(1,y+1)
  2198.                     term.write "                 "
  2199.                     curs(1,y+1)
  2200.                     mNameNew = read()
  2201.                     y=(y-h)+10
  2202.                     if (#mNameNew >=1) then
  2203.                     mName[y] = mNameNew
  2204.                     changeMenu()
  2205.                     end
  2206.                     menu()
  2207.                     elseif x >= PosX and x <= PosX+10 and y == PosY and button == 1 then
  2208.                     nab_win.setCursorPos(1,2)
  2209.                     nab_win.write"Add/Change"
  2210.                     y=(y-h)+9
  2211.                         if (#mName[y] <1) then
  2212.                             nab_win.setBackgroundColor(colors.lightGray)
  2213.                             nab_win.setCursorPos(1,1)
  2214.                             nab_win.write" New Name "
  2215.                             bgc(colors.lightBlue)
  2216.                             txc(colors.black)
  2217.                             curs(1,PosY)
  2218.                             term.write "                 "
  2219.                             curs(1,PosY)
  2220.                             mNameNew = read()
  2221.                         end
  2222.                         nab_win.setBackgroundColor(colors.lightGray)
  2223.                         nab_win.setCursorPos(1,1)
  2224.                         nab_win.write" New Path "
  2225.                         bgc(colors.lightBlue)
  2226.                         txc(colors.black)
  2227.                         curs(1,PosY)
  2228.                         term.write "/                "
  2229.                         curs(2,PosY)
  2230.                         mPathNew = "/"..read()
  2231.                        
  2232.                         if (#mPathNew > 1) then
  2233.                         mPath[y] = mPathNew
  2234.                         changeMenu()
  2235.                         end
  2236.                        
  2237.                         if (#mNameNew > 1) then
  2238.                         mName[y] = mNameNew
  2239.                         changeMenu()
  2240.                         end
  2241.                     sleep(anim)
  2242.                     menu()
  2243.                     elseif x >= PosX and x <= PosX+10 and y == PosY+1 and button == 1 then
  2244.                     nab_win.setCursorPos(1,3)
  2245.                     nab_win.write" Delete   "
  2246.                     sleep(anim)
  2247.                     y=(y-h)+9
  2248.                     mPath[y] = ""
  2249.                     mName[y] = ""
  2250.                     changeMenu()
  2251.                     menu()
  2252.                     else
  2253.                     menu()
  2254.                     end
  2255.                    
  2256.                 end
  2257.             end
  2258.         menu()
  2259.         elseif event == "mouse_click" and x >= 1 and x <= 6 and y == h and button == 1 then -- vypnout
  2260.             nabidka.setTextColor(colors.lightGray)
  2261.             nabidka.setCursorPos(2,13)
  2262.             nabidka.write "Power"
  2263.             sleep(anim)
  2264.             power()
  2265.         elseif event == "mouse_click" and x >= 1 and x <= 17 and y == h-2 and button == 1 then
  2266.             cbarva()
  2267.             curs(1,h-2)
  2268.             write  "-> Managment     "
  2269.             sleep(anim)
  2270.             RunApp("/C/setting")
  2271.             zpatky()
  2272.         elseif event == "mouse_click" and x >= 1 and x <= 17 and y == h-11 and button == 1 then
  2273.             cbarva()
  2274.             curs(1,h-11)
  2275.             write  "-> This PC       "
  2276.             sleep(0.1)
  2277.             thisPC()
  2278.         --elseif event == "mouse_click" and x >= 1 and x <= 17 and y == h-10 and button == 1 then
  2279.          --   cbarva()
  2280.            -- curs(1,h-10)
  2281.             --write  "Apps            >"
  2282.             --sleep(0.1)
  2283.             --aplikace()
  2284.             --APIS.Aplikace()
  2285.             --plocha()
  2286.         elseif event == "mouse_click" and x >= 1 and x <= 17 and y == h-11 and button == 2 then
  2287.             cbarva()
  2288.             curs(1,h-11)
  2289.             write  "-> This PC       "
  2290.             sleep(0.1)
  2291.             local tp = fs.open("/C/system/Users/"..user.."/Desktop/This PC.src", "w")
  2292.             tp.close()
  2293.             plocha()
  2294.         elseif event == "mouse_click" and x >= 1 and x <= 16 and y == h-1 and button == 1 then cmdAccess()
  2295.         elseif event == "mouse_click" and x == 17 and y == h-1 and button == 1 then cmdAccess(lastprikaz)
  2296.         elseif event == "key" then cmdAccess()
  2297.         elseif event == "mouse_click" then zpatky()
  2298.        end
  2299.     end
  2300. end
  2301.  
  2302. function aplikace()
  2303. checkBarva()
  2304. local aDir = {}
  2305. local apDir = {}
  2306. local ap = 0
  2307.     if fs.exists("/C/Programs/") then
  2308.     aDir = fs.list("/C/Programs/")
  2309.    
  2310.     for i=1,#aDir do
  2311.             if not fs.isDir("/C/Programs/"..aDir[i]) then
  2312.                 if string.sub(aDir[i],1) ~= "." then
  2313.                 local cislo = string.find(aDir[i],".",-5)
  2314.                 ap= ap+1
  2315.                 apDir[ap] = (string.sub(aDir[i],1,cislo) )
  2316.             end
  2317.         end
  2318.     end
  2319.     else return
  2320.     end
  2321.  
  2322. local AppW = window.create(term.current(),18,(h-10)-((#apDir+1)/2),14,#apDir+3)
  2323.         AppW.setBackgroundColor(BPozadi)
  2324.         AppW.setTextColor(Btext)
  2325.         AppW.clear()
  2326.         AppW.setCursorPos(2,1)
  2327.         AppW.write("Applications")
  2328.         for i=1, #apDir do
  2329.         AppW.setCursorPos(2,i+2)
  2330.         AppW.write(apDir[i])
  2331.         end
  2332.         AppW.setCursorPos(2,#apDir+3)
  2333.         AppW.write("Store")
  2334.  
  2335.     while true do
  2336.         local event, button, x, y = os.pullEvent("mouse_click")
  2337.    
  2338.         if event == "mouse_click" and button == 1 then
  2339.         plocha()
  2340.         end
  2341.     end
  2342.  
  2343.  
  2344. end
  2345.  
  2346. function power()
  2347.         txc(colors.white)
  2348.         local myWindow = window.create(term.current(),2,h-1,8,h)
  2349.         myWindow.setBackgroundColor(colors.lightGray)
  2350.         myWindow.clear()
  2351.         bgc(colors.lightGray)
  2352.         curs(2,h-6)
  2353.         write "          "
  2354.         curs(2,h-5)
  2355.         write " Switch   "
  2356.         curs(2,h-4)
  2357.         write " Log Out  "
  2358.         curs(2,h-3)
  2359.         write "          "
  2360.         curs(2,h-2)
  2361.         write " Sleep    "
  2362.         curs(2,h-1)
  2363.         write " Restart  "
  2364.         curs(2,h)
  2365.         write " Shutdown "
  2366.        
  2367.             while true do
  2368.             local event, button, x, y = os.pullEvent("mouse_click")
  2369.    
  2370.                 if (x >= 1 and x <= 10 and y == h-2) and (button == 1 or button == 2)then
  2371.                 spanek ()
  2372.                 elseif (x >= 1 and x <= 10 and y == h-1) and (button == 1 or button == 2)then
  2373.                 restart ()
  2374.                 elseif (x >= 1 and x <= 10 and y == h) and (button == 1 or button == 2)then
  2375.                 vypnout ()
  2376.                 elseif (x >= 1 and x <= 10 and y == h-5) and (button == 1 or button == 2)then
  2377.                     if ADC then
  2378.                     synchronizace()
  2379.                     end
  2380.                 local data = fs.open ("/C/system/RAM/logout", "w")
  2381.                 song("logout")
  2382.                 data.close ()
  2383.                 error()
  2384.                 elseif (x >= 1 and x <= 10 and y == h-4) and (button == 1 or button == 2)then
  2385.                 fs.delete ("/C/system/RAM"..user)
  2386.                 logout()
  2387.                 else
  2388.                 menu()    
  2389.                 end
  2390.             end
  2391.         desktop()
  2392. end
  2393.  
  2394. function spanek ()
  2395.     bgc(colors.lightGray)
  2396.     term.clear()
  2397.     sleep (0.1)
  2398.     bgc(colors.gray)
  2399.     term.clear()
  2400.     sleep (0.1)
  2401.     bgc(colors.black)
  2402.     txc(colors.black)
  2403.     term.clear()
  2404.    
  2405.     while true do
  2406.           local event, button, xPos, yPos = os.pullEvent()
  2407.           desktop ()
  2408.     end
  2409. end
  2410.  
  2411. function logout ()
  2412. bgc(colors.lightGray)
  2413. term.clear()
  2414. sleep (0.1)
  2415. bgc(colors.gray)
  2416. term.clear()
  2417. sleep (0.1)
  2418. bgc(colors.white)
  2419. txc(colors.black)
  2420. term.clear()
  2421. curs(w-28, h-12)
  2422. prc "Logging out..."
  2423. bgc(colors.white)
  2424. txc(colors.blue)
  2425. curs(w/2-5,h-1)
  2426. write "  Pepek"
  2427. curs(w/2+3,h-1)
  2428. write "Soft  "
  2429. curs(w/2+2,h-1)
  2430. txc(colors.lime)
  2431. write "@"
  2432. song("shutdown")
  2433. sleep (0.5)
  2434. local data = fs.open ("/C/system/RAM/logout", "w")
  2435. data.close ()
  2436. error()
  2437. end
  2438.  
  2439. function vypnout()
  2440. RunApp("/startup.lua shutdown")
  2441. end
  2442.  
  2443. function restart()
  2444. RunApp("/startup.lua reboot")
  2445. end
  2446.  
  2447. desktop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement