Advertisement
Mario83w

XCfolders TWO

May 22nd, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.67 KB | None | 0 0
  1. file = "blank"
  2. check = "blank"
  3. ifystem = "blank"
  4. ifsystem2 = "blank"
  5. checkiffile = "blank"
  6. if openf == nil then
  7. openf = "isnil"
  8. end
  9. while true do
  10. if openf == nil then
  11. else
  12. --checkiffile = openf .. "FILEEXECUTE"
  13. checkiffile = openf
  14. systemfiles = "checkfirst*displaybg.nfp*dlwin.nfp*internetbg.nfp*urllist*webdl*temp128*setuppass*openfile.nfp*flag.nfp*black.nfp*boot*hills.nfp*desktop*beginmenu.nfp*begin*icon3.nfp*icon2.nfp*icon1.nfp*login*setupbg.nfp*installprgbg.nfp*update*pb*run*profilelabel*profilepass*profileinbg.nfp*profileset*profilesetbg.nfp*error*error.nfp*display*white*openfilebg.nfp*display.nfp*404*browse*webbg.nfp*audio*calc*startup*text*textsplash.nfp*folders*p*shutdown.nfp*folderbg.nfp*savedata*password*username*BGbackup*backgrounds*icons*icon1.nfp*icon2.nfp*icon3.nfp*setupfinal*internet*00111001*blank*url*keep*Windrows*webbg.nfp"
  15. --if fs.exists(checkiffile) then
  16.  
  17.  
  18.  
  19. ifsystem, ifsystem2 = string.find(systemfiles, checkiffile)
  20. if checkiffile == "Documents" then
  21. ifsystem = 0
  22. elseif checkiffile == "Images" then
  23. ifsystem = 0
  24. elseif checkiffile == "Programs" then
  25. ifsystem = 0
  26. elseif checkiffile == "Windrows" then
  27. ifsystem = 0
  28. elseif ifsystem == 1 then
  29. ifsystem = 0
  30. end
  31. if ifsystem == nil then
  32. ifsystem = 0
  33. end
  34. --[Open folder or file] If not a system file, open it.
  35. if ifsystem == 0 then
  36. openf = ""
  37. if fs.isDir(checkiffile) then
  38. openf = checkiffile
  39. else
  40. shell.run(checkiffile)
  41. end
  42. else
  43. write(ifsystem)
  44. print(" is not 0")
  45. sleep(1)
  46. folder = "C:/"
  47. openf = ""
  48. end
  49. end
  50. paintutils.drawLine(1, 19, 5, 19, colors.gray)
  51. paintutils.drawLine(6, 19, 60, 19, colors.lightGray)
  52. term.setCursorPos(1, 19)
  53. term.setBackgroundColor(colors.gray)
  54. term.setTextColor(colors.white)
  55. write "Begin"
  56. last = "folders"
  57. local function read()
  58. local input = ''
  59. local x,y = term.getCursorPos()
  60.  
  61. term.setCursorBlink(true)
  62.  
  63. repeat
  64. term.setCursorPos(x,y)
  65. term.write(input)
  66.  
  67. local ev, p1 = os.pullEvent()
  68.  
  69. if ev == 'char' then
  70. term.setCursorPos(1, 1)
  71. print (key)
  72. term.setCursorPos(x,y)
  73. if #input < 49 then
  74. if #input > -1 then
  75. input = input .. p1
  76. end
  77. end
  78. elseif ev == 'key' then
  79. if p1 == keys.backspace then
  80. if #input > 0 then
  81. d, yn = term.getCursorPos()
  82. dt = d - 1
  83. term.setCursorPos(dt, 3)
  84. write " "
  85. term.setCursorPos(d, 3)
  86. input = input:sub(1, #input - 1)
  87. end
  88. end
  89. end
  90. until ev == 'key' and p1 == keys.enter
  91.  
  92. term.setCursorBlink(false)
  93. return input
  94. end
  95. function listfs()
  96. num = 0
  97. one = nil
  98. listnum = 0
  99. if openf == nil then
  100. openf = "c"
  101. end
  102. if openf == "c" then
  103. openf = ""
  104. end
  105. ypos = 4
  106. if select == nil then
  107. select = "Choose a folder."
  108. end
  109. one = bu
  110. two = nil
  111. three = nil
  112. four = nil
  113. five = nil
  114. six = nil
  115. seven = nil
  116. eight = nil
  117. on = nil
  118. listnum = 0
  119. local FileList = fs.list(openf)
  120. local counter = 0
  121. local color = {colors.black,colors.black}
  122. for _, check in ipairs(FileList) do
  123. if check == nil then
  124. check = "isnil"
  125. end
  126. f = 1
  127. if check == "password" then
  128. f = 0
  129. elseif check == "username" then
  130. f = 0
  131. elseif check == "rom" then
  132. f = 0
  133. elseif check == "settings" then
  134. f = 0
  135. elseif check == "backgrounds" then
  136. f = 0
  137. elseif check == "BGBACKUP" then
  138. f = 0
  139. elseif check == "previewBG" then
  140. f = 0
  141. elseif check == "savedata" then
  142. f = 0
  143. elseif check == "icons" then
  144. f = 0
  145. end
  146. if openf == "" then
  147. file = check
  148. fname = check
  149. else
  150. file = openf .. "/" .. check
  151. fname = check
  152. end
  153. --d
  154. ifsystem, ifsystem2 = string.find(systemfiles, file)
  155. if ifsystem == nil then
  156. ifsystem = 0
  157. end
  158. if string.find(file, "checkfirst") then
  159. f = 0
  160. end
  161. if string.find(file, "keep") then
  162. f = 0
  163. end
  164. if ifsystem < 1 then
  165. if f == 1 then
  166. ypos = ypos + 1
  167. term.setTextColor(color[(counter % 2) +1])
  168. listnum = listnum + 1
  169. --d
  170. ifsystem, ifsystem2 = string.find(systemfiles, file)
  171. if ifsystem == nil then
  172. ifsystem = 0
  173. end
  174. if string.find(file, "checkfirst") then
  175. f = 0
  176. end
  177. if string.find(file, "keep") then
  178. f = 0
  179. end
  180. if ifsystem < 1 then
  181. if listnum == 1 then
  182. one = file
  183. on = one
  184. elseif listnum == 2 then
  185. two = file
  186. on = two
  187. elseif listnum == 3 then
  188. three = file
  189. on = three
  190. elseif listnum == 4 then
  191. four = file
  192. on = four
  193. elseif listnum == 5 then
  194. five = file
  195. on = five
  196. elseif listnum == 6 then
  197. six = file
  198. on = six
  199. elseif listnum == 7 then
  200. seven = file
  201. on = seven
  202. end
  203. if listnum == 8 then
  204. eight = file
  205. on = eight
  206. end
  207. if listnum == 9 then
  208. nine = file
  209. on = nine
  210. end
  211. if listnum == 10 then
  212. ten = file
  213. on = ten
  214. end
  215. if listnum == 11 then
  216. eleven = file
  217. on = eleven
  218. end
  219. if listnum == 12 then
  220. twelve = file
  221. on = twelve
  222. end
  223. if listnum == 13 then
  224. thirteen = file
  225. on = thirteen
  226. end
  227. end
  228. term.setCursorPos(14, ypos)
  229. if select == on then
  230. term.setBackgroundColor(colors.black)
  231. term.setTextColor(colors.white)
  232. paintutils.drawLine(14, ypos, 39, ypos, colors.black)
  233. term.setCursorPos(14, ypos)
  234. --selex = select .. "FILEEXECUTE"
  235. selex = select
  236. --if fs.exists(selex) then
  237. if not(fs.isDir(selex)) then
  238. else
  239. write "(Folder) "
  240. end
  241. write (select)
  242. --if ran == nil then
  243. --ofbu = openf
  244. --shell.run("cppa")
  245. --end
  246. if ran == 1 then
  247. ran = nil
  248. end
  249. select = nil
  250. else
  251. term.setBackgroundColor(colors.white)
  252. term.setTextColor(colors.black)
  253. end
  254. if num < 13 then
  255. --PART2
  256. --checkiffile = file .. "FILEEXECUTE"
  257. --if fs.exists(checkiffile) then
  258. checkiffile = file
  259. if not(fs.isDir(checkiffile)) then
  260. term.setTextColor(colors.black)
  261. else
  262. term.setTextColor(colors.black)
  263. write "(Folder) "
  264. end
  265. print(fname)
  266. end
  267. num = num + 1
  268. counter = counter+1
  269. end
  270. else
  271. if folder == "C:/" then
  272. else
  273. if f == 1 then
  274. ypos = ypos + 1
  275. term.setTextColor(color[(counter % 2) +1])
  276. listnum = listnum + 1
  277. --d
  278. ifsystem, ifsystem2 = string.find(systemfiles, file)
  279. if ifsystem == nil then
  280. ifsystem = 0
  281. end
  282. if string.find(file, "checkfirst") then
  283. f = 0
  284. end
  285. if string.find(file, "keep") then
  286. f = 0
  287. end
  288. if ifsystem < 1 then
  289. if listnum == 1 then
  290. one = file
  291. on = one
  292. elseif listnum == 2 then
  293. two = file
  294. on = two
  295. elseif listnum == 3 then
  296. three = file
  297. on = three
  298. elseif listnum == 4 then
  299. four = file
  300. on = four
  301. elseif listnum == 5 then
  302. five = file
  303. on = five
  304. elseif listnum == 6 then
  305. six = file
  306. on = six
  307. elseif listnum == 7 then
  308. seven = file
  309. on = seven
  310. end
  311. if listnum == 8 then
  312. eight = file
  313. on = eight
  314. end
  315. if listnum == 9 then
  316. nine = file
  317. on = nine
  318. end
  319. if listnum == 10 then
  320. ten = file
  321. on = ten
  322. end
  323. if listnum == 11 then
  324. eleven = file
  325. on = eleven
  326. end
  327. if listnum == 12 then
  328. twelve = file
  329. on = twelve
  330. end
  331. if listnum == 13 then
  332. thirteen = file
  333. on = thirteen
  334. end
  335. end
  336. term.setCursorPos(14, ypos)
  337. if select == on then
  338. term.setBackgroundColor(colors.black)
  339. term.setTextColor(colors.white)
  340. paintutils.drawLine(14, ypos, 39, ypos, colors.black)
  341. term.setCursorPos(14, ypos)
  342. else
  343. term.setBackgroundColor(colors.white)
  344. term.setTextColor(colors.black)
  345. end
  346. if num < 13 then
  347. print(file)
  348. end
  349. num = num + 1
  350. counter = counter+1
  351. end
  352. end
  353. end
  354. end
  355. end
  356. local win = paintutils.loadImage("folderbg.nfp")
  357. paintutils.drawImage(win, 1, 1)
  358. term.setCursorPos(1, 1)
  359. term.setTextColor(colors.white)
  360. term.setBackgroundColor(colors.cyan)
  361. if openf == nil then
  362. folder = "C:/"
  363. end
  364. if openf == "c" then
  365. folder = "C:/"
  366. end
  367. write "Windrows Explorer"
  368. term.setCursorPos(51, 1)
  369. term.setBackgroundColor(colors.red)
  370. write "X"
  371. term.setCursorPos(2, 3)
  372. term.setBackgroundColor(colors.white)
  373. term.setTextColor(colors.black)
  374. if openf == nil then
  375. term.setCursorPos(2, 3)
  376. write "C:/"
  377. elseif openf == "c" then
  378. term.setCursorPos(2, 3)
  379. write "C:/"
  380. else
  381. if folder == nil then
  382. folder = "C:/" .. openf
  383. end
  384. write (folder)
  385. print (openf)
  386. end
  387. term.setBackgroundColor(colors.white)
  388. term.setTextColor(colors.cyan)
  389. term.setCursorPos(2, 6)
  390. write "Tasks"
  391. term.setCursorPos(2, 10)
  392. write "Places"
  393. term.setCursorPos(2, 7)
  394. term.setTextColor(colors.cyan)
  395. term.setBackgroundColor(colors.lightBlue)
  396. print "Make Folder"
  397. term.setCursorPos(2, 8)
  398. print "Delete"
  399. term.setCursorPos(2, 11)
  400. print "Images"
  401. term.setCursorPos(2, 12)
  402. print "Disk"
  403. term.setCursorPos(2, 13)
  404. print "Programs"
  405. term.setCursorPos(2, 14)
  406. print "Windrows"
  407. term.setCursorPos(2, 15)
  408. print "C:/"
  409. term.setCursorPos(15, 5)
  410. term.setTextColor(colors.black)
  411. term.setBackgroundColor(colors.white)
  412. listfs()
  413. local event, button, x, y = os.pullEvent("mouse_click")
  414. if y == 1 then
  415. if x == 51 then
  416. last = "desktop"
  417. openf = ""
  418. shell.run("desktop")
  419. end
  420. end
  421. if y == 7 then
  422. if x > 1 then
  423. if x < 13 then
  424. paintutils.drawLine(2, 7, 12, 7, colors.black)
  425. term.setTextColor(colors.white)
  426. term.setBackgroundColor(colors.black)
  427. term.setCursorPos(2, 7)
  428. write "Make Folder"
  429. sleep(0.1)
  430. paintutils.drawLine(2, 7, 12, 7, colors.lightBlue)
  431. term.setTextColor(colors.cyan)
  432. term.setBackgroundColor(colors.lightBlue)
  433. term.setCursorPos(2, 7)
  434. write "Make Folder"
  435. paintutils.drawLine(2, 3, 50, 3, colors.white)
  436. term.setCursorPos(2, 3)
  437. term.setTextColor(colors.black)
  438. newfname = read()
  439. exists = fs.exists(newfname)
  440. if exists == false then
  441. if openf == nil then
  442. fs.makeDir(newfname)
  443. copy = "copy keep " .. newfname
  444. shell.run(copy)
  445. else
  446. make = openf .. "/" .. newfname
  447. fs.makeDir(make)
  448. copy = "copy keep " .. make
  449. shell.run(copy)
  450. end
  451. else
  452. errortitle = "Cannot make folder"
  453. error = " Folder already"
  454. error2 = " exists."
  455. errora = "fs.exists returned true"
  456. newfname = nil
  457. exists = nil
  458. shell.run("error")
  459. end
  460. end
  461. end
  462. end
  463. if y == 8 then
  464. if x > 1 then
  465. if x < 13 then
  466. paintutils.drawLine(2, 8, 12, 8, colors.black)
  467. term.setTextColor(colors.white)
  468. term.setBackgroundColor(colors.black)
  469. term.setCursorPos(2, 8)
  470. write "Delete"
  471. sleep(0.1)
  472. paintutils.drawLine(2, 8, 12, 8, colors.lightBlue)
  473. term.setTextColor(colors.cyan)
  474. term.setBackgroundColor(colors.lightBlue)
  475. term.setCursorPos(2, 8)
  476. write "Delete"
  477. paintutils.drawLine(2, 3, 50, 3, colors.white)
  478. term.setCursorPos(2, 3)
  479. term.setTextColor(colors.black)
  480. delfname = read()
  481. delfname = openf .. "/" .. delfname
  482. --delexcheck = delfname .. "FILEEXECUTE"
  483. delexcheck = delfname
  484. if fs.exists(delfname) then
  485. fs.delete(delfname)
  486. if fs.exists(delexcheck) then
  487. fs.delete(delexcheck)
  488. end
  489. else
  490. delete = openf .. "/" .. delfname
  491. if fs.exists(delete) then
  492. fs.delete(delete)
  493. else
  494. errortitle = "Cannot delete"
  495. error = " File doesn't"
  496. error2 = " exist."
  497. errora = "fs.exists returned false"
  498. shell.run("error")
  499. end
  500. end
  501. end
  502. end
  503. end
  504. if x < 6 then
  505. if y == 19 then
  506. term.setCursorPos(1, 19)
  507. term.setBackgroundColor(colors.black)
  508. term.setTextColor(colors.white)
  509. write "Begin"
  510. sleep(0.1)
  511. shell.run("begin")
  512. end
  513. end
  514. if x > 13 then
  515. if y > 4 then
  516. if y == 5 then
  517. if button == 1 then
  518. openf = one
  519. bu = openf
  520. else
  521. select = one
  522. end
  523. elseif y == 6 then
  524. if button == 1 then
  525. openf = two
  526. bu = openf
  527. else
  528. select = two
  529. end
  530. elseif y == 7 then
  531. if button == 1 then
  532. openf = three
  533. bu = openf
  534. else
  535. select = three
  536. end
  537. elseif y == 8 then
  538. if button == 1 then
  539. openf = four
  540. bu = openf
  541. else
  542. select = four
  543. end
  544. elseif y == 9 then
  545. if button == 1 then
  546. openf = five
  547. bu = openf
  548. else
  549. select = five
  550. end
  551. elseif y == 10 then
  552. if button == 1 then
  553. openf = six
  554. bu = openf
  555. else
  556. select = six
  557. end
  558. elseif y == 11 then
  559. if button == 1 then
  560. openf = seven
  561. bu = openf
  562. else
  563. select = seven
  564. end
  565. elseif y == 12 then
  566. if button == 1 then
  567. openf = eight
  568. bu = openf
  569. else
  570. select = eight
  571. end
  572. elseif y == 13 then
  573. if button == 1 then
  574. openf = nine
  575. bu = openf
  576. else
  577. select = nine
  578. end
  579. elseif y == 14 then
  580. if button == 1 then
  581. openf = ten
  582. bu = openf
  583. else
  584. select = ten
  585. end
  586. elseif y == 15 then
  587. if button == 1 then
  588. openf = eleven
  589. bu = openf
  590. else
  591. select = eleven
  592. end
  593. elseif y == 16 then
  594. if button == 1 then
  595. openf = twelve
  596. bu = openf
  597. else
  598. select = twelve
  599. end
  600. elseif y == 17 then
  601. if button == 1 then
  602. openf = thirteen
  603. bu = openf
  604. else
  605. select = thirteen
  606. end
  607. end
  608. end
  609. end
  610. if y == 11 then
  611. if x > 1 then
  612. if x < 13 then
  613. paintutils.drawLine(2, 11, 12, 11, colors.black)
  614. term.setBackgroundColor(colors.black)
  615. term.setTextColor(colors.white)
  616. term.setCursorPos(2, 11)
  617. write "Images"
  618. sleep(0.1)
  619. if fs.exists("Documents/Images") then
  620. openf = "Documents/Images"
  621. else
  622. errortitle = "Cannot open"
  623. error = " You deleted the"
  624. error2 = " folder."
  625. errora = "fs.exists returned false."
  626. newfname = nil
  627. exists = nil
  628. shell.run("error")
  629. end
  630. end
  631. end
  632. end
  633. if y == 12 then
  634. if x > 1 then
  635. if x < 13 then
  636. paintutils.drawLine(2, 12, 12, 12, colors.black)
  637. term.setBackgroundColor(colors.black)
  638. term.setTextColor(colors.white)
  639. term.setCursorPos(2, 12)
  640. write "Disk"
  641. sleep(0.1)
  642. if fs.exists("disk") then
  643. openf = "disk"
  644. else
  645. errortitle = "Cannot open"
  646. error = " There is no"
  647. error2 = " disk."
  648. errora = "fs.exists returned false."
  649. newfname = nil
  650. exists = nil
  651. shell.run("error")
  652. end
  653. end
  654. end
  655. end
  656. if y == 13 then
  657. if x > 1 then
  658. if x < 13 then
  659. paintutils.drawLine(2, 13, 12, 13, colors.black)
  660. term.setBackgroundColor(colors.black)
  661. term.setTextColor(colors.white)
  662. term.setCursorPos(2, 13)
  663. write "Programs"
  664. sleep(0.1)
  665. if fs.exists("Programs") then
  666. openf = "Programs"
  667. else
  668. errortitle = "Cannot open"
  669. error = " You deleted the"
  670. error2 = " folder."
  671. errora = "fs.exists returned false."
  672. newfname = nil
  673. exists = nil
  674. shell.run("error")
  675. end
  676. end
  677. end
  678. end
  679. if y == 14 then
  680. if x > 1 then
  681. if x < 13 then
  682. paintutils.drawLine(2, 14, 12, 14, colors.black)
  683. term.setBackgroundColor(colors.black)
  684. term.setTextColor(colors.white)
  685. term.setCursorPos(2, 14)
  686. write "Windrows"
  687. sleep(0.1)
  688. if fs.exists("Windrows") then
  689. openf = "Windrows"
  690. else
  691. errortitle = "Cannot open"
  692. error = " You deleted the"
  693. error2 = " folder."
  694. errora = "fs.exists returned false."
  695. newfname = nil
  696. exists = nil
  697. shell.run("error")
  698. end
  699. end
  700. end
  701. end
  702. if y == 15 then
  703. if x > 1 then
  704. if x < 13 then
  705. paintutils.drawLine(2, 15, 12, 15, colors.black)
  706. term.setBackgroundColor(colors.black)
  707. term.setTextColor(colors.white)
  708. term.setCursorPos(2, 15)
  709. write "C:/"
  710. sleep(0.1)
  711. openf = ""
  712. end
  713. end
  714. end
  715. xbu = x
  716. ybu = y
  717. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement