View difference between Paste ID: SPhtgMY9 and KBRxL3B6
SHOW: | | - or go back to the newest paste.
1-
--App Installer - by LDDestroier and SimlorLP
1+
--Installer for the Super Text Downloader GUI version.
2-
--Free for use and modification
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-
  name = "Example",                            --name of executed program
5+
6-
  folder = "exampleFolder",                    --folder of executed program and other files
6+
  name = "STDgui",                            --name of executed program
7-
  colorCode = 1,                               --number code of icon, 1-20 currently (http://simsoft-en.jimdo.com/for-developers)
7+
  folder = "stdgui",                    --folder of executed program and other files
8
  colorCode = 11,                               --number code of icon, 1-20 currently (http://simsoft-en.jimdo.com/for-developers)
9
  liveSystem = "",                             --enables livesystem file
10-
        ["Example"] = "pasteID",               --make SURE to make one entry the same as 'name', or else it won't execute anything
10+
11-
        ["cfg/exampleAPI"] = "anotherPasteID"  --this works
11+
        ["STDGUI"] = "P9dDhQ2m",               --make SURE to make one entry the same as 'name', or else it won't execute anything
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-
  print("App limit has been reached! Delete one to make space. Sorry.")
54+
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)