SHARE
TWEET

SappS - Tiktaktoo by minecraft404

Simlor_GER Mar 13th, 2016 (edited) 296 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --App Installer - by LDDestroier and SimlorLP
  2.  
  3. local pF = {
  4.   name = "Tiktak",                            --name of executed program
  5.   folder = "Tiktaktoo",                     --folder of executed program and other files
  6.   colorCode = 17,                               --number code of icon, 1-20 currently (http://simsoft-en.jimdo.com/for-developers)
  7.   liveSystem = "",                             --enables livesystem file
  8.   files = {                                    --names and pasteIDs of all files. allows directories too
  9.         ["Tiktak"] = "JrBR2eDM",               --make SURE to make one entry the same as 'name', or else it won't execute anything
  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