pepeknamornik

Samba2021

Mar 27th, 2020 (edited)
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.17 KB | None | 0 0
  1. local verze = "21.0628.R3"
  2. local anim = 0.1
  3. local RamCesta = ("/C/system/RAM/SMB")
  4. local w, h = term.getSize()
  5. ----------------------------------------------------
  6. local f=fs.open("/C/system/RAM/user","r")
  7. user=f.readLine()
  8. pass=f.readLine()
  9. Fname=f.readLine()
  10. Lname=f.readLine()
  11. f.close()
  12.  
  13. local function Barvy()
  14.     if fs.exists ("/C/system/Users/"..user.."/.Registry/colors") then
  15.     local data = fs.open("/C/system/Users/"..user.."/.Registry/colors", "r")
  16.     BarPoz = tonumber(data.readLine())
  17.     BarTxt = tonumber(data.readLine())
  18.     data.close()
  19.     end
  20.     if BarPoz == nil or BarTxt == nil then BarPoz = 2048 BarTxt = 1 end
  21. end
  22.  
  23. function ukonceni ()
  24.     fs.delete (RamCesta)
  25.     os.exit()
  26. end
  27.  
  28. function cbarva()
  29. lista.setTextColor(colors.black)
  30. lista.setBackgroundColor(colors.gray)
  31. end
  32.  
  33. function defaultvalue()
  34. end
  35.  
  36. function start()
  37. defaultvalue()
  38. Barvy()
  39. local myWindow = window.create(term.current(),w/2-11,h/2-5,25,9)
  40. myWindow.setBackgroundColor(colors.yellow)
  41. myWindow.setTextColor(colors.black)
  42. myWindow.clear()
  43. myWindow.setCursorPos (8, 5)
  44. myWindow.write"SaMBa Manager"
  45. myWindow.setCursorPos (8, 6)
  46. myWindow.write"   (Alpha)   "
  47. myWindow.setCursorPos (1, 1)
  48. myWindow.write"Pepek@Soft"
  49. myWindow.setCursorPos (22, 9)
  50. myWindow.write"2021"
  51. kontrola()
  52. sleep(0.5)
  53. menu()
  54. end
  55.  
  56. function kontrola()
  57.         if not fs.exists ("/C/service/SMB") and not fs.exists ("/C/service/SMB.lua") then
  58.             if not fs.exists ("/C/stopService/SMBD.lua") then
  59.             shell.run("pastebin get s05xpL7r /C/service/SMB.lua")
  60.             multishell.launch({}, "/C/service/SMB.lua")
  61.             end
  62.     end
  63. end
  64.  
  65. function plocha()
  66. w, h = term.getSize()
  67. paintutils.drawLine(1, 1, w, 1, BarPoz)
  68. paintutils.drawPixel (w,1, colors.red)
  69. term.setCursorPos (w,1)
  70. term.setTextColor(BarTxt)
  71. write "×"
  72. barW = window.create(term.current(),1,2,w,1)
  73. barW.setBackgroundColor(colors.gray)
  74. barW.clear()
  75. barW.setTextColor(colors.white)
  76. barW.setCursorPos(2,1)
  77. barW.write"Samba Manager >"
  78. pozadi = window.create(term.current(),13,3,w,h-2)
  79. pozadi.setBackgroundColor(colors.white)
  80. pozadi.setTextColor(colors.black)
  81. pozadi.clear()
  82. lista = window.create(term.current(),1,3,12,h-2)
  83. lista.setBackgroundColor(BarPoz)
  84. lista.setTextColor(BarTxt)
  85. lista.clear()
  86. lista.setCursorPos(2,3)
  87. lista.write"Dashboard"
  88. lista.setCursorPos(2,h-2)
  89. lista.setTextColor(colors.white)
  90. lista.write("Pepek@Soft")
  91. term.setBackgroundColor(colors.lightGray)
  92. end
  93. -----------------------------------------------------------------------------
  94. local page = "main"
  95.  
  96. function main()
  97. barW.setCursorPos(19,1)
  98. barW.write"Dashboard"
  99. pozadi.setCursorPos(2,2)
  100. pozadi.write"it Will be Soon,"
  101. pozadi.setCursorPos(2,3)
  102. pozadi.write"we are working on development"
  103. end
  104.  
  105. function menu()
  106.     plocha()
  107.     if (page == "main") then
  108.         main ()
  109.     end
  110.  
  111.     while true do
  112.         local event, button, x, y = os.pullEvent("mouse_click")
  113.         xy = x..","..y
  114.        
  115.         if event == "mouse_click" and x >= 2 and x <= 12 and y == 5 then
  116.         cbarva()
  117.         lista.setCursorPos(1,3)--
  118.         lista.write" Dashboard  "
  119.         sleep(anim)
  120.         page = "main"
  121.         menu()
  122.         end
  123.        
  124.        
  125.         if x == w and y == 1 then
  126.             ukonceni ()
  127.         else
  128.             menu() -------- stejne jako nazev funkce
  129.         end
  130.     end
  131. end
  132.  
  133. start()
Add Comment
Please, Sign In to add comment