SHARE
TWEET

SappS - BigReactors (Installer)

Simlor_GER Dec 11th, 2015 (edited) 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --App Installer - von LDDestroier und SimlorLP
  2.  
  3. local pF = {
  4.   name = "BigReactors",                               --Name der Start Datei
  5.   folder = "BigReactorsOrdner",                       --Ordner mit den Dateien
  6.   colorCode = 3,                                   --Nummer der icon Farbe, 1-10 moeglich (http://simsoft-os.jimdo.com/fuer-entwickler)
  7.   liveSystem = "",                                 --Schreibe hier (falls vorhanden) deine LiveSystem Datei rein
  8.   files = {                                        --Trage hier die/den Namen und PastebinIDs aller Datei. Unterordner sind auch erlaubt.
  9.         ["BigReactors"] = "PxJ8X5Av",              
  10.   }
  11. }
  12.  
  13. local getFromPastebin = function(code,path)
  14. if not type(code) == "string" then
  15.   error("Expected pastebin code")
  16. elseif not type(path) == "string" then
  17.   error("Expected file path")
  18. end
  19. local prog = http.get("http://pastebin.com/raw/"..code)
  20. if not code then
  21.   return false, "could not connect"
  22. end
  23. prog = prog.readAll()
  24. if fs.exists(fs.getName(path)) and not fs.isDir(fs.getName(path)) then
  25.   return false, "file exists in that path"
  26. end
  27. if not fs.exists(fs.getDir(path)) then
  28.   fs.makeDir(fs.getDir(path))
  29. end
  30. local file = fs.open(path,"w")
  31. file.write(prog)
  32. file.close()
  33. return true, fs.getSize(path)
  34. end
  35.  
  36. function appInstaller(name,farbe,ver,loesch,LiveJaNein,LivePfad)
  37. term.setBackgroundColor(128)
  38. term.setTextColor(1)
  39. term.clear()
  40. print("Starting installation...")
  41. --Absicherung
  42. local file = fs.open("SimSoft/Daten/SappS/A","r")
  43. local fileData = {}
  44. local line = file.readLine()
  45. repeat
  46.   table.insert(fileData,line)
  47.   line = file.readLine()
  48. until line == nil
  49. file.close()
  50. anz = tonumber(fileData[1])
  51. if anz >= 15 then
  52.   print("Too many apps.")
  53.   sleep(0.4)
  54.   return
  55. else
  56.   anz = (anz+1)
  57.   local file = fs.open("SimSoft/Daten/SappS/A","w")
  58.   file.write(anz)
  59.   file.close()
  60.   local file = fs.open("SimSoft/Daten/SappS/"..anz,"w")
  61.   file.writeLine(name)
  62.   file.writeLine(anz)
  63.   file.writeLine(farbe.."\n")
  64.   file.writeLine(ver)
  65.   file.writeLine(loesch)
  66.   if LiveJaNein ~= "" then
  67.    file.writeLine("t")
  68.    file.writeLine(LiveJaNein)
  69.   else
  70.    file.writeLine("f\n")
  71.   end
  72.   file.close()
  73. end
  74. end
  75. for k,v in pairs(pF.files) do
  76. getFromPastebin(v,fs.combine(fs.combine("SimSoft/SappS",pF.folder),k))
  77. end
  78. appInstaller(string.sub(pF.name,1,6),tostring(pF.colorCode)..".0",fs.combine(pF.folder,pF.name),pF.folder,pF.liveSystem)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top