Advertisement
Simlor_GER

SimSoft 4 - Desktop

Jul 6th, 2016
1,653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.78 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. axit = 0
  5.  
  6. file = fs.open("SimSoft/Data/Config","r")
  7. local fileData = {}
  8. local line = file.readLine()
  9. repeat
  10. table.insert(fileData,line)
  11. line = file.readLine()
  12. until line == nil
  13. file.close()
  14. PassSystem = fileData[1]
  15. Hintergrund = fileData[2]
  16. versionOS = fileData[3]
  17. Sprache = fileData[4]
  18.  
  19. --SappS Touch Function
  20.  
  21. function SappSL(xaa, xba, yaa, yba, numm)
  22.  
  23. if x >= xaa and x <= xba and y >= yaa and y <= yba then
  24.  
  25. file = fs.open("SimSoft/Daten/SappS/"..numm,"r")
  26. local fileData = {}
  27. local line = file.readLine()
  28. repeat
  29. table.insert(fileData,line)
  30. line = file.readLine()
  31. until line == nil
  32. file.close()
  33.  
  34. nameTEST = fileData[1]
  35.  
  36. if nameTEST == "" then
  37. side = 1
  38. end
  39.  
  40. if side == 2 then
  41.  
  42. posNR = fileData[2]
  43.  
  44. posNR = (posNR+1)
  45. posNR = (posNR-1)
  46.  
  47. ver = fileData[5]
  48. verD = fileData[6]
  49. if ver == "n" then
  50. else
  51.  
  52. namesappS = fileData[1]
  53.  
  54. if posNR == 5 or posNR == 10 or posNR == 15 then
  55. xaa = (xaa-22)
  56. end
  57.  
  58. BC(128)
  59. TC(1)
  60. CP(xaa+6, yaa)
  61. print(" ")
  62. CP(xaa+6, yaa)
  63. print(" "..namesappS)
  64. BC(1)
  65. TC(256)
  66. CP(xaa+6, yaa+1)
  67. print(" ")
  68. CP(xaa+6, yaa+2)
  69. print(" Run ")
  70. CP(xaa+6, yaa+3)
  71. print(" Delete ")
  72. CP(xaa+6, yaa+4)
  73. print(" Run with Arg. ")
  74. CP(xaa+6, yaa+5)
  75. print(" ")
  76.  
  77. while true do
  78. event,side,xx,yy = os.pullEvent()
  79. if event == "mouse_click" then
  80.  
  81. if xx >= (xaa+6) and xx <= (xaa+20) and yy >= yaa and yy <= (yaa+5) then
  82. if xx >= (xaa+7) and xx <= (xaa+9) and yy == (yaa+2) then
  83. if ver == "sv" then
  84. ver = fileData[7]
  85. shell.run(ver)
  86. axit = 1
  87. break
  88. elseif ver == "n" then
  89. break
  90. else
  91. shell.run("SimSoft/SappS/"..ver)
  92. axit = 1
  93. break
  94. end
  95.  
  96. elseif xx >= (xaa+7) and xx <= (xaa+13) and yy == (yaa+3) then
  97.  
  98. file = fs.open("SimSoft/Daten/SappS/A","r")
  99. local fileData = {}
  100. local line = file.readLine()
  101. repeat
  102. table.insert(fileData,line)
  103. line = file.readLine()
  104. until line == nil
  105. file.close()
  106.  
  107. sc = fileData[1]
  108.  
  109. sc = (sc+1)
  110. sc = (sc-1)
  111.  
  112. fs.delete("SimSoft/Daten/SappS/"..numm)
  113.  
  114. if verD == "" then
  115. else
  116. fs.delete("SimSoft/SappS/"..verD)
  117. end
  118.  
  119. local file = fs.open("SimSoft/Daten/SappS/"..numm,"w")
  120. file.close()
  121.  
  122. local file = fs.open("SimSoft/Daten/SappS/"..numm,"a")
  123. file.writeLine()
  124. file.writeLine()
  125. file.writeLine()
  126. file.writeLine()
  127. file.writeLine("n")
  128. file.writeLine("false")
  129. file.close()
  130.  
  131. sc = (sc-1)
  132. local file = fs.open("SimSoft/Daten/SappS/A","w")
  133. file.writeLine(sc)
  134. file.close()
  135.  
  136. --Schieben im Falls das x sc nicht letzte Nr war.
  137.  
  138. sc = (sc+1)
  139.  
  140. if numm == sc then
  141. axit = 1
  142. break
  143. else
  144.  
  145. file = fs.open("SimSoft/Daten/SappS/"..sc,"r")
  146. local fileData = {}
  147. local line = file.readLine()
  148. repeat
  149. table.insert(fileData,line)
  150. line = file.readLine()
  151. until line == nil
  152. file.close()
  153.  
  154. iia = fileData[1]
  155. iib = numm
  156. iic = fileData[3]
  157. iid = fileData[4]
  158. iie = fileData[5]
  159. iif = fileData[6]
  160.  
  161. local file = fs.open("SimSoft/Daten/SappS/"..sc,"w")
  162. file.close()
  163.  
  164. local file = fs.open("SimSoft/Daten/SappS/"..sc,"a")
  165. file.writeLine()
  166. file.writeLine()
  167. file.writeLine()
  168. file.writeLine()
  169. file.writeLine("n")
  170. file.writeLine("false")
  171. file.close()
  172.  
  173.  
  174. local file = fs.open("SimSoft/Daten/SappS/"..numm,"w")
  175. file.close()
  176.  
  177. local file = fs.open("SimSoft/Daten/SappS/"..numm,"a")
  178. file.writeLine(iia)
  179. file.writeLine(iib)
  180. file.writeLine(iic)
  181. file.writeLine(iid)
  182. file.writeLine(iie)
  183. file.writeLine(iif)
  184. file.close()
  185.  
  186. axit = 1
  187. break
  188. end
  189. elseif xx >= (xaa+7) and xx <= (xaa+19) and yy == (yaa+4) then
  190. CP(xaa+7, yaa+4)
  191. print(" ")
  192. CP(xaa+7, yaa+4)
  193. TC(128)
  194. arg = read()
  195. TC(256)
  196.  
  197. if ver == "sv" then
  198. ver = fileData[7]
  199. shell.run(ver.." "..arg)
  200. axit = 1
  201. break
  202. elseif ver == "n" then
  203. break
  204. else
  205. shell.run("SimSoft/SappS/"..ver.." "..arg)
  206. axit = 1
  207. break
  208. end
  209. end
  210. else
  211. axit = 1
  212. break
  213. end
  214. end
  215. end
  216. end
  217.  
  218. elseif side == 1 then
  219. ver = fileData[5]
  220. if ver == "sv" then
  221. ver = fileData[7]
  222. shell.run(ver)
  223. axit = 1
  224. elseif ver == "n" then
  225. else
  226. shell.run("SimSoft/SappS/"..ver)
  227. axit = 1
  228. end
  229. end
  230. end
  231. end
  232.  
  233.  
  234. --Sapps Function
  235.  
  236. function AppG(name,pos,farbe)
  237.  
  238. --Pos
  239.  
  240. if pos == 1.0 then
  241. x = 4
  242. y = 5
  243. elseif pos == 2.0 then
  244. x = 12
  245. y = 5
  246. elseif pos == 3.0 then
  247. x = 20
  248. y = 5
  249. elseif pos == 4.0 then
  250. x = 28
  251. y = 5
  252. elseif pos == 5.0 then
  253. x = 36
  254. y = 5
  255. elseif pos == 6.0 then
  256. x = 4
  257. y = 9
  258. elseif pos == 7.0 then
  259. x = 12
  260. y = 9
  261. elseif pos == 8.0 then
  262. x = 20
  263. y = 9
  264. elseif pos == 9.0 then
  265. x = 28
  266. y = 9
  267. elseif pos == 10.0 then
  268. x = 36
  269. y = 9
  270. elseif pos == 11.0 then
  271. x = 4
  272. y = 13
  273. elseif pos == 12.0 then
  274. x = 12
  275. y = 13
  276. elseif pos == 13.0 then
  277. x = 20
  278. y = 13
  279. elseif pos == 14.0 then
  280. x = 28
  281. y = 13
  282. elseif pos == 15.0 then
  283. x = 36
  284. y = 13
  285. end
  286.  
  287. --Farbe
  288.  
  289. TC(256)
  290.  
  291. if farbe == 1.0 then
  292. BC(1)
  293. elseif farbe == 2.0 then
  294. BC(2048)
  295. elseif farbe == 3.0 then
  296. BC(2048)
  297. elseif farbe == 4.0 then
  298. BC(8)
  299. elseif farbe == 5.0 then
  300. BC(32)
  301. elseif farbe == 6.0 then
  302. BC(4)
  303. elseif farbe == 7.0 then
  304. BC(2048)
  305. elseif farbe == 8.0 then
  306. BC(16)
  307. elseif farbe == 9.0 then
  308. BC(1024)
  309. elseif farbe == 10.0 then
  310. BC(4096)
  311. elseif farbe == 11.0 then
  312. BC(2)
  313. elseif farbe == 12.0 then
  314. BC(1024)
  315. elseif farbe == 13.0 then
  316. BC(16384)
  317. elseif farbe == 14.0 then
  318. BC(8192)
  319. elseif farbe == 15.0 then
  320. BC(2)
  321. elseif farbe == 16.0 then
  322. BC(4)
  323. elseif farbe == 17.0 then
  324. BC(8)
  325. elseif farbe == 18.0 then
  326. BC(16)
  327. elseif farbe == 19.0 then
  328. BC(32)
  329. elseif farbe == 20.0 then
  330. BC(64)
  331.  
  332. end
  333.  
  334. --Pos
  335.  
  336. CP(x,y) --4,6
  337. print(" ")
  338. x = (x+1)
  339. y = (y+1)
  340. CP(x,y) --5,7
  341. print(" ")
  342. y = (y-1)
  343.  
  344. --Farbe
  345.  
  346. if farbe == 1.0 then
  347. BC(32768)
  348. elseif farbe == 2.0 then
  349. BC(1)
  350. elseif farbe == 3.0 then
  351. BC(32768)
  352. elseif farbe == 4.0 then
  353. BC(1)
  354. elseif farbe == 5.0 then
  355. BC(32768)
  356. elseif farbe == 6.0 then
  357. BC(1)
  358. elseif farbe == 7.0 then
  359. BC(16384)
  360. elseif farbe == 8.0 then
  361. BC(32)
  362. elseif farbe == 9.0 then
  363. BC(32768)
  364. elseif farbe == 10.0 then
  365. BC(8192)
  366. elseif farbe == 11.0 then
  367. BC(32768)
  368. elseif farbe == 12.0 then
  369. BC(4)
  370. elseif farbe == 13.0 then
  371. BC(16)
  372. elseif farbe == 14.0 then
  373. BC(32)
  374. elseif farbe == 15.0 then
  375. BC(64)
  376. elseif farbe == 16.0 then
  377. BC(256)
  378. elseif farbe == 17.0 then
  379. BC(256)
  380. elseif farbe == 18.0 then
  381. BC(512)
  382. elseif farbe == 19.0 then
  383. BC(1024)
  384. elseif farbe == 20.0 then
  385. BC(8192)
  386. end
  387.  
  388. --Pos
  389.  
  390. CP(x,y) --5,6
  391. print(" ")
  392. x = (x-1)
  393. y = (y+1)
  394. CP(x,y) --4,7
  395. print(" ")
  396. x = (x-2)
  397. y = (y+1)
  398. CP(x,y) --2,8
  399. TC(128)
  400. BC(256)
  401. print(name)
  402. end
  403.  
  404.  
  405. --Hintergrund erstellung
  406.  
  407. BC(256)
  408. Clear()
  409.  
  410. file = fs.open("SimSoft/Data/Config","r")
  411. local fileData = {}
  412. local line = file.readLine()
  413. repeat
  414. table.insert(fileData,line)
  415. line = file.readLine()
  416. until line == nil
  417. file.close()
  418.  
  419. Hintergrund = fileData[2]
  420.  
  421. if Hintergrund == "true" then
  422.  
  423. w, h = term.getSize()
  424.  
  425. h = (h-17)
  426.  
  427. _Background = paintutils.loadImage("SimSoft/Data/DesktopBG")
  428. paintutils.drawImage(_Background,1,h) --1,2
  429.  
  430. elseif Hintergrund == "false" then
  431. end
  432.  
  433.  
  434. --Interface und Icons
  435.  
  436. SimSoftBalken("SimSoft 4 - Desktop", 19)
  437.  
  438. CP(2,2)
  439. TC(256)
  440. print("=")
  441.  
  442. w, h = term.getSize()
  443. nr = 3
  444. w = (w-2)
  445.  
  446. while true do
  447. BC(8)
  448. nr = (nr+1)
  449. CP(w,nr)
  450. write(" ")
  451. if nr == h then
  452. w = (w+1)
  453. CP(w,5)
  454. TC(1)
  455. print("@")
  456. h = (h-1)
  457. CP(w,h)
  458. print("@")
  459. break
  460. end
  461. end
  462.  
  463. file = fs.open("SimSoft/Daten/SappS/A","r")
  464. local fileData = {}
  465. local line = file.readLine()
  466. repeat
  467. table.insert(fileData,line)
  468. line = file.readLine()
  469. until line == nil
  470. file.close()
  471.  
  472. sc = fileData[1]
  473.  
  474. sc = (sc+1)
  475. sc = (sc-1)
  476.  
  477. if sc >= 16 then
  478. sc = 15
  479. elseif sc <= -1 then
  480. sc = 0
  481. end
  482.  
  483. if sc == 0 then
  484. else
  485.  
  486. anz = 0
  487.  
  488. while true do
  489.  
  490. anz = (anz+1)
  491.  
  492. file = fs.open("SimSoft/Daten/SappS/"..anz,"r")
  493. local fileData = {}
  494. local line = file.readLine()
  495. repeat
  496. table.insert(fileData,line)
  497. line = file.readLine()
  498. until line == nil
  499. file.close()
  500.  
  501. a = fileData[1]
  502. b = fileData[2]
  503. c = fileData[3]
  504.  
  505. b = (b+1)
  506. b = (b-1)
  507.  
  508. c = (c+1)
  509. c = (c-1)
  510.  
  511. AppG(a,b,c)
  512.  
  513. if anz == sc then
  514. break
  515. end
  516. end
  517. end
  518.  
  519. --Touch
  520.  
  521. while true do
  522.  
  523. event,side,x,y = os.pullEvent()
  524. if event == "mouse_click" then
  525.  
  526. --SappS
  527.  
  528. SappSL(2, 7, 5, 7, 1)
  529. SappSL(10, 15, 5, 7, 2)
  530. SappSL(18, 23, 5, 7, 3)
  531. SappSL(26, 31, 5, 7, 4)
  532. SappSL(34, 39, 5, 7, 5)
  533. SappSL(2, 7, 9, 11, 6)
  534. SappSL(10, 15, 9, 11, 7)
  535. SappSL(18, 23, 9, 11, 8)
  536. SappSL(26, 31, 9, 11, 9)
  537. SappSL(34, 39, 9, 11, 10)
  538. SappSL(2, 7, 13, 15, 11)
  539. SappSL(10, 15, 13, 15, 12)
  540. SappSL(18, 23, 13, 15, 13)
  541. SappSL(26, 31, 13, 15, 14)
  542. SappSL(34, 39, 13, 15, 15)
  543.  
  544. if axit == 1 then
  545. break
  546. end
  547.  
  548. --Balkenleisten
  549.  
  550. w, h = term.getSize()
  551.  
  552. if x >= 1 and x <= w and y >= 1 and y <= 3 then
  553.  
  554. BC(256)
  555. Clear()
  556.  
  557. w, h = term.getSize()
  558. BC(128)
  559. TC(1)
  560.  
  561. laenge = 19
  562. titel = "SimSoft 4 - Desktop"
  563.  
  564. anz = 0
  565. hig = 1
  566. while true do
  567. anz = (anz+1)
  568. term.setCursorPos(anz, hig)
  569. write(" ")
  570. if anz == w then
  571. if hig == 3 then
  572. laenge = (laenge/2)
  573. w = (w/2)
  574. w = (w-laenge)
  575.  
  576. term.setCursorPos(w,2)
  577. print(titel)
  578. break
  579. else
  580. hig = (hig+1)
  581. anz = 0
  582. end
  583. end
  584. end
  585.  
  586. CP(2,2)
  587. TC(256)
  588. print(">")
  589.  
  590. w, h = term.getSize()
  591. nr = 3
  592. w = (w-2)
  593.  
  594. w, h = term.getSize()
  595. nr = 3
  596. w = (w-2)
  597.  
  598. while true do
  599. BC(8)
  600. nr = (nr+1)
  601. CP(w,nr)
  602. write(" ")
  603. if nr == h then
  604. w = (w+1)
  605. CP(w,5)
  606. TC(1)
  607. print("@")
  608. h = (h-1)
  609. CP(w,h)
  610. print("@")
  611. break
  612. end
  613. end
  614.  
  615. BC(256)
  616.  
  617. TC(1)
  618. CP(6,5)
  619. print("System")
  620.  
  621. VerSpr()
  622.  
  623. --Version
  624. TC(32768)
  625. CP(4,8)
  626. write("OS-Version - ")
  627. TC(128)
  628. print(SS2V)
  629.  
  630. --ID
  631. CP(4,10)
  632. TC(32768)
  633. write("PC-ID - ")
  634. TC(128)
  635. print(os.getComputerID())
  636.  
  637. --by
  638. CP(4,12)
  639. TC(32768)
  640. write("Copyright - ")
  641. TC(128)
  642. print("Simlor")
  643.  
  644. --Hintergrund
  645. BC(256)
  646. CP(4,14)
  647. TC(1)
  648. print("Edit Background")
  649.  
  650. --Acounts
  651. BC(256)
  652. CP(4,16)
  653. TC(1)
  654. print("Account Manager")
  655.  
  656. while true do
  657.  
  658. file = fs.open("SimSoft/Data/Config","r")
  659. local fileData = {}
  660. local line = file.readLine()
  661. repeat
  662. table.insert(fileData,line)
  663. line = file.readLine()
  664. until line == nil
  665. file.close()
  666. PassSystem = fileData[1]
  667. Hintergrund = fileData[2]
  668. versionOS = fileData[3]
  669. Sprache = fileData[4]
  670.  
  671. if Hintergrund == "true" then
  672. CP(22,14)
  673. BC(8)
  674. write(" ")
  675. BC(32768)
  676. print(" ")
  677. else
  678. CP(22,14)
  679. BC(32768)
  680. write(" ")
  681. BC(128)
  682. print(" ")
  683. end
  684.  
  685. BC(256)
  686.  
  687. event,side,x,y = os.pullEvent()
  688. if event == "mouse_click" then
  689.  
  690. if x >= 4 and x <= 18 and y == 14 then
  691. shell.run("paint SimSoft/Data/DesktopBG")
  692. break
  693. end
  694.  
  695. if x >= 4 and x <= 18 and y == 16 then
  696. shell.run("SimSoft/System/AcManager")
  697. break
  698. end
  699.  
  700. if x >= 22 and x <= 24 and y == 14 then
  701.  
  702. local file = fs.open("SimSoft/Data/Config","w")
  703. file.close()
  704.  
  705. if Hintergrund == "true" then
  706. Hintergrund = "false"
  707. elseif Hintergrund == "false" then
  708. Hintergrund = "true"
  709. end
  710.  
  711. local file = fs.open("SimSoft/Data/Config","a")
  712. file.writeLine(PassSystem)
  713. file.writeLine(Hintergrund)
  714. file.writeLine(SS2V)
  715. file.writeLine(Sprache)
  716. file.close()
  717. end
  718.  
  719. w, h = term.getSize()
  720.  
  721. if x >= 1 and x <= w and y >= 1 and y <= 3 then
  722. break
  723. end
  724.  
  725. wxb = (w-2)
  726.  
  727. if x >= wxb and x <= w and y >= 4 and y <= h then
  728. break
  729. end
  730. end
  731. end
  732. break
  733. end
  734.  
  735. w, h = term.getSize()
  736.  
  737. wxa = (w-2)
  738.  
  739. if x >= wxa and x <= w and y >= 4 and y <= h then
  740.  
  741. w, h = term.getSize()
  742. nr = 3
  743. wa = (w-14)
  744.  
  745. while true do
  746. BC(8)
  747. nr = (nr+1)
  748. CP(wa,nr)
  749. write(" ") --3
  750. if nr == h then
  751. wb = (w-13)
  752. CP(wb,5)
  753. TC(1)
  754. print("@")
  755. h = (h-1)
  756. CP(wb,h)
  757. print("@")
  758. break
  759. end
  760. end
  761.  
  762. ha = h
  763. wc = (w-11)
  764. CP(wc,ha) --40,18 --51
  765. TC(1)
  766. print("by Simlor")
  767.  
  768. wc = (w-11)
  769. CP(wc,5)
  770. TC(32768)
  771. print("SimSoft 4")
  772.  
  773. wc = (w-14)
  774. CP(wc,7)
  775. TC(8)
  776. BC(1)
  777. print(" Restart ")
  778.  
  779. wc = (w-14)
  780. CP(wc,8)
  781. TC(1)
  782. BC(8)
  783. print(" Shutdown ")
  784.  
  785. wc = (w-14)
  786. CP(wc,9)
  787. TC(8)
  788. BC(1)
  789. print(" Shell ")
  790.  
  791. wc = (w-14)
  792. CP(wc,10)
  793. TC(1)
  794. BC(8)
  795. print(" SappS Store ")
  796.  
  797. UpdateC()
  798.  
  799. wc = (w-14)
  800.  
  801. if UpdateCV == true then
  802. CP(wc,11)
  803. TC(8)
  804. BC(1)
  805. print(" OS-Updates ")
  806. else
  807. CP(wc,11)
  808. TC(16384)
  809. BC(1)
  810. print(" OS-Updates ")
  811. end
  812.  
  813. while true do
  814. event,side,x,y = os.pullEvent()
  815. if event == "mouse_click" then
  816.  
  817. w, h = term.getSize()
  818.  
  819. wa = (w-14)
  820.  
  821. if x >= wa and x <= w and y == 7 then
  822. os.reboot()
  823. break
  824. end
  825.  
  826. if x >= wa and x <= w and y == 8 then
  827. os.shutdown()
  828. break
  829. end
  830.  
  831. if x >= wa and x <= w and y == 9 then
  832. term.setBackgroundColor(32768)
  833.  
  834. term.clear()
  835. term.setCursorPos(1,1)
  836. term.setTextColor(1)
  837. print("Back to SimSoft? 'exit'")
  838. shell.run("rom/programs/shell")
  839. break
  840. end
  841.  
  842. if x >= wa and x <= w and y == 10 then
  843. shell.run("SimSoft/System/SappS")
  844. break
  845. end
  846.  
  847. if x >= wa and x <= w and y == 11 then
  848. shell.run("SimSoft/System/SystemUpdate")
  849. break
  850. end
  851.  
  852. --Seitenleiste aus
  853.  
  854. wb = (w-15)
  855.  
  856. if x >= 1 and x <= wb and y >= 4 and y <= h then
  857. break
  858. end
  859. if x >= 1 and x <= w and y >= 1 and y <= 3 then
  860. break
  861. end
  862. end
  863. end
  864. break
  865. end
  866. end
  867. end
  868.  
  869. shell.run("SimSoft/System/Desktop")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement