Advertisement
ecoMeco

[Computercraft] Admi-get - Apt get benzeri program indirme

Sep 10th, 2014
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.76 KB | None | 0 0
  1. --ADMI-GET
  2. --Made by admicos
  3. --http://mchub.minecrafttr.com/
  4.  
  5. --kodlar asagidadir
  6. arg = { ... }
  7. updated = "NO"
  8. function main()
  9.   if arg[1] then
  10.     package = arg[1]
  11.     yn = "n"
  12.     print("Paket aliniyor...")
  13.     local pInfo = http.get("http://mchub.minecrafttr.com/files/Admicos/admi-get/"..package..".ainf")
  14.     print(pInfo.readAll())
  15.     pInfo.close()
  16.     print("Bu program indirmek istiyormusunuz? [E/H]")
  17.     yn = read()
  18.     if yn == "e" or yn == "E" then
  19.       local packageURL = http.get("http://mchub.minecrafttr.com/files/Admicos/admi-get/"..package..".apkg")
  20.       packageToWrite = packageURL.readAll()
  21.       local file = fs.open(package, "w")
  22.       file.write(packageToWrite)
  23.       file.close()
  24.       packageURL.close()
  25.       term.clear()
  26.       term.setCursorPos(1,1)
  27.       if package == "update" then
  28.         print("Update basari ile indi! Simdi admi-get'i birdaha calistirin. Update islemi baslayacaktir!")
  29.       end
  30.         print("Paket Alindi! Admi-Get'i kullandiginiz icin tesekkur ederim!")  
  31.     end
  32.   else
  33.     if updated == "OK" then
  34.       --do nothing
  35.     else
  36.       error("Kullanim: admi-get <program>", 0)
  37.     end  
  38.   end
  39. end
  40.  
  41. if fs.exists("update") then
  42.   yn = "n"
  43.   print("Admi-Get update dosyasi buldu. Update islemi baslasin mi? [E/H]")
  44.   yn = read()
  45.   if yn == "e" or yn == "E" then
  46.     shell.run("rm admi-get")
  47.     shell.run("rename update admi-get")
  48.     updated = "OK"
  49.   end
  50. end
  51. if pcall(main) then
  52. --do nothing
  53. else
  54.   --print("Boyle bir paket bulunamadi veya programda bir hata olustu!")
  55.   if tostring(err) == "nil" then
  56.     if arg[1] == nil then
  57.       error("Kullanm: admi-get <program>", 0)
  58.     end
  59.     print("Boyle bir program Bulunamadi!")
  60.   else
  61.     print("//Programda Bir hata Olustu!\\\\")
  62.     print("Hata: " .. tostring(err))
  63.   end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement