Advertisement
Simlor_GER

SappS - StoreByDannySMc (12.07.2016)

Jul 12th, 2016
848
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. --App Installer - by LDDestroier and SimlorLP
  2. --Free for use and modification
  3.  
  4. local pF = {
  5. name = "Store", --name of executed program
  6. folder = "StoreByDannySMc", --folder of executed program and other files
  7. colorCode = 13, --number code of icon, 1-20 currently (http://simsoft-en.jimdo.com/for-developers)
  8. liveSystem = "", --enables livesystem file
  9. files = { --names and pasteIDs of all files. allows directories too
  10. ["Store"] = "b4GwKPpU", --make SURE to make one entry the same as 'name', or else it won't execute anything
  11. }
  12. }
  13.  
  14. local getFromPastebin = function(code,path)
  15. if not type(code) == "string" then
  16. error("Expected pastebin code")
  17. elseif not type(path) == "string" then
  18. error("Expected file path")
  19. end
  20. local prog = http.get("http://pastebin.com/raw/"..code)
  21. if not code then
  22. return false, "could not connect"
  23. end
  24. prog = prog.readAll()
  25. if fs.exists(fs.getName(path)) and not fs.isDir(fs.getName(path)) then
  26. return false, "file exists in that path"
  27. end
  28. if not fs.exists(fs.getDir(path)) then
  29. fs.makeDir(fs.getDir(path))
  30. end
  31. local file = fs.open(path,"w")
  32. file.write(prog)
  33. file.close()
  34. return true, fs.getSize(path)
  35. end
  36.  
  37. function appInstaller(name,farbe,ver,loesch,LiveJaNein,LivePfad)
  38. term.setBackgroundColor(128)
  39. term.setTextColor(1)
  40. term.clear()
  41. print("Starting installation...")
  42. --Absicherung
  43. local file = fs.open("SimSoft/Daten/SappS/A","r")
  44. local fileData = {}
  45. local line = file.readLine()
  46. repeat
  47. table.insert(fileData,line)
  48. line = file.readLine()
  49. until line == nil
  50. file.close()
  51. anz = tonumber(fileData[1])
  52. if anz >= 15 then
  53. print("App limit has been reached! Delete one to make space. Sorry.")
  54. sleep(0.4)
  55. return
  56. else
  57. anz = (anz+1)
  58. local file = fs.open("SimSoft/Daten/SappS/A","w")
  59. file.write(anz)
  60. file.close()
  61. local file = fs.open("SimSoft/Daten/SappS/"..anz,"w")
  62. file.writeLine(name)
  63. file.writeLine(anz)
  64. file.writeLine(farbe.."\n")
  65. file.writeLine(ver)
  66. file.writeLine(loesch)
  67. if LiveJaNein ~= "" then
  68. file.writeLine("t")
  69. file.writeLine(LiveJaNein)
  70. else
  71. file.writeLine("f\n")
  72. end
  73. file.close()
  74. end
  75. end
  76. for k,v in pairs(pF.files) do
  77. getFromPastebin(v,fs.combine(fs.combine("SimSoft/SappS",pF.folder),k))
  78. end
  79. appInstaller(string.sub(pF.name,1,6),tostring(pF.colorCode)..".0",fs.combine(pF.folder,pF.name),pF.folder,pF.liveSystem)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement