Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pF = {
- name = "Map", --string
- folder = "GPSMinimap", --string
- colorCode = 1, --number
- liveSystem = "", --string
- files = { --table
- ["Map"] = "x9ajKSc0", --[string] = string
- }
- }
- local getFromPastebin = function(code,path)
- if not type(code) == "string" then
- error("Expected pastebin code")
- elseif not type(path) == "string" then
- error("Expected file path")
- end
- local prog = http.get("http://pastebin.com/raw/"..code)
- if not code then
- return false, "could not connect"
- end
- prog = prog.readAll()
- if fs.exists(fs.getName(path)) and not fs.isDir(fs.getName(path)) then
- return false, "file exists in that path"
- end
- if not fs.exists(fs.getDir(path)) then
- fs.makeDir(fs.getDir(path))
- end
- local file = fs.open(path,"w")
- file.write(prog)
- file.close()
- return true, fs.getSize(path)
- end
- --App Installer - by SimlorLP
- function appInstaller(name,farbe,ver,loesch,LiveJaNein,LivePfad)
- term.setBackgroundColor(128)
- term.setTextColor(1)
- term.clear()
- print("Starting installation...")
- --Absicherung
- local file = fs.open("SimSoft/Daten/SappS/A","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- anz = tonumber(fileData[1])
- if anz >= 15 then
- print("Too many apps.")
- sleep(0.4)
- return
- else
- anz = (anz+1)
- local file = fs.open("SimSoft/Daten/SappS/A","w")
- file.write(anz)
- file.close()
- local file = fs.open("SimSoft/Daten/SappS/"..anz,"w")
- file.writeLine(name)
- file.writeLine(anz)
- file.writeLine(farbe.."\n")
- file.writeLine(ver)
- file.writeLine(loesch)
- if LiveJaNein ~= "" then
- file.writeLine("t")
- file.writeLine(LiveJaNein)
- else
- file.writeLine("f\n")
- end
- file.close()
- end
- end
- for k,v in pairs(pF.files) do
- getFromPastebin(v,fs.combine(fs.combine("SimSoft/SappS",pF.folder),k))
- end
- 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