Advertisement
Guest User

serverApps.lua

a guest
Aug 23rd, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. tArgs = { ... }
  2. Version = 1.0
  3. --print("timia2109's Upd8r/In5t4ll3r V",Version)
  4. --print("Install server tools...")
  5. --print("Connecting to server....")
  6. Server = "http://timia2109.com/filez/sync.php?mode=server"
  7.  
  8. if term.isColor() == true then
  9.     Color = true
  10.     --term.setBackgroundColor(colors.white)
  11. else
  12.     Color = false
  13. end
  14.  
  15.  
  16. function getAll()
  17.     a = http.get(Server)
  18.     All = textutils.unserialize(a.readAll())
  19. end
  20.  
  21. getAll()
  22.  
  23. x = 1
  24.  
  25. function makeColor(qwert,trewq)
  26.     if Color == true then
  27.         --term.setTextColor(qwert)
  28.         if trewq ~= nil then
  29.             --term.setBackgroundColor(trewq)
  30.         end
  31.     end
  32. end
  33.  
  34. makeColor(colors.black)
  35. --print("Local V",Version," | Server V",All["sync.php"])
  36.        
  37. if tArgs[1] == nil then
  38.     getAll()
  39.     while x <= All["Inhalt"] do
  40.         Name = All["Name"..x]
  41.         a = http.get(All["Link"..x])
  42.         if fs.exists(Name) then
  43.             makeColor(colors.red)
  44.             --print(" => Habe ",Name," gefunden.")
  45.             fs.delete(Name)
  46.         end
  47.         makeColor(colors.green)
  48.         --print("Erstelle ",Name)
  49.         b = fs.open(Name, "w")
  50.         b.write(a.readAll())
  51.         b.close()
  52.         x=x+1
  53.     end
  54.     makeColor(colors.blue)
  55.     --print("All filez are In5t4ll3d or Upd8ed")s
  56.     makeColor(colors.white,colors.black)
  57. else
  58.     a = http.get("Server")
  59.     a = a.readAll()
  60.     if a == 'NA' then
  61.         print("File dosn't exsits!")
  62.     else
  63.         b = fs.open(tArgs[1],"w")
  64.         b.write(a)
  65.         b.close()
  66.     end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement