Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local vers = 1.201 --Command line support!
- if not http then error("Sorry! you need Internet") end
- shell.run("clear")
- --fastRun = true --Only for Debug
- --noUpdate = true --Only for Debug
- local params = {...}
- if #params > 0 then
- usep= true
- end
- local rP = 0
- local tread = function(a)
- if usep then
- return read(a)
- else
- rP = rP +1
- return params[rP]
- end
- end
- function CanWait(time)
- if fastRun then
- return false
- else
- sleep(time)
- return true
- end
- end
- function HiddenPastebinGET(pstbinID, savLocFile)
- if not noUpdate then
- local sCode = pstbinID
- local sFile = savLocFile
- local sPath = shell.resolve( sFile )
- if fs.exists( sPath ) then
- fs.delete(sPath)
- end
- local response = http.get(
- "http://pastebin.com/raw.php?i="..textutils.urlEncode( pstbinID )
- )
- if response then
- local sResponse = response.readAll()
- response.close()
- res = sResponse
- end
- if res then
- local file = fs.open( sPath, "w" )
- file.write( res )
- file.close()
- end
- end
- end
- function printBanner()
- shell.run("clear")
- if not pocket then
- print(",-------------------------------,\n|--------- CCInstaller ---------|\n`-------------------------------'\n")
- else
- print(",-------------,\n| CCInstaller |\n`-------------'\n")
- end
- end
- printBanner()
- CanWait(0.2)
- print("Downloading Assets")
- write("|# |")
- local AssetSaveLocation = "/CCInstaller.assets/"
- if not fs.exists(AssetSaveLocation) then
- fs.makeDir(AssetSaveLocation)
- else
- if not fs.isDir(AssetSaveLocation) then
- fs.makeDir(AssetSaveLocation)
- end
- end
- term.setCursorPos(2, 6)
- HiddenPastebinGET("REaZXV7W", AssetSaveLocation.."WicowsTools")
- print("#####")
- term.setCursorPos(2, 6)
- HiddenPastebinGET("7c1zEuXF", AssetSaveLocation.."InstallBase")
- print("##########")
- printBanner()
- print("Adding required External Functions...")
- os.unloadAPI(AssetSaveLocation.."WicowsTools")
- os.loadAPI(AssetSaveLocation.."WicowsTools")
- --CanWait(0.2)
- print("Done!\nInitalizing LanguagePack...")
- langPack = {
- en = {
- "Please coppy all Installation Files into the \"CCInstallFiles\" Folder\n\nPress any key to contiune",
- "Found Folder: ",
- "Found File:" ,
- "ERROR: No Files found",
- "Done! ",
- " Objects found!",
- "Building InstallationFile...",
- "Scan Folders and Files...",
- "Please Enter ",
- "ProjectName: ",
- "Saved as:",
- },
- de = {
- "Bitte kopiere alle Installationsdateien in den \"CCInstallFiles\" Ordner\n\nZum fortfahren beliebige Taste druecken",
- "Ordner gefunden: ",
- "Datei gefunden: ",
- "FEHLER: Keine Dateien gefunden!",
- "Fertig! ",
- " Objekte gefunden!",
- "Baue Installationsdateien...",
- "Scanne Ordner und Dateien:",
- "Bitte gebe den ",
- "Projektnamen ein: ",
- "Gespeichert unter:",
- },
- }
- --CanWait(0.1)
- print("Done")
- --CanWait(0.3)
- ----------------------------------------------------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------
- shell.run("clear")
- lang = "en"
- local n=1
- if not usep then
- while true do
- local x, y=term.getCursorPos()
- shell.run("clear")
- if n==1 then print("Select Language:\n,------------,\n|[x] English |\n|[ ] Deutsch |\n`------------'")
- else print("Select Language:\n,------------,\n|[ ] English |\n|[x] Deutsch |\n`------------'")end
- term.setCursorPos(x, y)
- a, b=os.pullEvent()
- while a~="key" do a, b=os.pullEvent() end
- if b==200 then n=n-1 end
- if b==208 then n=n+1 end
- if b==28 then break end
- if n==0 then n=2 end
- if n==3 then n=1 end
- end
- if n==1 then lang = "en"
- elseif n==2 then lang = "de"
- else error("Code Crash!!!") end
- end
- WicowsTools.MagicClear(0.05)
- print(langPack[lang][1])
- if not fs.exists("CCInstallFiles") then fs.makeDir("CCInstallFiles") end
- if not usep then os.pullEvent("key") end
- WicowsTools.CreateBorder()
- x, y = term.getSize()
- DebugLog = window.create(term.current(), 2, 2, x -2, y-2)
- ----------------------------------------------------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------------------------------------------------
- scrolled = 0
- function Log(str, add)
- x, y = DebugLog.getCursorPos()
- w, h = DebugLog.getSize()
- if y > h then
- term.setBackgroundColor(colors.black)
- term.clear()DebugLog.clear()
- WicowsTools.CreateBorder()
- DebugLog.setCursorPos(1, 1)
- end
- x, y = DebugLog.getCursorPos()
- DebugLog.write(str)
- if not add then
- DebugLog.setCursorPos(1, y+1)
- end end
- fc = 0
- fileList = {
- Folders = {},
- Files = {},
- }
- if pocket then Log(langPack[lang][9]) Log(langPack[lang][10]) else Log(langPack[lang][9]..langPack[lang][10]) end Log("> ",true) t = tread() if t == "" then t = "Installer" end fileList["Title"] = t Log(fileList["Title"])
- function fScan(folder)
- fol = "CCInstallFiles/"
- if folder == "CCInstallFiles" then
- folder = ""
- fol = "CCInstallFiles"
- end
- local FileList = fs.list(fol..folder)
- for _, file in ipairs(FileList) do
- fc = fc + 1
- CanWait(0.001)
- if fs.isDir(fol..folder.."/"..file) then
- Log(langPack[lang][2]..folder.."/"..file)
- table.insert(fileList["Folders"], folder.."/"..file)
- fScan(folder.."/"..file)
- else
- Log(langPack[lang][3]..folder.."/"..file)
- table.insert(fileList["Files"], { Path = folder.."/"..file, Content = WicowsTools.ReadFile(fol..folder.."/"..file) })
- end
- end
- end
- Log(langPack[lang][8])
- --CanWait(0.5)
- fScan("CCInstallFiles")
- print("1")
- if fc == 0 then
- Log(langPack[lang][4])else
- Log(langPack[lang][5]..tostring(fc)..langPack[lang][6])
- end
- Log(langPack[lang][7]) --[[CanWait(0.2)]]
- Log("Define")
- BuildingString = "Content = " --[[CanWait(0.2)]]
- Log("Adding Content")
- BuildingString = BuildingString..textutils.serialize(fileList) --[[CanWait(0.5)]]
- Log("Adding BaseScript")
- BuildingString = BuildingString.."\n"..WicowsTools.ReadFile("/CCInstaller.assets/InstallBase") --[[CanWait(0.5)]]
- Log("Saving...") --[[CanWait(1.2)]]
- WicowsTools.WriteFile(fileList["Title"], BuildingString)
- Log(langPack[lang][5])
- Log(langPack[lang][11])
- Log("/"..fileList["Title"])
- if not usep then os.pullEvent("key") end
- shell.run("clear")
- fs.delete(AssetSaveLocation.."/")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement