Advertisement
Simlor_GER

SimSoft 4 - SystemStart

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