Atom888

XynSoft 1.0 - Installer

Nov 7th, 2017
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.51 KB | None | 0 0
  1. function checkColor()
  2.    return iscolor()
  3. end
  4.  
  5. function C()
  6.    term.clear()
  7. end
  8.  
  9. function CP(x,y)
  10.    term.setCursorPos(x,y)
  11. end
  12.  
  13. function BC(bgC)
  14.    term.setBackgroundColor(bgC)
  15. end
  16.  
  17. function TC(ttC)
  18.    term.setTextColor(ttC)
  19. end
  20.  
  21. function Write(text,Wx,Wy,Wbc,Wtc)
  22.    CP(Wx,Wy)
  23.    BC(Wbc)
  24.    TC(Wtc)
  25.    term.write(text)
  26. end
  27.  
  28. function Input(text,rd,Ix,Iy,Ibc,Itc)
  29.    CP(Ix,Iy)
  30.    BC(Ibc)
  31.    TC(Itc)
  32.    term.write(text)
  33.    return read(rd)
  34. end
  35.  
  36. function F(Fy,Fcol)
  37.    Write("                                                                                                        ",1,Fy,Fcol,Fcol)
  38. end
  39.  
  40. function FS(fillCol,effect,eTime)
  41.    y = 1        
  42.    if effect then
  43.       for y = 1,19 do
  44.          F(y,fillCol)
  45.          sleep(eTime)
  46.       end
  47.    elseif not effect then
  48.       for y = 1,19 do
  49.          F(y,fillCol)
  50.       end
  51.    end
  52. end
  53.  
  54. function ShellEvent(evt)
  55.    a,b,c,d = os.pullEventRaw()
  56.    if a == evt then
  57.       return b,c,d
  58.    end      
  59. end
  60.  
  61. function ShellEventAdv(a,b,c,d,e,f)
  62.    evt,button,x,y = os.pullEventRaw()
  63.    if evt == a then
  64.       if button == b then
  65.          if x >= c then
  66.             if x <= d then
  67.                if y >= e then
  68.                   if y <= f then
  69.                      return true
  70.                   else
  71.                      return false
  72.                   end
  73.                else
  74.                   return false
  75.                end
  76.             else
  77.                return false
  78.             end
  79.          else
  80.             return false
  81.          end
  82.       else
  83.          return false
  84.       end
  85.    else
  86.       return false
  87.    end
  88. end
  89. function PastebinGet(PBcode,Fpath)
  90.    http.get(PBcode,Fpath)
  91. end
  92.  
  93. function FsDel(Fpath)
  94.    fs.delete(Fpath)
  95. end
  96.  
  97. function FsMkdir(dir)
  98.    fs.makeDir(dir)
  99. end
  100.  
  101. function FsExists(file)
  102.    return fs.exists(file)
  103. end
  104.  
  105. function OsReboot()
  106.    os.reboot()
  107. end
  108.  
  109. function OsShutdown()
  110.    os.shutdown()
  111. end
  112.  
  113. function Api(api)
  114.    os.loadAPI(api)
  115. end
  116.  
  117. function Image(Image,x,y)
  118.    img = paintutils.loadImage(Image)
  119.    paintutils.drawImage(img,x,y)
  120. end
  121.  
  122. function Button(text,x,midY,bgC,ttC)
  123.    for x1 = x,(x + (string.len(text))) + 1 do
  124.       Write(" ",x1,midY - 1,bgC,ttC)
  125.    end
  126.    Write(" "..text.." ",x,midY,bgC,ttC)
  127.    for x1 = x,(x + (string.len(text))) + 1 do
  128.       Write(" ",x1,midY + 1,bgC,ttC)
  129.    end
  130. end
  131. if checkColor() then
  132.    setup()
  133. else
  134.    CP(1,1)
  135.    print("Sorry, but XynSoft is'nt compatible with your system...")
  136.    CP(1,2)
  137.    print("Error: 0x000fff")
  138.    CP(1,3)
  139.    input("Hit enter to continue... ")
  140.    print("Downloading alternative and compatible XynSoft OS Version... ")
  141. end
  142. function setup()
  143. FS(colors.white,false,0)
  144. F(1,colors.gray)
  145. F(2,colors.gray)
  146. F(3,colors.gray)
  147. Write("XynSoft 1.0",5,2,colors.gray,colors.white)
  148. Write("Installer",18,2,colors.gray,colors.lightGray)
  149. Write("Choose your language",15,6,colors.white,colors.black)
  150. Button("English",11,12,colors.gray,colors.white)
  151. Button("Nederlands",27,12,colors.gray,colors.white)
  152. t1 = true
  153. while t1 do
  154.    if ShellEventAdv("mouse_click",1,10,18,11,13) then
  155.       lang = "en"
  156.       t1 = false
  157.    elseif ShellEventAdv("mouse_click",1,26,38,11,13) then
  158.       lang = "nl"
  159.       t1 = false
  160.    end
  161. end
  162. if lang == "en" then
  163.    e1 = "Information: "
  164.    i2 = "- Location: /XynSoft/"
  165.    i3 = "- APIs: /XynSoft/System/SystemCC/"
  166.    b1 = "Next"
  167.    e4 = "License:"
  168.    l5 = "- Do not use this code for your own work"
  169.    l6 = "- Do not use this OS for illegal operations"
  170.    l7 = "- Copyright (C) Fluxcraft Labs. All rights reserved. -"
  171.    e8 = "Install"
  172.    e9 = "Quit"
  173.    e10 = "XynSoft succesfully installed"
  174.    e11 = "To Setup"
  175. elseif lang == "nl" then
  176.    e1 = "Informatie: "
  177.    i2 = "- Locatie: /XynSoft/"
  178.    i3 = "- APIs: /XynSoft/System/SystemCC/"
  179.    b1 = "Volgende"
  180.    e4 = "Licensie:"
  181.    l5 = "- Do not use this code for your own work"
  182.    l6 = "- Do not use this OS for illegal operations"
  183.    l7 = "- Copyright (C) Fluxcraft Labs. All rights reserved."
  184.    e8 = "Installeren"
  185.    e9 = "Annuleren"
  186.    e10 = "XynSoft is met succes geinstalleerd"
  187.    e11 = "Naar Setup.."
  188. else
  189.    sec = 10
  190.    FS(colors.blue,false)
  191.    BC(colors.blue)
  192.    TC(colors.white)
  193.    Write("Err: Undifined Value",7,7,colors.blue,colors.white)
  194.    for i = 1,10 do
  195.       sec = sec - 1  
  196.       Write("Rebooting computer after "..sec.." Seconds..")
  197.    end
  198.    OsReboot()
  199. end
  200. FS(colors.white,false,0)
  201. F(1,colors.gray)
  202. F(2,colors.gray)
  203. F(3,colors.gray)
  204. Write("XynSoft 1.0",5,2,colors.gray,colors.white)
  205. Write("Installer",18,2,colors.gray,colors.lightGray)
  206. Write(e1,18,7,colors.white,colors.black)
  207. Write(i2,7,9,colors.white,colors.gray)
  208. Write(i3,7,10,colors.white,colors.gray)
  209. Button(b1,18,13,colors.gray,colors.white)
  210. t2 = true
  211. while t2 do
  212.    if ShellEventAdv("mouse_click",1,17,18 + (string.len(b1) + 1),12,14) then
  213.       t2 = false
  214.    end
  215. end
  216. FS(colors.white,false,0)
  217. F(1,colors.gray)
  218. F(2,colors.gray)
  219. F(3,colors.gray)
  220. Write("XynSoft 1.0",5,2,colors.gray,colors.white)
  221. Write("Installer",18,2,colors.gray,colors.lightGray)
  222. Write(e4,14,6,colors.white,colors.black)
  223. Write(l5,1,8,colors.white,colors.gray)
  224. Write(l6,1,9,colors.white,colors.gray)
  225. Write(l7,1,10,colors.white,colors.gray)
  226. Button(b1,18,13,colors.gray,colors.white)
  227. t3 = true
  228. while t3 do
  229.    if ShellEventAdv("mouse_click",1,17,18 + (string.len(b1) + 1),12,14) then
  230.       t3 = false
  231.    end
  232. end
  233. FS(colors.white,false,0)
  234. F(1,colors.gray)
  235. F(2,colors.gray)
  236. F(3,colors.gray)
  237. Write("XynSoft 1.0",5,2,colors.gray,colors.white)
  238. Write("Installer",18,2,colors.gray,colors.lightGray)
  239. end
Advertisement
Add Comment
Please, Sign In to add comment