LDDestroier

SappS - STDGUI (SimSoft installer)

May 14th, 2016
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Installer for the Super Text Downloader GUI version.
  2. --This store detects if SimSoft is installed, and can download things to your desktop!
  3. -- Template designed by LDDestroier (me) and Simlor.
  4.  
  5. local pF = {
  6.     name = "STDgui",
  7.     folder = "stdgui",
  8.     colorCode = 8,
  9.     liveSystem = "",
  10.     files = {
  11.         ["STDgui"] = "P9dDhQ2m",
  12.         [".std_list"] = "FSCzZRUk",
  13.     }
  14. }
  15.  
  16. local getFromPastebin = function(code,path)
  17. if not type(code) == "string" then
  18.   error("Expected pastebin code")
  19. elseif not type(path) == "string" then
  20.   error("Expected file path")
  21. end
  22. local prog = http.get("http://pastebin.com/raw/"..code)
  23. if not code then
  24.   return false, "could not connect"
  25. end
  26. prog = prog.readAll()
  27. if fs.exists(fs.getName(path)) and not fs.isDir(fs.getName(path)) then
  28.   return false, "file exists in that path"
  29. end
  30. if not fs.exists(fs.getDir(path)) then
  31.   fs.makeDir(fs.getDir(path))
  32. end
  33. local file = fs.open(path,"w")
  34. file.write(prog)
  35. file.close()
  36. return true, fs.getSize(path)
  37. end
  38.  
  39. function appInstaller(name,farbe,ver,loesch,LiveJaNein,LivePfad)
  40. term.setBackgroundColor(128)
  41. term.setTextColor(1)
  42. term.clear()
  43. print("Starting installation...")
  44. --Absicherung
  45. local file = fs.open("SimSoft/Daten/SappS/A","r")
  46. local fileData = {}
  47. local line = file.readLine()
  48. repeat
  49.   table.insert(fileData,line)
  50.   line = file.readLine()
  51. until line == nil
  52. file.close()
  53. anz = tonumber(fileData[1])
  54. if anz >= 15 then
  55.   print("Too many apps.")
  56.   sleep(0.4)
  57.   return
  58. else
  59.   anz = (anz+1)
  60.   local file = fs.open("SimSoft/Daten/SappS/A","w")
  61.   file.write(anz)
  62.   file.close()
  63.   local file = fs.open("SimSoft/Daten/SappS/"..anz,"w")
  64.   file.writeLine(name)
  65.   file.writeLine(anz)
  66.   file.writeLine(farbe.."\n")
  67.   file.writeLine(ver)
  68.   file.writeLine(loesch)
  69.   if LiveJaNein ~= "" then
  70.    file.writeLine("t")
  71.    file.writeLine(LiveJaNein)
  72.   else
  73.    file.writeLine("f\n")
  74.   end
  75.   file.close()
  76. end
  77. end
  78. for k,v in pairs(pF.files) do
  79. getFromPastebin(v,fs.combine(fs.combine("SimSoft/SappS",pF.folder),k))
  80. end
  81. appInstaller(string.sub(pF.name,1,6),tostring(pF.colorCode)..".0",fs.combine(pF.folder,pF.name),pF.folder,pF.liveSystem)
Add Comment
Please, Sign In to add comment