SHARE
TWEET

SimSoft 4 - SystemStart

Simlor_GER Jul 6th, 2016 (edited) 1,504 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Copyright Simlor (http://www.computercraft.info/forums2/index.php?/user/55655-simlor/) -  Alle Rechte an diesen Programm sind Simlor vorbehalten.
  2.  
  3.  
  4. term.setBackgroundColor(1)
  5. term.setTextColor(256)
  6. term.clear()
  7.  
  8. --Functions
  9.  
  10. --Clear
  11. function Clear()
  12.  term.clear()
  13.  term.setCursorPos(1,1)
  14. end
  15.  
  16. --Set Cursorposition
  17. function CP(x,y)
  18.  term.setCursorPos(x,y)
  19. end
  20.  
  21. --Set Background Color
  22. function BC(farbe)
  23.  term.setBackgroundColor(farbe)
  24. end
  25.  
  26. --Set Text Color
  27. function TC(farbe)
  28.  term.setTextColor(farbe)
  29. end
  30.  
  31. --Download Function
  32.  
  33. function Download(CodePB, Pfad)
  34.  local datei = http.get("http://pastebin.com/raw/"..CodePB)
  35.  datei = datei.readAll()
  36.  
  37.  local file = fs.open(Pfad, "w")
  38.  file.write(datei)
  39.  file.close()
  40. end
  41.  
  42. --SimSoft-Balken setzten
  43. function SimSoftBalken(titel, laenge)
  44.  w, h = term.getSize()
  45.  BC(128)
  46.  TC(1)
  47.  
  48.  anz = 0
  49.  hig = 1
  50.  while true do
  51.   anz = (anz+1)
  52.   term.setCursorPos(anz, hig)
  53.   write(" ")
  54.   if anz == w then
  55.    if hig == 3 then
  56.     laenge = (laenge/2)
  57.     w = (w/2)
  58.     w = (w-laenge)
  59.    
  60.     term.setCursorPos(w,2)
  61.     print(titel)
  62.     break
  63.    else
  64.     hig = (hig+1)
  65.     anz = 0
  66.    end
  67.   end
  68.  end
  69. end
  70.  
  71. --OS Version und Sprache
  72.  
  73. function VerSpr()
  74.  file = fs.open("SimSoft/Data/Config","r")
  75.  local fileData = {}
  76.  local line = file.readLine()
  77.  repeat
  78.  table.insert(fileData,line)
  79.  line = file.readLine()
  80.  until line == nil
  81.  file.close()
  82.  SS2V = fileData[3]
  83.  Sprache = fileData[4]
  84. end
  85.  
  86. --OS Update Function
  87.  
  88. function OSUpdateCheck()
  89.  
  90.  local datei = http.get("http://pastebin.com/raw/5dPkiCxH")
  91.  if not datei then
  92.   function UpdateC()
  93.    UpdateCV = true
  94.   end
  95.  else
  96.  
  97.   datei = datei.readAll()
  98.  
  99.   local file = fs.open("SimSoft/Data/UpdateCheck/S","w")
  100.   file.writeLine(datei)
  101.   file.close()
  102.  
  103.   file = fs.open("SimSoft/Data/UpdateCheck/S","r")
  104.   local fileData = {}
  105.   local line = file.readLine()
  106.   repeat
  107.   table.insert(fileData,line)
  108.   line = file.readLine()
  109.   until line == nil
  110.   file.close()
  111.  
  112.   v = fileData[1]
  113.  
  114.   VerSpr()
  115.  
  116.   if v == SS2V then
  117.    function UpdateC()
  118.     UpdateCV = true
  119.    end
  120.   else
  121.    function UpdateC()
  122.     UpdateCV = false
  123.    end
  124.   end
  125.  
  126.   fs.delete("SimSoft/Data/UpdateCheck/S")
  127.  end
  128. end
  129.  
  130. OSUpdateCheck()
  131.  
  132. --Ende Functionen
  133.  
  134. --Rednet Check
  135.  
  136. if peripheral.getType("back") == "modem" then
  137.  rednet.open("back")
  138. end
  139.  
  140. if peripheral.getType("left") == "modem" then
  141.  rednet.open("left")
  142. end
  143.  
  144. if peripheral.getType("right") == "modem" then
  145.  rednet.open("right")
  146. end
  147.  
  148. if peripheral.getType("top") == "modem" then
  149.  rednet.open("top")
  150. end
  151.  
  152. if peripheral.getType("front") == "modem" then
  153.  rednet.open("front")
  154. end
  155.  
  156. if peripheral.getType("bottom") == "modem" then
  157.  rednet.open("bottom")
  158. end
  159.  
  160. BC(256)
  161. Clear()
  162. sleep(0.2)
  163. BC(1)
  164. Clear()
  165. sleep(0.1)
  166. BC(256)
  167. Clear()
  168.  
  169. --Start System (Passwort System)
  170.  
  171. file = fs.open("SimSoft/Data/Config","r")
  172. local fileData = {}
  173. local line = file.readLine()
  174. repeat
  175. table.insert(fileData,line)
  176. line = file.readLine()
  177. until line == nil
  178. file.close()
  179.  
  180. PassSystem = fileData[1]
  181.  
  182. if PassSystem == "true" then
  183.  
  184. SimSoftBalken("SimSoft - Login", 15)
  185.  
  186. BC(256)
  187. TC(128)
  188.  
  189. CP(4,8)
  190. write("Name -")
  191. CP(4,10)
  192. write("Password -")
  193.  
  194. TC(1)
  195. CP(4,8)
  196. write("Name -")
  197. TC(32768)
  198. CP(11,8)
  199. namee = read()
  200.  
  201. TC(128)
  202. CP(4,8)
  203. write("Name -")
  204. TC(1)
  205. CP(4,10)
  206. write("Password -")
  207. TC(32768)
  208. CP(15,10)
  209. passe = read("#")
  210. TC(128)
  211. CP(4,10)
  212. write("Password -")
  213.  
  214.  function PassSS(nr)
  215.  
  216.   file = fs.open("SimSoft/Data/User/User"..nr,"r")
  217.   local fileData = {}
  218.   local line = file.readLine()
  219.   repeat
  220.   table.insert(fileData,line)
  221.   line = file.readLine()
  222.   until line == nil
  223.   file.close()
  224.  
  225.   name = fileData[1]
  226.   pass = fileData[2]
  227.   ATF = fileData[3]
  228.  
  229.  end
  230.  
  231.  PassSS(1)
  232.  if namee == name then
  233.   if passe == pass then
  234.    function Rechte()
  235.     Recht = "Admin"
  236.     RechtH = 1
  237.    end
  238.     TC(1)
  239.     CP(3,14)
  240.     print("Welcome "..namee.."!")
  241.     sleep(1)
  242.    shell.run("SimSoft/System/Desktop")
  243.   else
  244.    TC(1)
  245.    CP(3,14)
  246.    print("Wrong name or password")
  247.    sleep(1.5)
  248.    os.reboot()
  249.   end
  250.  else
  251.  
  252.   PassSS(2)
  253.   if namee == name then
  254.    if ATF == "false" then
  255.     TC(1)
  256.     CP(3,14)
  257.     print("This account is offline")
  258.     sleep(1.5)
  259.     os.reboot()
  260.    elseif passe == pass then
  261.     function Rechte()
  262.      Recht = "Guest"
  263.      RechtH = 2
  264.     end
  265.     TC(1)
  266.     CP(3,14)
  267.     print("Welcome "..namee.."!")
  268.     sleep(1)
  269.     shell.run("SimSoft/System/Desktop")
  270.    else
  271.     TC(1)
  272.     CP(3,14)
  273.     print("Wrong name or password")
  274.     sleep(1.5)
  275.     os.reboot()
  276.    end
  277.   else
  278.  
  279.    PassSS(3)
  280.    if namee == name then
  281.     if ATF == "false" then
  282.     TC(1)
  283.     CP(3,14)
  284.     print("This account is offline")
  285.     sleep(1.5)
  286.     os.reboot()
  287.    elseif passe == pass then
  288.      function Rechte()
  289.       Recht = "Guest"
  290.       RechtH = 3
  291.      end
  292.      TC(1)
  293.      CP(3,14)
  294.      print("Welcome "..namee.."!")
  295.      sleep(1)
  296.      shell.run("SimSoft/System/Desktop")
  297.     else
  298.      TC(1)
  299.      CP(3,14)
  300.      print("Wrong name or password")
  301.      sleep(1.5)
  302.      os.reboot()
  303.     end
  304.    else
  305.     TC(1)
  306.     CP(3,14)
  307.     print("Wrong name or password")
  308.     sleep(1.5)
  309.     os.reboot()
  310.    end
  311.   end
  312.  end
  313.  
  314. else
  315.  function Rechte()
  316.   Recht = "Admin"
  317.   RechtH = 0
  318.  end
  319.  shell.run("SimSoft/System/Desktop")
  320. end
  321.  
  322. --end
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