· 6 years ago · Feb 08, 2020, 11:54 AM
1{
2 {
3 text = " 70 70 70 70 70 70\
4 70<70-70-70 70 70\
5 70 70-70-70>70 70\
6 80 80 80 80 80 80",
7 path = "//.ds/sys/Backup.apk/Resources/icon.png",
8 },
9 {
10 text = "local arg = {...}\
11\
12local function restore(chto,kuda)\
13\009local file = fs.open(chto,\"r\")\
14\009Massiv = textutils.unserialise(file.readAll())\
15\009file.close()\
16\009for i=1,#Massiv do\
17\009\009if Massiv[i][\"text\"] == \"@empty@empty\" then\
18\009\009\009fs.makeDir(kuda..\"/\"..Massiv[i][\"path\"])\
19\009\009else\
20\009\009\009local file = fs.open(kuda..\"/\"..Massiv[i][\"path\"],\"w\")\
21\009\009\009file.write(Massiv[i][\"text\"])\
22\009\009\009file.close()\
23\009\009end\
24\009end\
25\009fs.delete('/System/desks/desk.back')\
26\009fs.delete('/System/accounts/accs.back')\
27end\
28\
29local clear = function(color)\
30\009term.setBackgroundColor(color)\
31\009term.clear()\
32\009term.setCursorPos(1,1)\
33end\
34\
35local text = function(string,xPos,yPos)\
36\009term.setCursorPos(xPos,yPos)\
37\009term.write(string)\
38end\
39\
40if arg[1] == nil then\
41\009os.loadAPI(\"/System/API/sysbar\")\
42\009os.loadAPI('/System/API/contexts')\
43\009local run = true\
44\009local xSize, ySize = term.getSize()\
45\009local xCenter = math.floor(xSize/2)\
46\009local yCenter = math.floor(ySize/2)\
47\009local check = 0\
48\009local find = false\
49\
50\009local function backup(chto,vochto)\
51\009\009local Massiv2 = {}\
52\009\009if find then\
53\009\009\009fs.delete('/backup.rom')\
54\009\009end\
55\009\009local function FileList(path)\
56\009\009\009local Massiv = fs.list(path)\
57\009\009\009if #Massiv==0 then\
58\009\009\009\009local Massiv2Id = #Massiv2 + 1\
59\009\009\009\009Massiv2[Massiv2Id] = {}\
60\009\009\009\009Massiv2[Massiv2Id][\"path\"] = path\
61\009\009\009\009Massiv2[Massiv2Id][\"text\"] = \"@empty@empty\"\
62\009\009\009else\
63\009\009\009\009if check == 0 then\
64\009\009\009\009\009local f = fs.open('/System/desks/desk.back','w')\
65\009\009\009\009\009f.write('{...}')\
66\009\009\009\009\009f.close()\
67\009\009\009\009\009local f = fs.open('/System/accounts/accs.back','w')\
68\009\009\009\009\009f.write('{...}')\
69\009\009\009\009\009f.close()\
70\009\009\009\009\009for i=1,#Massiv do\
71\009\009\009\009\009\009if fs.isDir(path..\"/\"..Massiv[i]) and Massiv[i] ~= \"/rom\" and Massiv[i] ~= \"rom\" and (string.find(path..\"/\"..Massiv[i],'System') ~= nil or string.find(path..\"/\"..Massiv[i],'sys') ~= nil or string.find(path..\"/\"..Massiv[i],'.ds') ~= nil) then\
72\009\009\009\009\009\009\009FileList(path..\"/\"..Massiv[i])\
73\009\009\009\009\009\009elseif not fs.isDir(path..\"/\"..Massiv[i]) and Massiv[i] ~= \"/rom\" and Massiv[i] ~= \"rom\" and (string.find(path..\"/\"..Massiv[i],'startup') ~= nil or string.find(path..\"/\"..Massiv[i],'launcher') ~= nil or string.find(path..\"/\"..Massiv[i],'System') ~= nil or string.find(path..\"/\"..Massiv[i],'sys') ~= nil) and (string.find(path..\"/\"..Massiv[i],'desks') == nil or string.find(path..\"/\"..Massiv[i],'desks/desk.back') ~= nil) and (string.find(path..\"/\"..Massiv[i],'accounts') == nil or string.find(path..\"/\"..Massiv[i],'accounts/accs.back') ~= nil) and string.find(path..\"/\"..Massiv[i],l_login..'.png') == nil then\
74\009\009\009\009\009\009\009local Massiv2Id = #Massiv2 + 1\
75\009\009\009\009\009\009\009Massiv2[Massiv2Id] = {}\
76\009\009\009\009\009\009\009Massiv2[Massiv2Id][\"path\"] = path..\"/\"..Massiv[i]\
77\009\009\009\009\009\009\009local file = fs.open(path..\"/\"..Massiv[i],\"r\")\
78\009\009\009\009\009\009\009Massiv2[Massiv2Id][\"text\"] = file.readAll()\
79\009\009\009\009\009\009\009file.close()\
80\009\009\009\009\009\009end\
81\009\009\009\009\009end\
82\009\009\009\009elseif check == 2 then\
83\009\009\009\009\009for i=1,#Massiv do\
84\009\009\009\009\009\009if fs.isDir(path..\"/\"..Massiv[i]) and Massiv[i] ~= \"/rom\" and Massiv[i] ~= \"rom\" then\
85\009\009\009\009\009\009\009FileList(path..\"/\"..Massiv[i])\
86\009\009\009\009\009\009elseif not fs.isDir(path..\"/\"..Massiv[i]) and Massiv[i] ~= \"/rom\" and Massiv[i] ~= \"rom\" and Massiv[i] ~= \"backup.rom\" then\
87\009\009\009\009\009\009\009local Massiv2Id = #Massiv2 + 1\
88\009\009\009\009\009\009\009Massiv2[Massiv2Id] = {}\
89\009\009\009\009\009\009\009Massiv2[Massiv2Id][\"path\"] = path..\"/\"..Massiv[i]\
90\009\009\009\009\009\009\009local file = fs.open(path..\"/\"..Massiv[i],\"r\")\
91\009\009\009\009\009\009\009Massiv2[Massiv2Id][\"text\"] = file.readAll()\
92\009\009\009\009\009\009\009file.close()\
93\009\009\009\009\009\009end\
94\009\009\009\009\009end\
95\009\009\009\009end\
96\009\009\009end\
97\009\009end\
98\009\009FileList(chto)\
99\009\009file=fs.open(vochto..\".rom\",\"w\")\
100\009\009file.write(textutils.serialise(Massiv2))\
101\009\009file.close()\
102\009\009fs.delete('/System/desks/desk.back')\
103\009\009fs.delete('/System/accounts/accs.back')\
104\009\009return Massiv2\
105\009end\
106\
107\009local sysBar = function()\
108\009\009sysbar.header(\"Backup\",mainTextCol,mainColor)\
109\009\009sysbar.draw(colors.white,colors.black,noty,true,find)\
110\009end\
111\
112\009local redraw = function()\
113\009\009clear(colors.white)\
114\009\009term.setTextColor(colors.black)\
115\009\009text(\"Only system files\",3,4)\
116\009\009text(\"All data\",3,6)\
117\009\009term.setTextColor(colors.lightGray)\
118\009\009text(\"( )\",xSize-4,4)\
119\009\009text(\"( )\",xSize-4,6)\
120\009\009term.setTextColor(style)\
121\009\009text(string.char(7),xSize-3,check+4)\
122\009\009term.setTextColor(colors.lime)\
123\009\009local f = fs.list('/')\
124\009\009find = false\
125\009\009for i=1,#f do\
126\009\009\009if f[i]=='backup.rom' then find = true end\
127\009\009end\
128\009\009if find then\
129\009\009\009text('Restore',xCenter-2,ySize-2)\
130\009\009\009\009term.setTextColor(colors.lightGray)\
131\009\009end\
132\009\009text('Backup',xCenter-2,ySize-4)\
133\009\009sysBar()\
134\009end\
135\
136\
137\009local running = function()\
138\009\009while run do\
139\009\009\009event, side, x, y = os.pullEvent()\
140\009\009\009if event == \"mouse_click\" then\
141\009\009\009\009if sysbar.back(x,y) then\
142\009\009\009\009\009term.clear()\
143\009\009\009\009\009term.setCursorPos(1,1)\
144\009\009\009\009\009run = false\
145\009\009\009\009elseif sysbar.home(x,y) then\
146\009\009\009\009\009home = true\
147\009\009\009\009\009term.clear()\
148\009\009\009\009\009term.setCursorPos(1,1)\
149\009\009\009\009\009run = false\
150\009\009\009\009elseif y==4 then\
151\009\009\009\009\009check = 0\
152\009\009\009\009elseif y==6 then\
153\009\009\009\009\009check = 2\
154\009\009\009\009elseif y==ySize-4 and x>=xCenter-2 and x<=xCenter+3 then\
155\009\009\009\009\009clear(colors.gray)\
156\009\009\009\009\009term.setTextColor(colors.white)\
157\009\009\009\009\009text('Backup...',xCenter-4,yCenter)\
158\009\009\009\009\009backup('/','backup')\
159\009\009\009\009\009local error = 'Something went wrong'\
160\009\009\009\009\009if fs.getSize('/backup.rom') < 2 then\
161\009\009\009\009\009\009windows.error(error)\
162\009\009\009\009\009else\
163\009\009\009\009\009\009windows.attention(\"Success!\",'Backup completed')\
164\009\009\009\009\009end\
165\009\009\009\009elseif y==ySize-2 and x>=xCenter-2 and x<=xCenter+4 and find then\
166\009\009\009\009\009clear(colors.white)\
167\009\009\009\009\009restore('/backup.rom','/')\
168\009\009\009\009\009os.reboot()\
169\009\009\009\009elseif x==xSize and y==ySize and find then\
170\009\009\009\009\009term.setTextColor(colors.lightGray)\
171\009\009\009\009\009term.setBackgroundColor(colors.gray)\
172\009\009\009\009\009text('|',xSize,ySize)\
173\009\009\009\009\009local but = contexts.main(xSize,ySize-1,'Remove backup')\
174\009\009\009\009\009if but == 'Remove backup' then\
175\009\009\009\009\009\009redraw()\
176\009\009\009\009\009\009local bu = windows.select({\"Dellete backup\"},{\"Are you sure?\"},{\"Yes\",colors.red,colors.white},{\"No\",colors.gray,colors.white})\
177\009\009\009\009\009\009if bu == 'Yes' then\
178\009\009\009\009\009\009\009fs.delete('/backup.rom')\
179\009\009\009\009\009\009end\
180\009\009\009\009\009end\
181\009\009\009\009end\
182\009\009\009\009redraw()\
183\009\009\009end\
184\009\009end\
185\009end\
186\
187\009redraw()\
188\009running()\
189\
190elseif arg[1] == '-restore' or arg[1] == '-r' then\
191\009clear(colors.black)\
192\009term.setTextColor(colors.lime)\
193\009text('Restoring...',2,2)\
194\009if arg[2] == nil then\
195\009\009local file = fs.list('/')\
196\009\009local find = false\
197\009\009for i=1,#file do\
198\009\009\009if file[i] == 'backup.rom' then find = true end\
199\009\009end\
200\009\009if find then\
201\009\009\009restore('/backup.rom','/')\
202\009\009\009os.reboot()\
203\009\009else\
204\009\009\009term.setTextColor(colors.red)\
205\009\009\009text('ERROR: no matching file',2,4)\
206\009\009\009term.setCursorPos(1,6)\
207\009\009end\
208\009else\
209\009\009local file = fs.list('/')\
210\009\009local find = false\
211\009\009for i=1,#file do\
212\009\009\009if file[i] == arg[2] then find = true end\
213\009\009end\
214\009\009if find then\
215\009\009\009restore(arg[2],'/')\
216\009\009\009os.reboot()\
217\009\009else\
218\009\009\009term.setTextColor(colors.red)\
219\009\009\009text('ERROR: no matching file',2,4)\
220\009\009\009term.setCursorPos(1,6)\
221\009\009end\
222\009end\
223end",
224 path = "//.ds/sys/Backup.apk/main",
225 },
226 {
227 text = "\\80 80|80|80 70/80\
228-80_f0_f0/f0 70-80\
229-80 00 70 70 70-80\
230/80 00|80|80 00\\80",
231 path = "//.ds/sys/Clock.apk/Resources/icon.png",
232 },
233 {
234 text = "--???????? ?? ????? ?? ECS http://pastebin.com/Xn8THcUC\
235os.loadAPI(\"/System/API/windows\")\
236os.loadAPI(\"/System/API/sysbar\")\
237os.loadAPI(\"/System/API/image\")\
238local xSize, ySize = term.getSize()\
239local xCenter, yCenter = math.floor(xSize/2), math.floor(ySize/2)\
240local run = true\
241local digits = {'0.png','1.png','2.png','3.png','4.png','5.png','6.png','7.png','8.png','9.png','dots.png'}\
242local comp = 0\
243if xSize > 30 then comp = 1 end\
244\
245local function clear(color)\
246\009term.setBackgroundColor(color)\
247\009term.clear()\
248end\
249\
250local function fadeIn(time)\
251 for i=1,ySize-1 do\
252 paintutils.drawLine(1,i,xSize,i,mainColor)\
253 sleep(time)\
254 end\
255end\
256\
257local function fadeOut(time)\
258 for i=0,xSize do\
259 paintutils.drawLine(xSize-i,0,xSize-i,ySize-1,colors.black)\
260 paintutils.drawLine(xSize-i,1,xSize,1,colors.black)\
261 sleep(time)\
262 end\
263\009term.setCursorPos(1,1)\
264\009term.setTextColor(colors.white)\
265end\
266\
267local function text(text,x,y)\
268\009term.setCursorPos(x,y)\
269\009term.write(text)\
270end\
271\
272local sysBar = function()\
273 term.setTextColor(colors.black)\
274 term.setBackgroundColor(colors.white)\
275 sysbar.draw(colors.white,colors.black,noty,true,false,false)\
276end\
277\
278local formatTime = function(nTime)\
279 local nHour = math.floor(nTime)\
280 local nMinute = math.floor((nTime - nHour)*60)\
281 return nHour, nMinute\
282end\
283\
284local drawDots = function()\
285\009while true do\
286\009\009image.draw(xCenter,yCenter-3,'/System/clocks/'..digits[11])\
287\009\009sleep(0.5)\
288\009\009paintutils.drawFilledBox(xCenter,yCenter-3,xCenter+1,yCenter+3,style)\
289\009\009sleep(0.5)\
290\009end\
291end\
292\
293local globalClock = function(time)\
294\009while true do\
295\009\009local globalTime = os.time()\
296\009\009local hour, minute = formatTime(globalTime)\
297\009\009paintutils.drawFilledBox(xCenter-10,yCenter-3,xCenter-1,yCenter+3,style)\
298\009\009paintutils.drawFilledBox(xCenter+3,yCenter-3,xCenter+11,yCenter+3,style)\
299\009\009image.draw(xCenter-10,yCenter-3,'/System/clocks/'..digits[math.floor(hour/10)+1])\
300\009\009image.draw(xCenter-5,yCenter-3,'/System/clocks/'..digits[math.floor(hour%10)+1])\
301\009\009image.draw(xCenter+3,yCenter-3,'/System/clocks/'..digits[math.floor(minute/10)+1])\
302\009\009image.draw(xCenter+8,yCenter-3,'/System/clocks/'..digits[math.floor(minute%10)+1])\
303\009\009sleep(1)\
304\009end\
305end\
306\
307local function redraw()\
308 clear(style)\
309 sysBar()\
310end\
311\
312local function touch()\
313 while true do\
314 --clock()\
315 event, side, x, y = os.pullEvent()\
316 if event == \"mouse_click\" then\
317 if sysbar.back(x,y) then\
318 break\
319 elseif sysbar.home(x,y) then\
320 home = true\
321 break\
322 end\
323 end\
324 end\
325end\
326\
327redraw()\
328parallel.waitForAny(globalClock,touch,drawDots)\
329clear(colors.black)",
330 path = "//.ds/sys/Clock.apk/main",
331 },
332 {
333 text = " 04 04 04 04######\
334-04-04-04-04-04-04\
335B04r04o04w04s04e04\
336-04-04-04-04-04-04",
337 path = "//.ds/sys/FileBrowser.apk/Resources/icon.png",
338 },
339 {
340 text = "os.loadAPI(\"/System/API/sysbar\")\
341local Args = {...}\
342local run = true\
343local xSize, ySize = term.getSize()\
344local cursor = 0\
345local path = Args[1]\
346local text = ''\
347local line = 0\
348local step = 2\
349local run = true\
350local screen = window.create(term.current(),1,3,xSize,ySize-3)\
351\
352local clear = function(color)\
353\009term.setBackgroundColor(color)\
354\009term.clear()\
355\009term.setCursorPos(1,1)\
356end\
357\
358local usualText = function(string,xPos,yPos)\
359\009term.setCursorPos(xPos,yPos)\
360\009term.write(string)\
361end\
362\
363local sysBar = function()\
364\009sysbar.header(path,mainTextCol,mainColor)\
365\009local i = 1\
366\009local curs = -cursor\
367\009while curs > 9 do\
368\009 curs = math.floor(curs/10)\
369\009 i = i + 1\
370\009end\
371\009usualText('Ln: '..-cursor+1,xSize-i-3,1)\
372\009i = 1\
373\009curs = line\
374\009while curs > 9 do\
375\009 curs = math.floor(curs/10)\
376\009 i = i + 1\
377\009end\
378\009usualText('of '..line-1,xSize-i-2,2)\
379\009sysbar.draw(colors.white,colors.black,noty,true,false)\
380end\
381\
382local redraw = function()\
383\009term.redirect(screen)\
384\009clear(colors.white)\
385\009term.setTextColor(colors.black)\
386\009line = 0\
387\009local file = fs.open(path,'r')\
388\009text = file.readLine()\
389\009while text~=nil do\
390\009\009usualText(text,2,line+1+cursor)\
391\009\009local i = 1\
392\009\009while text ~= nil and #text > xSize*i do\
393\009\009\009line = line + 1\
394\009\009\009usualText(text,2-xSize*i+i,line+1+cursor)\
395\009\009\009usualText(string.char(16),1,line+1+cursor)\
396\009\009\009i = i + 1\
397\009\009end\
398\009\009line = line + 1\
399\009\009text = file.readLine()\
400\009end\
401\009file.close()\
402\009term.redirect(term.native())\
403\009sysBar()\
404end\
405\
406local running = function()\
407 while run == true do\
408 event, side, x, y = os.pullEvent()\
409 if event == \"mouse_scroll\" then\
410 if line>ySize-3 then\
411 if side == 1 then\
412 if cursor>-line+ySize-2 then\
413 cursor = cursor-2\
414 else\
415 cursor = -line+ySize-2\
416 end \
417 elseif side == -1 then\
418 if cursor<0 then \
419 cursor = cursor+2\
420 else\
421 cursor = 0\
422 end\
423 end\
424 redraw()\
425 end\
426 elseif event == \"mouse_click\" then\
427 if sysbar.back(x,y) == true then\
428 clear(colors.black)\
429\009run = false\
430 elseif sysbar.home(x,y) == true then\
431 clear(colors.black)\
432\009home = true\
433 run = false\
434\009break\
435 end\
436 end\
437 term.redirect(term.native())\
438 end\
439end\
440\
441redraw()\
442running()",
443 path = "//.ds/sys/FileBrowser.apk/Resources/reader",
444 },
445 {
446 text = "local Args = {...}\
447\
448local run = true\
449local xSize, ySize = term.getSize()\
450local xCenter = math.floor(xSize/2)\
451local yCenter = math.floor(ySize/2)\
452local obj = {}\
453local path = \"/\"\
454local files = {}\
455local pos = 0\
456local prevPath = {}\
457prevPath[0] = \"/\"\
458local history = 0\
459local lenthScroll = 0\
460local posScroll = 0\
461local step = 0\
462local lenthPage = 0\
463local select = 0\
464local selects = {}\
465local sel = false\
466local contex = false\
467local corpath = \"\"\
468local screen = window.create(term.native(),1,3,xSize-1,ySize-3)\
469local draw = true\
470local ender = 0\
471\
472local function init()\
473\009icoFld = '/System/folder.png'\
474\009icoApp = \"/System/app.png\"\
475\009icoProg = \"/System/prog.png\"\
476\009icoPic = \"/System/picture.png\"\
477\009icoTxt = \"/System/text.png\"\
478\009icoZip = \"/System/archive.png\"\
479\009icoRom = \"/System/rom.png\"\
480\009icoUnk = \"/System/unknown.png\"\
481\009header = \"File Manager\"\
482\009os.loadAPI(\"/System/API/image\")\
483\009os.loadAPI(\"/System/API/sysbar\")\
484\009os.loadAPI(\"/System/API/zip\")\
485\009os.loadAPI(\"/System/API/contexts\")\
486end\
487\
488local newObj = function(name,x1,y1,x2,y2)\
489 obj[name] = {}\
490 obj[name][\"x1\"] = x1\
491 obj[name][\"y1\"] = y1\
492 obj[name][\"x2\"] = x2\
493 obj[name][\"y2\"] = y2\
494end\
495\
496local clear = function(color)\
497 term.setBackgroundColor(color)\
498 term.clear()\
499 term.setCursorPos(1,1)\
500end\
501\
502if version < '5.1.1' then\
503 clear(colors.white)\
504 windows.error('Update your OS')\
505 run = false\
506else\
507 --os.loadAPI(\"/System/API/contexts\")\
508end\
509\
510local text = function(string,xPos,yPos)\
511 term.setCursorPos(xPos,yPos)\
512 term.write(string)\
513end\
514\
515local fadeIn = function()\
516 for i=1,xSize do\
517 paintutils.drawLine(i,1,i,ySize-1,colors.black)\
518 sleep(0)\
519 end\
520end\
521\
522if not(icoFld) then\
523\009init()\
524end\
525\
526local function fadeOut(time)\
527 clear(colors.lightGray)\
528 sleep(time)\
529 clear(colors.gray)\
530 sleep(time)\
531 clear(colors.black)\
532 sleep(time)\
533 term.setCursorPos(1,1)\
534 term.setTextColor(colors.black)\
535end\
536\
537local sysBar = function()\
538\009step = sysbar.scrollBar(#files,4,posScroll,2)\
539\009sysbar.header(header,mainTextCol,mainColor)\
540\009if #path>xSize then\
541\009\009text(path,xSize-#path+1,2)\
542\009\009text(\"...\",2,2)\
543\009else\
544\009\009text(path,1,2)\
545\009end\
546\009if #path > 1 then\
547\009\009text(\"^\",1,2)\
548\009end\
549\009paintutils.drawLine(1,ySize,xSize,ySize,colors.white)\
550\009term.setTextColor(colors.black)\
551\009if select==0 then\
552\009\009newObj(\"()\",0,0,0,0)\
553\009\009newObj(\"<<\",0,0,0,0)\
554\009\009sysbar.draw(colors.white,colors.black,noty,true,true)\
555\009else\
556\009\009if select==1 then\
557\009\009\009text(\" Copy\",1,ySize)\
558\009\009\009text(\" Cut\",6,ySize)\
559\009\009\009text(\" Delete\",10,ySize)\
560\009\009\009if #selects~=#files then\
561\009\009\009\009text(\" All \",xSize-5,ySize)\
562\009\009\009else\
563\009\009\009\009text(\" One \",xSize-5,ySize)\
564\009\009\009end\
565\009\009\009newObj(\"()\",xSize-6,ySize,xSize-1,ySize)\
566\009\009\009newObj(\"<<\",xSize,ySize,xSize,ySize)\
567\009\009elseif select>1 then\
568\009\009\009text(\" Paste\",1,ySize)\
569\009\009\009text(\" Cancel \",7,ySize)\
570\009\009end\
571\009\009term.setTextColor(colors.red)\
572\009\009text(\"x\",xSize,ySize)\
573\009end\
574end\
575\
576local function timer()\
577\009local time = ''\
578\009while true do\
579\009\009if draw and select==0 and xSize > 30 then\
580\009\009\009paintutils.drawLine(xSize-6,ySize,xSize-2,ySize,colors.white)\
581\009\009\009term.redirect(term.native())\
582\009\009\009term.setTextColor(colors.black)\
583\009\009\009time = textutils.formatTime(os.time(),true)\
584\009\009\009text(time,xSize-#time-1,ySize)\
585\009\009end\
586\009\009sleep(1)\
587\009end\
588end\
589\
590local delik = function(y,color)\
591 for i=2,xSize-2 do\
592 term.setBackgroundColor(colors.wite)\
593 term.setTextColor(color)\
594 text(\"-\",i,y)\
595 end\
596end\
597\
598local redraw = function()\
599\009if version >= '5.1.1' then\
600\009\009term.redirect(screen)\
601\009\009clear(colors.white)\
602\009\009files = fs.list(path)\
603\009\009files = windows.reorganizeFilesAndFolders(path,files,true,true)\
604\009\009ender = math.floor((-pos)/4+ySize/4)\
605\009\009if ender > #files then\
606\009\009\009ender = #files\
607\009\009end\
608\009\009for I=math.floor((-pos)/4)+1,ender do\
609\009\009\009yPos = pos+4*I-2\
610\009\009\009if fs.isDir(path..\"/\"..files[I]) and windows.getFileFormat(files[I]) ~= \".apk\" then\
611\009\009\009\009image.draw(2,yPos,icoFld)\
612\009\009\009elseif (windows.getFileFormat(files[I])==\".apk\" or windows.getFileFormat(files[I])==\".app\") then\
613\009\009\009\009image.draw(2,yPos,icoApp)\
614\009\009\009elseif not fs.isDir(path..\"/\"..files[I]) then\
615\009\009\009\009if (windows.getFileFormat(files[I]) == nil or windows.getFileFormat(files[I])=='.lua' or windows.getFileFormat(files[I])=='.exe')then\
616\009\009\009\009\009image.draw(2,yPos,icoProg)\
617\009\009\009\009elseif (windows.getFileFormat(files[I])==\".png\" or windows.getFileFormat(files[I])==\".pic\" or windows.getFileFormat(files[I])==\".jpg\" or windows.getFileFormat(files[I])==\".skch\" or windows.getFileFormat(files[I])==\".nft\" or windows.getFileFormat(files[I])==\".nfp\") then\
618\009\009\009\009\009image.draw(2,yPos,icoPic)\
619\009\009\009\009elseif (windows.getFileFormat(files[I])==\".txt\" or windows.getFileFormat(files[I])==\".cfg\" or windows.getFileFormat(files[I])==\".ini\" or windows.getFileFormat(files[I])==\".md\") then\
620\009\009\009\009\009image.draw(2,yPos,icoTxt)\
621\009\009\009\009elseif (windows.getFileFormat(files[I])==\".zip\" or windows.getFileFormat(files[I])==\".rar\" or windows.getFileFormat(files[I])==\".7z\" or windows.getFileFormat(files[I])==\".tar\" or windows.getFileFormat(files[I])==\".gz\") then\
622\009\009\009\009\009image.draw(2,yPos,icoZip)\
623\009\009\009\009elseif (windows.getFileFormat(files[I])==\".rom\" or windows.getFileFormat(files[I])==\".img\" or windows.getFileFormat(files[I])==\".iso\" or windows.getFileFormat(files[I])==\".back\") then\
624\009\009\009\009\009image.draw(2,yPos,icoRom)\
625\009\009\009\009else\
626\009\009\009\009\009image.draw(2,yPos,icoUnk)\
627\009\009\009\009end\
628\009\009\009\009term.setBackgroundColor(colors.white)\
629\009\009\009\009term.setTextColor(colors.lightGray)\
630\009\009\009\009if fs.getSize(path..'/'..files[I]) >= 1024 then\
631\009\009\009\009\009text(math.floor(fs.getSize(path..'/'..files[I])/1024)..\" KB\",7,yPos+2)\
632\009\009\009\009else\
633\009\009\009\009\009text(fs.getSize(path..'/'..files[I])..\" B\",7,yPos+2)\
634\009\009\009\009end\
635\009\009\009end\
636\009\009\009term.setBackgroundColor(colors.white)\
637\009\009\009term.setTextColor(colors.black)\
638\009\009\009text(files[I],7,yPos+1)\
639\009\009\009newObj(files[I],2,yPos,xSize,yPos+2)\
640\009\009\009if select == 1 then\
641\009\009\009\009term.setTextColor(colors.lightGray)\
642\009\009\009\009text(\"[ ]\",xSize-4,yPos+1)\
643\009\009\009\009for ii=1,#selects do\
644\009\009\009\009\009if selects[ii]==files[I] then\
645\009\009\009\009\009\009term.setTextColor(mainSwitchCol)\
646\009\009\009\009\009\009text(\"V\",xSize-3,yPos+1)\
647\009\009\009\009\009end\
648\009\009\009\009end\
649\009\009\009end\
650\009\009end\
651\009\009term.redirect(term.native())\
652\009\009sysBar()\
653\009end\
654end\
655\
656local waitKey = function()\
657\009local wait = true\
658\009while wait do\
659\009\009eve = os.pullEvent()\
660\009\009if eve == 'mouse_click' or eve == 'key' then\
661\009\009\009wait = false\
662\009\009end\
663\009end\
664end\
665\
666local running = function()\
667 while run == true and home == false do\
668 event, side, x, y = os.pullEvent()\
669 if event == \"mouse_click\" then\
670 if side == 1 then\
671 draw = false\
672\009files = windows.reorganizeFilesAndFolders(path,files,true,true)\
673 for I=math.floor((-pos)/4)+1,ender do\
674 if x>=obj[files[I]][\"x1\"] and x<=obj[files[I]][\"x2\"]-1 and y>=obj[files[I]][\"y1\"]+2 and y<=obj[files[I]][\"y2\"]+2 and y<ySize then\
675 if select > 1 or select==0 then\
676 if fs.isDir(path..\"/\"..files[I]) then\
677 history = history + 1\
678 path = path..\"/\"..files[I]\
679 prevPath[history] = path\
680 pos = 0\
681 posScroll = 0\
682 elseif fs.isDir(path..\"/\"..files[I])==false and (windows.getFileFormat(files[I])==nil or windows.getFileFormat(files[I])=='.lua' or windows.getFileFormat(files[I])=='.exe') then\
683 term.setCursorPos(0,0)\
684 local error = os.run(os.getEnv(),path..\"/\"..files[I])\
685\009\009if error then\
686\009\009\009windows.error(error)\
687\009\009end\
688 elseif fs.isDir(path..\"/\"..files[I])==false and windows.getFileFormat(files[I])==\".sec\" then\
689 os.run(os.getEnv(),\"/ver\")\
690 os.run(os.getEnv(),path..\"/\"..files[I])\
691 elseif fs.isDir(path..\"/\"..files[I])==false and (windows.getFileFormat(files[I])==\".png\" or windows.getFileFormat(files[I])==\".pic\" or windows.getFileFormat(files[I])==\".jpg\") then\
692 select=2\
693\009\009if Args[1] == nil then\
694\009\009\009os.run(os.getEnv(),\"/.ds/\"..l_login..\"/ImageViewer.apk/main\",path,files[I])\
695\009\009else\
696\009\009\009os.run({},shell.dir()..\"/Resources/imgView\",path,files[I])\
697\009\009end\
698\009\009select=0\
699\009 elseif fs.isDir(path..\"/\"..files[I])==false and (windows.getFileFormat(files[I])==\".txt\" or windows.getFileFormat(files[I])==\".cfg\" or windows.getFileFormat(files[I])==\".ini\" or windows.getFileFormat(files[I])==\".md\") then\
700\009 draw = true\
701\009\009if Args[1] == nil then\
702\009\009\009os.run(os.getEnv(),\"/.ds/\"..l_login..\"/FileBrowser.apk/Resources/reader\",path..\"/\"..files[I])\
703\009\009else\
704\009\009\009os.run({},shell.dir()..\"/Resources/reader\",path..\"/\"..files[I])\
705\009\009end\
706 end\
707 else\
708 for ii=1,#selects do\
709 if files[I]==selects[ii] then\
710 sel=false\
711 for iii=ii,#selects do\
712 selects[iii]=selects[iii+1]\
713 end\
714 end\
715 end\
716 if sel==true then\
717 selects[#selects+1]=files[I]\
718 elseif sel==false then\
719 sel=true\
720 end\
721 end\
722 redraw()\
723 sel=true\
724 break\
725 end\
726\009end\
727\009draw = true\
728 elseif side == 2 then\
729\009if select == 0 then\
730 files = windows.reorganizeFilesAndFolders(path,files,true,true)\
731 for I=math.floor((-pos)/4)+1,ender do\
732 if x>=obj[files[I]][\"x1\"] and x<=obj[files[I]][\"x2\"]-1 and y>=obj[files[I]][\"y1\"]+2 and y<=obj[files[I]][\"y2\"]+2 and y<ySize then\
733\009 local budka = \"\"\
734\009 if fs.isDir(path..\"/\"..files[I])==false and windows.getFileFormat(path..\"/\"..files[I])==\".zip\" then\
735\009 budka = contexts.main(x,y,'Unarchive','Rename','Open as','Edit','Copy','Cut','Delete')\
736\009 elseif fs.isDir(path..\"/\"..files[I])==false then\
737\009 budka = contexts.main(x,y,'Open as','Rename','Edit','Copy','Cut','Delete')\
738\009 else\
739\009 budka = contexts.main(x,y,'Archive','Rename','Copy','Cut','Delete')\
740\009 end\
741 if budka == 'Open as' then\
742\009\009 redraw()\
743\009\009 local open = windows.select({\"Open \"..files[I]},{\"Open as\"},{\"x\",colors.white,colors.red},{\"Text\",colors.lightBlue,colors.white},{\"Program\",colors.lightBlue,colors.white})\
744\009\009 if open == 'Text' then\
745\009\009 draw = true\
746\009\009 local error = \"\"\
747\009\009 if Args[1] == nil then\
748\009\009\009error = os.run(os.getEnv(),\"/.ds/\"..l_login..\"/FileBrowser.apk/Resources/reader\",path..\"/\"..files[I])\
749\009\009 else\
750\009\009\009error = os.run({},shell.dir()..\"/Resources/reader\",path..\"/\"..files[I])\
751\009\009 end\
752\009\009 if error then\
753\009\009\009windows.error(error)\
754\009\009 end\
755\009\009 elseif open == 'Program' then\
756 term.setCursorPos(0,0)\
757 local error = os.run(os.getEnv(),path..\"/\"..files[I])\
758\009\009 if error then\
759\009\009\009windows.error(error)\
760\009\009 end\
761\009\009 elseif open == 'Image' then\
762\009\009 select=2\
763\009\009 if Args[1] == nil then\
764\009\009\009os.run(os.getEnv(),\"/.ds/\"..l_login..\"/ImageViewer.apk/main\",path,files[I])\
765\009\009 else\
766\009\009\009os.run({},shell.dir()..\"/Resources/imgView\",path,files[I])\
767\009\009 end\
768\009\009 select=0\
769\009\009 end\
770\009\009elseif budka == 'Unarchive' then\
771\009\009 redraw()\
772\009\009 local unzipPath = windows.input('auto','auto','Unarchive',20,{'Path', ''})\
773\009\009 if unzipPath[1] ~= '' then\
774\009\009 fs.makeDir(unzipPath[1])\
775\009\009 zip.unarchive(path..'/'..files[I],unzipPath[1])\
776\009\009 elseif unzipPath[1] == '' then\
777\009\009 zip.unarchive(path..'/'..files[I],path)\
778\009\009 end\
779\009\009 redraw()\
780\009\009elseif budka == 'Archive' then\
781\009\009 redraw()\
782\009\009 local zipName = windows.input('auto','auto','Archive',20,{'Name', ''})\
783\009\009 if zipName[1] ~= '' then\
784\009\009 zip.archive(path..'/'..files[I],path..'/'..zipName[1])\
785\009\009 elseif zipName[1] == '' then\
786\009\009 zip.archive(path..'/'..files[I],path..'/'..files[I])\
787\009\009 end\
788\009\009 redraw()\
789\009\009elseif budka == 'Rename' then\
790\009\009 redraw()\
791\009\009 local newName = windows.input('auto','auto','Rename',20,{'New name', files[I]})\
792\009\009 if newName[1] ~= '' then\
793\009\009 shell.run('rename '..path..'/'..files[I]..' '..path..'/'..newName[1])\
794\009\009 end\
795\009\009 redraw()\
796\009\009elseif budka == 'Edit' then\
797\009\009 shell.run(\"edit \"..path..\"/\"..files[I])\
798\009\009elseif budka == 'Copy' then\
799\009\009 select=2\
800\009\009 selects[1] = files[I]\
801 corpath = path\
802 redraw()\
803\009\009elseif budka == 'Cut' then\
804\009\009 select=3\
805\009\009 selects[1] = files[I]\
806 corpath = path\
807 redraw()\
808\009\009elseif budka == 'Delete' then\
809\009\009 redraw()\
810\009\009 local but2 = windows.select({\"Delete files\"},{\"Are you sure?\"},{\"Yes\",colors.red,colors.white},{\"No\",colors.gray,colors.white})\
811 if but2 == \"Yes\" then\
812\009\009 fs.delete(path..\"/\"..files[I])\
813\009\009 end\
814\009\009end\
815 redraw()\
816 break\
817 end\
818\009 end\
819\009end\
820 end\
821 if x==1 and y==2 then\
822 pos = 0\
823 posScroll = 0\
824 history=history-1\
825 if history<0 then history=0 end\
826 path = prevPath[history]\
827 redraw()\
828 elseif x==xSize and y==ySize and select==0 then\
829 term.setBackgroundColor(colors.gray)\
830 term.setTextColor(colors.lightGray)\
831 text(\"|\",xSize,ySize)\
832\009 local budka = contexts.main(xSize,ySize-1,'Select','New Folder','New File')\
833 if budka == 'Select' then\
834\009 select = 1\
835 selects = {}\
836 contex = false\
837\009 elseif budka == 'New Folder' then\
838\009 redraw()\
839 newDir = windows.input(\"auto\",\"auto\",\"New Folder\",14,{\"Folder name\",\"\"})\
840 fs.makeDir(path..\"/\"..newDir[1])\
841 contex = false\
842\009 elseif budka == 'New File' then\
843\009 redraw()\
844 newFile = windows.input(\"auto\",\"auto\",\"New File\",14,{\"File name\",\"\"})\
845 shell.run(\"edit \"..path..\"/\"..newFile[1])\
846 contex = false\
847\009 end\
848\009 redraw()\
849 elseif select == 0 and sysbar.back(x,y) then\
850 term.redirect(term.native())\
851 pos = 0\
852 posScroll = 0\
853 history=history-1\
854 if history<0 then history=0 end\
855 path = prevPath[history]\
856 redraw()\
857 elseif select == 0 and sysbar.home(x,y) then\
858 clear(colors.black)\
859\009term.redirect(term.native())\
860 term.clear()\
861 term.setCursorPos(1,1)\
862 run = false\
863 elseif x>=obj[\"<<\"][\"x1\"] and x<=obj[\"<<\"][\"x2\"] and y>=obj[\"<<\"][\"y1\"] and y<=obj[\"<<\"][\"y2\"] and select == 1 then\
864 pos = 0\
865 posScroll = 0\
866 select=0\
867 selects={}\
868 redraw()\
869 elseif x>=obj[\"()\"][\"x1\"] and x<=obj[\"()\"][\"x2\"] and y>=obj[\"()\"][\"y1\"] and y<=obj[\"()\"][\"y2\"] and select == 1 then\
870 if #selects~=#files then\
871 for I=1,#files do\
872 selects[I]=files[I]\
873 end\
874 redraw()\
875 else\
876 selects={}\
877 redraw()\
878 end\
879 elseif x>9 and x<=17 and y==ySize and select==1 then\
880 select=0\
881\009local but = windows.select({\"Delete files\"},{\"Are you sure?\"},{\"Yes\",colors.red,colors.white},{\"No\",colors.gray,colors.white})\
882 if but == \"Yes\" then\
883 for I=1,#selects do\
884 fs.delete(path..\"/\"..selects[I])\
885 end\
886\009 end\
887 selects={}\
888 redraw()\
889 elseif x>7 and x<=15 and y==ySize and select>1 then\
890 select=0\
891 selects={}\
892 redraw()\
893 elseif x>1 and x<=7 and y==ySize and select>1 then\
894 local f = fs.list(path)\
895 for I=1,#selects do\
896\009 local find = false\
897\009 for i=math.floor((-pos)/4)+1,ender do\
898\009\009if f[i]==selects[I] then find = true end\
899\009 end\
900\009 if find then\
901\009 local check = windows.select({selects[I]},{'already exist'},{'Skip',colors.lightBlue,colors.white},{'Overwrite',colors.lightBlue,colors.white},{'Rename',colors.lightBlue,colors.white})\
902\009 if check == 'Rename' then\
903\009 fs.copy(corpath..\"/\"..selects[I],path..\"/copy-\"..selects[I])\
904\009 if select==3 then\
905 fs.delete(corpath..\"/\"..selects[I])\
906 end\
907\009 elseif check == 'Overwrite' then\
908\009 fs.delete(path..\"/\"..selects[I])\
909\009 fs.copy(corpath..\"/\"..selects[I],path..\"/\"..selects[I])\
910\009 end\
911\009 else\
912\009 fs.copy(corpath..\"/\"..selects[I],path..\"/\"..selects[I])\
913\009 if select==3 then\
914 fs.delete(corpath..\"/\"..selects[I])\
915 end\
916\009 end\
917 end\
918 selects={}\
919 select=0\
920 redraw()\
921 elseif x>0 and x<=5 and y==ySize and select>0 and #selects>0 then\
922 select=2\
923 corpath = path\
924 redraw()\
925 elseif x>5 and x<=10 and y==ySize and select>0 and #selects>0 then\
926 select=3\
927 corpath = path\
928 redraw()\
929 end\
930 elseif event == \"mouse_scroll\" and contex==false then\
931 if #files>4 then\
932 if side == 1 then\
933 if pos>-#files*4+ySize-4 then\
934 posScroll = posScroll-step\
935 pos = pos-2\
936 else\
937 pos = -#files*4+ySize-4\
938 end\
939 elseif side == -1 then\
940 if pos < 0 then\
941 pos = pos + 2\
942 posScroll = posScroll+step\
943 if pos > 0 then\
944\009\009pos = 0\
945\009 end\
946 end\
947 end\
948 redraw()\
949 end\
950 elseif event == \"key\" then\
951 if side == 208 then\
952 if pos>-#files*4+15 then\
953 posScroll = posScroll-step\
954 pos = pos-2\
955 else\
956 pos = -#files*4+15\
957 end\
958 elseif side == 200 then\
959 if pos<0 then\
960 pos = pos+2\
961 posScroll = posScroll+step\
962 else\
963 pos = 0\
964 end\
965 end\
966 redraw()\
967 end\
968 term.redirect(term.native())\
969 end\
970end\
971\
972clear(colors.white)\
973redraw()\
974parallel.waitForAny(running,timer)\
975icoFld = nil\
976icoApp = nil\
977icoProg = nil\
978icoPic = nil\
979icoTxt = nil\
980icoZip = nil\
981icoRom = nil\
982icoUnk = nil\
983header = nil\
984fadeOut(0)",
985 path = "//.ds/sys/FileBrowser.apk/main",
986 },
987 {
988 text = "[80O80-80-80-80]80\
989[80-80-80-80O80]80\
990[80-80O80-80-80]80\
991C80o80n80f80i80g80",
992 path = "//.ds/sys/Settings.apk/Resources/icon.png",
993 },
994 {
995 text = "args = ...\
996if args == nil then\
997 os.run(os.getEnv(),\"/System/prog/settings\")\
998else\
999 os.run(os.getEnv(),\"/System/prog/\"..args)\
1000end",
1001 path = "//.ds/sys/Settings.apk/main",
1002 },
1003 {
1004 text = "### 70=70=70 70###\
1005_80_80_80_80_80_80\
1006Se0t10o50r30eb0@a0\
1007-80-80-80-80-80-80",
1008 path = "//.ds/sys/Store@.apk/Resources/icon.png",
1009 },
1010 {
1011 text = " 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03\
1012 03 04 04 04 04 04 04 03 03 03 03 03I03m03a03g03e03V03i03e03w03e03r03 03\
1013 03 04 04 04 04 04 04 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03\
1014 03 04 04 04 04 04 04 03 03 03 03 03 03F03o03r03 03b03e03t03t03e03r03 03\
1015 03 04 04 04 04 04 04 03 03 03 03 03 03e03x03p03e03r03i03e03n03c03e03 03\
1016 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03\
1017 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03\
1018 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03",
1019 path = "//.ds/sys/Store@.apk/Resources/news/1.png",
1020 },
1021 {
1022 text = " 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09\
1023 09.87.87.87 f7 f7 f7 09 09 09 09 09 09O09f09f09i09c09e09P09a09c09k09 09\
1024 09 f8 f0 f0 f0 f0 f3 09 09 09 09 09 09b09y09 09 09 09 09 09 09 09 09 09\
1025 09 f8 f0 f0 f0.87.87.87 07=f7=f7 09 09o09e09e09d09 09 09 09 09 09 09 09\
1026 09 f8Ib0nb0kb0:f8:f8:f8:f8 f7 f7 09 09 09 09 09 09 09 09 09 09 09 09 09\
1027 09 09 09 09 09:f8:f8:f8:f8=f7=f7 09 09 09 09 09 09 09 09 09 09 09 09 09\
1028 09 09 09 09 09S08k08c08h08 f7 f7 09 09 09 09 09 09 09 09 09 09 09 09 09\
1029 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09",
1030 path = "//.ds/sys/Store@.apk/Resources/news/2.png",
1031 },
1032 {
1033 text = " 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01\
1034 01 01 01|01=01 01 01 01 01 01 01 01 01U01l01t01i01m01a01t01e01 01 01 01\
1035 01 01 01|01 01 01 01 01 01 01 01 01 01D01o01o01r01 01L01o01k01e01r01 01\
1036 01 01 01(01)01 01 01 01 01 01 01 01 01b01y01 01o01e01e01d01 01 01 01 01\
1037 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01\
1038 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01\
1039 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01\
1040 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01",
1041 path = "//.ds/sys/Store@.apk/Resources/news/3.png",
1042 },
1043 {
1044 text = " 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04\
1045 04 04F04i04l04e04 04B04r04o04w04s04e04r04 04 04 04 04 04 04 04 04 04 04\
1046_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04\
1047 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04\
1048 04U04s04e04f04u04l04l04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04\
1049 04a04n04d04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04\
1050 04s04i04m04p04l04e04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04\
1051_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04_04",
1052 path = "//.ds/sys/Store@.apk/Resources/news/4.png",
1053 },
1054 {
1055 text = " 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f\
1056 0f 0fSeftefaefrefsefhefiefpef 0fA8fu8fd8fi8fo8f 0f 0f 0f 0f 0f 0f 0f 0f\
1057 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f\
1058 0f 0fL7fe7ft7f'7fs7f 0fg7fe7ft7f 0fi7fn7ft7fo7f 0f 0f 0f 0f 0f 0f 0f 0f\
1059 0f 0fo7fu7ft7fe7fr7f 7fsefpefaefcefeef 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f\
1060 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f\
1061 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f\
1062 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f",
1063 path = "//.ds/sys/Store@.apk/Resources/news/str.png",
1064 },
1065 {
1066 text = "{\
1067 {\
1068 apps = {\
1069 \"Starship\",\
1070 },\
1071 img = 'str.png',\
1072 },\
1073 {\
1074 apps = {\
1075 \"ImageViewer\",\
1076 },\
1077 img = '1.png',\
1078 },\
1079 {\
1080 apps = {\
1081 \"Ink\",\
1082 \"Sketch\",\
1083 },\
1084 img = '2.png',\
1085 },\
1086 {\
1087 apps = {\
1088 \"DoorLock\",\
1089 },\
1090 img = '3.png',\
1091 },\
1092 {\
1093 apps = {\
1094 \"FileBrowser\",\
1095 },\
1096 img = '4.png',\
1097 },\
1098}",
1099 path = "//.ds/sys/Store@.apk/Resources/news.cfg",
1100 },
1101 {
1102 text = "{\
1103 name = \"Backup\", by = \"-DECE-\",\
1104 desc = \"Backup/Restore\",\
1105 category = \"Files\",\
1106 about = \"Backup and restore tool for Gapple mOS, can backup only system files or all root directory\",\
1107 code = \"U6nc5vK1\",\
1108 size = \"6 KB\"\
1109}",
1110 path = "//.ds/sys/Store@.apk/Resources/repo/Backup.inf",
1111 },
1112 {
1113 text = " 70 70 70 70 70 70\
1114 70<70-70-70 70 70\
1115 70 70-70-70>70 70\
1116 80 80 80 80 80 80",
1117 path = "//.ds/sys/Store@.apk/Resources/repo/Backup.png",
1118 },
1119 {
1120 text = "{\
1121 name = \"DoorLock\",\
1122 by = \"oeed\",\
1123 desc = \"Ultimate locker\",\
1124 category = \"System\",\
1125 about= \"Door locks without having to actually do anything\",\
1126 size = \"37 KB\",\
1127 code = \"4QeAEiTM\"\
1128 }",
1129 path = "//.ds/sys/Store@.apk/Resources/repo/DoorLock.inf",
1130 },
1131 {
1132 text = " 01 01|01=01 01 01\
1133 01 01|01 01 01 01\
1134 01 01(01)01 01 01\
1135 01L01o01c01k01 01",
1136 path = "//.ds/sys/Store@.apk/Resources/repo/DoorLock.png",
1137 },
1138 {
1139 text = "{\
1140 name = \"FarWeb\",\
1141 by = \"-DECE-\",\
1142 desc = \"Real web browser\",\
1143 category = \"System\",\
1144 about= \"A lightweight web browser for ComputerCraft. Of course without CSS and JavaScript support.\",\
1145 size = \"24 KB\",\
1146 code = \"mhkvbXxT\",\
1147 apilevel = '6',\
1148 craftos = '1.8',\
1149 vedroidos = '5.6.0',\
1150 res = {\
1151 \009{\
1152 \009\009name = \"mainPage.html\",\
1153 \009\009code = \"rYXeyhN1\",\
1154 \009},\
1155 },\
1156}",
1157 path = "//.ds/sys/Store@.apk/Resources/repo/FarWeb.inf",
1158 },
1159 {
1160 text = " 03 03 03 03 03 03\
1161F03a03r03 03 03 03\
1162 00 00 00W30e30b30\
1163 00 00 00 00 00 00",
1164 path = "//.ds/sys/Store@.apk/Resources/repo/FarWeb.png",
1165 },
1166 {
1167 text = "{\
1168 name = \"FileBrowser\",\
1169 by = \"-DECE-\",\
1170 desc = \"File manager\",\
1171 category = \"Files\",\
1172 about= \"Fast and simple file manager with full functional\",\
1173 size = \"14 KB\", \
1174 code = \"2Xms362b\",\
1175 res = {\
1176\009{\
1177\009\009name = \"reader\",\
1178\009\009code = \"pDdRdBkj\",\
1179\009},\
1180 },\
1181}",
1182 path = "//.ds/sys/Store@.apk/Resources/repo/FileBrowser.inf",
1183 },
1184 {
1185 text = " 04 04 04 04######\
1186-04-04-04-04-04-04\
1187B04r04o04w04s04e04\
1188-04-04-04-04-04-04",
1189 path = "//.ds/sys/Store@.apk/Resources/repo/FileBrowser.png",
1190 },
1191 {
1192 text = "{\
1193 name = \"FlappyPixel\", by = \"Creator\",\
1194 desc = \"Simple game\",\
1195 category = \"Games\",\
1196}",
1197 path = "//.ds/sys/Store@.apk/Resources/repo/FlappyPixel.inf",
1198 },
1199 {
1200 text = " 03 03 03 03 0b 03\
1201 03@e4 03 03 03 03\
1202 03 03 03 03 0b 03\
1203 05 05 05 05 05 05",
1204 path = "//.ds/sys/Store@.apk/Resources/repo/FlappyPixel.png",
1205 },
1206 {
1207 text = "{\
1208 name = \"ImageViewer\", by = \"-DECE-\",\
1209 desc = \"Gallery\",\
1210 category = \"Office\",\
1211 about = \"Powerful gallery with sorting images by folders\",\
1212 code = \"tYNEKygi\",\
1213 size = \"7 KB\"\
1214}",
1215 path = "//.ds/sys/Store@.apk/Resources/repo/ImageViewer.inf",
1216 },
1217 {
1218 text = " 04 04 04 43 c3 c3\
1219 04 04 04 43 c3 c3\
1220 03 03 03 03 03 03\
1221I0dm0da0dg0de0ds0d",
1222 path = "//.ds/sys/Store@.apk/Resources/repo/ImageViewer.png",
1223 },
1224 {
1225 text = "{\
1226 name = \"Ink\", by = \"oeed\",\
1227 desc = \"Text editor\",\
1228 category = \"Office\",\
1229 about = \"Very powerful word processor like Microsoft Word/Apple's Pages that allows for easy writing up of a document and, best of all, printing\",\
1230 code = \"JxzXPv03\",\
1231 size = \"82 KB\",\
1232}",
1233 path = "//.ds/sys/Store@.apk/Resources/repo/Ink.inf",
1234 },
1235 {
1236 text = ".87.87.87 b7 b7 b7\
1237 b8 80 80 80 80 b3\
1238 b8 80 80 80 80 b8\
1239 b8Ib0nb0kb0 e0 b8",
1240 path = "//.ds/sys/Store@.apk/Resources/repo/Ink.png",
1241 },
1242 {
1243 text = "{\
1244 name = \"Maze3D\", by = \"JESUSTHEKILLER\",\
1245 desc = \"3D mazes\",\
1246 category = \"Games\",\
1247}",
1248 path = "//.ds/sys/Store@.apk/Resources/repo/Maze3D.inf",
1249 },
1250 {
1251 text = " 9f 9f 9f 9f 9f 9f\
1252 0fM0fA0fZ0fE0f 9f\
1253 0f 0f3efD9f 0f 9f\
1254 9f 9f 9f 9f 9f 9f",
1255 path = "//.ds/sys/Store@.apk/Resources/repo/Maze3D.png",
1256 },
1257 {
1258 text = "{\
1259 name = \"Minesweeper\", by = \"GopherAtl\",\
1260 desc = \"Game\",\
1261 category = \"Games\",\
1262}",
1263 path = "//.ds/sys/Store@.apk/Resources/repo/Minesweeper.inf",
1264 },
1265 {
1266 text = "13f 0f ef13fXfe 08\
1267 0813f ff ff 08 08\
1268Xfe 0813f ff ff13f\
1269 08Xfe 08 0813fXfe",
1270 path = "//.ds/sys/Store@.apk/Resources/repo/Minesweeper.png",
1271 },
1272 {
1273 text = "{\
1274 name = \"NanoMaze\", by = \"JESUSTHEKILLER\",\
1275 desc = \"2D mazes\",\
1276 category = \"Games\",\
1277}",
1278 path = "//.ds/sys/Store@.apk/Resources/repo/NanoMaze.inf",
1279 },
1280 {
1281 text = " 0f 0f 0f 0f 0f 0f\
1282 0fn0fa0fn0fo0f 0f\
1283 0fM0fA0fZ0fE0f 0f\
1284 0f 0f 0f 0f 0f 0f",
1285 path = "//.ds/sys/Store@.apk/Resources/repo/NanoMaze.png",
1286 },
1287 {
1288 text = "{\
1289 name = \"PackageInstaller\", by = \"-DECE-\",\
1290 desc = \"For custom apps\",\
1291 category = \"Files\",\
1292 about = \"Installer for apps from pastebin or local file system\",\
1293 code = \"vVeK5iuD\",\
1294 size = \"4 KB\"\
1295}",
1296 path = "//.ds/sys/Store@.apk/Resources/repo/PackageInstaller.inf",
1297 },
1298 {
1299 text = "A07p07p07 07 07 07\
1300 0f 0f 0f 0f 0f 0f\
1301 0f 0f 0f 0f 0f 0f\
1302 0f 0f 0f 0f 0f 0f",
1303 path = "//.ds/sys/Store@.apk/Resources/repo/PackageInstaller.png",
1304 },
1305 {
1306 text = "{\
1307 name = \"Photoshop\", by = \"ECS\",\
1308 desc = \"Image editor\",\
1309 category = \"Office\",\
1310 about = \"Powerful and easy to use image editor, optimized for pocket PCs\",\
1311 code = \"tK3FSmf2\",\
1312 size = \"21 KB\"\
1313}",
1314 path = "//.ds/sys/Store@.apk/Resources/repo/Photoshop.inf",
1315 },
1316 {
1317 text = "P07S07_f7_f7_f7_f7\
1318B7f 00 00 00.e7.17\
1319ef7 00 00 00.47.57\
1320ff7 a8 a8 a8.b7.a7",
1321 path = "//.ds/sys/Store@.apk/Resources/repo/Photoshop.png",
1322 },
1323 {
1324 text = "{\
1325 name = \"Sketch\",\
1326 by = \"oeed\",\
1327 desc = \"Image editor\",\
1328 category = \"Office\",\
1329 about = \"Very powerful and fast image editor with layers and large variety of tools\",\
1330 size = \"104 KB\",\
1331 code = \"Mm5hd97E\",\
1332}",
1333 path = "//.ds/sys/Store@.apk/Resources/repo/Sketch.inf",
1334 },
1335 {
1336 text = ".87.87.87 87=f7=f7\
1337:f8:f8:f8:f8 f7 f7\
1338:f8:f8:f8:f8=f7=f7\
1339S08k08c08h08 f7 f7",
1340 path = "//.ds/sys/Store@.apk/Resources/repo/Sketch.png",
1341 },
1342 {
1343 text = "{\
1344 name = \"Starship\",\
1345 by = \"-DECE-\",\
1346 desc = \"Audio editor\",\
1347 category = \"Office\",\
1348 about= \"First audio editor for ComputerCraft. Starship uses the Speaker and has a complete set of sounds available in ComputerCraft 1.8.\",\
1349 code = \"yG6N66BP\",\
1350 size = \"17 KB\",\
1351 apilevel = '6',\
1352 craftos = '1.8',\
1353}",
1354 path = "//.ds/sys/Store@.apk/Resources/repo/Starship.inf",
1355 },
1356 {
1357 text = " 0f 0f 0f 0f 0f 0f\
1358 0f-ef-ef-ef-ef 0f\
1359 0fSeftefaefRef 0f\
1360 0f ef ef ef ef ef",
1361 path = "//.ds/sys/Store@.apk/Resources/repo/Starship.png",
1362 },
1363 {
1364 text = "{\
1365 name = \"Store@\", by = \"-DECE-\",\
1366 desc = \"Store\", category = \"System\", about = \"Official Gapple mOS store application\"\
1367}",
1368 path = "//.ds/sys/Store@.apk/Resources/repo/Store@.inf",
1369 },
1370 {
1371 text = "###=70=70=70=70###\
1372_70_70_70_70_70_70\
1373Se0t10o50r30eb0@a0\
1374-70-70-70-70-70-70",
1375 path = "//.ds/sys/Store@.apk/Resources/repo/Store@.png",
1376 },
1377 {
1378 text = "{\
1379 name = \"Store@Old\", by = \"-DECE-\",\
1380 desc = \"Store\", category = \"System\",\
1381 about = \"Old version of store app, use it if new version works unstable\",\
1382 code = \"g8LMzmxa\",\
1383 size = \"9 KB\",\
1384}",
1385 path = "//.ds/sys/Store@.apk/Resources/repo/Store@Old.inf",
1386 },
1387 {
1388 text = "###=80=80=80=80###\
1389-80-80-80-80-80-80\
1390 8e 81 85 83 8b 8a\
1391-80-80-80-80-80-80",
1392 path = "//.ds/sys/Store@.apk/Resources/repo/Store@Old.png",
1393 },
1394 {
1395 text = "{\
1396 name = \"TerminalEmulator\", by = \"-DECE-\",\
1397 desc = \"Lite shell\",\
1398 category = \"System\",\
1399 about= \"Very basic terminal with some limitations\",\
1400 size = \"3 KB\",\
1401 code = \"8MCuj2Vf\"\
1402}",
1403 path = "//.ds/sys/Store@.apk/Resources/repo/TerminalEmulator.inf",
1404 },
1405 {
1406 text = " 8f 0f 0f 0f 0f 0f\
1407 0f>ef ef_0f 0f 0f\
1408 0f 8f 8f 8f 0f 0f\
1409 0f 0f 0f 8f 8f 0f",
1410 path = "//.ds/sys/Store@.apk/Resources/repo/TerminalEmulator.png",
1411 },
1412 {
1413 text = "{\
1414 name = \"Udo\", by = \"Zambonie\",\
1415 desc = \"Pocket Todo List\",\
1416 category = \"Office\",\
1417}",
1418 path = "//.ds/sys/Store@.apk/Resources/repo/Udo.inf",
1419 },
1420 {
1421 text = " 87 80U80d80o80 00\
1422 87 85 85 85 85 05\
1423 87 80 80 80 80 00\
1424 07 05 05 05 05 05",
1425 path = "//.ds/sys/Store@.apk/Resources/repo/Udo.png",
1426 },
1427 {
1428 text = "{\
1429 name = \"gtRemote\", by = \"Dog\",\
1430 desc = \"Remote turtles\",\
1431 category = \"RedNet\",\
1432}",
1433 path = "//.ds/sys/Store@.apk/Resources/repo/gtRemote.inf",
1434 },
1435 {
1436 text = " 0f 0f 0f 0f 0f 0f\
1437 0f 0fGeftef 0f 0f\
1438R0fe0fm0fo0ft0fe0f\
1439 0f 0f 0f 0f 0f 0f",
1440 path = "//.ds/sys/Store@.apk/Resources/repo/gtRemote.png",
1441 },
1442 {
1443 text = "os.loadAPI(\"/System/API/image\")\
1444os.loadAPI(\"/System/API/windows\")\
1445os.loadAPI(\"/System/API/zip\")\
1446os.loadAPI(\"/System/API/vedroid\")\
1447local run = true\
1448local xSize, ySize = term.getSize()\
1449--xSize = 26\
1450local comp = 0\
1451if xSize > 30 then\
1452\009comp = 1\
1453end\
1454local xCenter = math.floor(xSize/2)+1\
1455local obj = {}\
1456local page = 1\
1457local maxPage = 5\
1458local instFolder = \"/.ds/\"..l_login..'/'\
1459local objName = {}\
1460local id = \"\"\
1461local mods = \"\"\
1462local pags = 1\
1463local drawBar = true\
1464local storeVersion = '2.0'\
1465local cursor = 0\
1466local history = {}\
1467local step = 0\
1468local posScroll = 0\
1469local bposScrll = 0\
1470local pos = -1\
1471local bpos = -1\
1472local categories = {}\
1473local prevID = {}\
1474local prevFiles = {}\
1475local prevScrl = {}\
1476local elms = 0\
1477local OSversion = vedroid.getOSversion()\
1478local APIlevel = vedroid.getAPIlevel()\
1479prevID[1] = \"\"\
1480prevFiles[1] = {}\
1481history[1] = 1\
1482prevScrl[1] = {pos,posScroll}\
1483local screen = window.create(term.current(),1,3,xSize-1,ySize-3)\
1484\
1485local function setTextColor(col)\
1486\009if term.getTextColor() ~= col then\
1487\009\009term.setTextColor(col)\
1488\009end\
1489end\
1490\
1491local function setBackgroundColor(col)\
1492\009if term.getBackgroundColor() ~= col then\
1493\009\009term.setBackgroundColor(col)\
1494\009end\
1495end\
1496\
1497local function load(path)\
1498\009local file = fs.open(path,\"r\")\
1499\009local data = file.readAll()\
1500\009file.close()\
1501\009return textutils.unserialize(data)\
1502end\
1503\
1504local function save(table,path)\
1505\009local file = fs.open(path,\"w\")\
1506\009file.write(textutils.serialize(table))\
1507\009file.close()\
1508end\
1509\
1510local newObj = function(name,x1,y1,x2,y2)\
1511 obj[name] = {}\
1512 obj[name][\"x1\"] = x1\
1513 obj[name][\"y1\"] = y1\
1514 obj[name][\"x2\"] = x2\
1515 obj[name][\"y2\"] = y2\
1516end\
1517\
1518local pastebin = function(paste,filename)\
1519\009local file = http.get(\"http://pastebin.com/raw.php?i=\"..paste)\
1520\009if file then\
1521\009\009file = file.readAll()\
1522\009\009h=fs.open(filename,\"w\")\
1523\009\009h.write(file)\
1524\009\009h.close()\
1525\009\009return true\
1526\009else\
1527\009\009windows.error(\"Failed to connect to pastebin.com\")\
1528\009\009return false\
1529\009end\
1530end\
1531\
1532local clear = function(color)\
1533\009setBackgroundColor(color)\
1534\009term.clear()\
1535\009term.setCursorPos(1,1)\
1536end\
1537\
1538local usualText = function(string,xPos,yPos)\
1539\009term.setCursorPos(xPos,yPos)\
1540\009term.write(string)\
1541end\
1542\
1543local function textPrinter(text,y,colorT,colorB)\
1544\009setTextColor(colorT)\
1545\009setBackgroundColor(colorB)\
1546\009local words = {}\
1547\009local pos = 1\
1548\
1549\009for i = 1, #text do\
1550\009\009if string.sub(text,i,i) ~= \" \" then\
1551\009\009\009if words[pos] == nil then\
1552\009\009\009\009words[pos] = \"\"\
1553\009\009\009end\
1554\009\009\009words[pos] = words[pos]..string.sub(text,i,i)\
1555\009\009else\
1556\009\009\009pos = pos + 1\
1557\009\009end\
1558\009end\
1559\
1560\009term.setCursorPos(2,y)\
1561\009pos = 2\
1562\009for i=1, #words do\
1563\009\009pos = pos + #words[i]\
1564\009\009if pos <= xSize-1 then\
1565\009\009\009term.write(words[i]..\" \")\
1566\009\009\009pos = pos+1\
1567\009\009else\
1568\009\009\009y = y+1\
1569\009\009\009term.setCursorPos(2,y)\
1570\009\009\009term.write(words[i]..\" \")\
1571\009\009\009pos = 2 + #words[i]\
1572\009\009\009elms = elms + 1\
1573\009\009end\
1574\009end\
1575end\
1576\
1577local sysBar = function()\
1578\009while true do\
1579\009\009if drawBar then\
1580\009\009\009term.redirect(term.native())\
1581\009\009\009sysbar.header('Store@',colors.lightGray,colors.white)\
1582\009\009\009sysbar.draw(colors.white,colors.black,noty,true,false)\
1583\009\009end\
1584\009\009sleep(1)\
1585\009end\
1586end\
1587\
1588local function refresh()\
1589\009local files = fs.list('/.ds/sys/Store@.apk/Resources/repo')\
1590\009local i = 1\
1591\009while files[i] ~= nil do\
1592\009\009if windows.getFileFormat(files[i]) ~= '.inf' then\
1593\009\009\009for ii=i,#files-1 do\
1594\009\009\009\009files[ii]=files[ii+1]\
1595\009\009\009end\
1596\009\009\009files[#files] = nil\
1597\009\009else\
1598\009\009\009i = i+1\
1599\009\009end\
1600\009end\
1601\009return files\
1602end\
1603\
1604local function refreshCat()\
1605\009local files = refresh()\
1606\009local cat = {}\
1607\009local n = 1\
1608\009for i=1,#files do\
1609\009\009local info = load(\"/.ds/sys/Store@.apk/Resources/repo/\"..files[i])\
1610\009\009local find = false\
1611\009\009for ii=1,#cat do\
1612\009\009\009if info['category'] == cat[ii] then\
1613\009\009\009\009find = true\
1614\009\009\009end\
1615\009\009end\
1616\009\009if not find then\
1617\009\009\009cat[#cat+1] = info['category']\
1618\009\009end\
1619\009end\
1620\009return cat\
1621end\
1622\
1623local app = function(name,y)\
1624\009local info = load(\"/.ds/sys/Store@.apk/Resources/repo/\"..name..\".inf\")\
1625\009image.draw(2,y,\"/.ds/sys/Store@.apk/Resources/repo/\"..name..\".png\")\
1626\009setBackgroundColor(colors.white)\
1627\009setTextColor(colors.lime)\
1628\009usualText(name,9,y)\
1629\009setTextColor(colors.black)\
1630\009usualText(info['desc'],9,y+1)\
1631\009setTextColor(colors.lightGray)\
1632\009usualText(\"By \"..info['by'],9,y+2)\
1633\009mods = \" Install \"\
1634\009if info[\"code\"] then\
1635\009\009if info['vedroidos'] and (OSversion < info['vedroidos']) or info['craftos'] and (string.sub(os.version(),9) < info['craftos']) or info['apilevel'] and (APIlevel < tonumber(info['apilevel'])) then\
1636\009\009\009setTextColor(colors.lightGray)\
1637\009\009\009setBackgroundColor(colors.white)\
1638\009\009\009mods = 'Not supported'\
1639\009\009\009newObj(name,0,0,0,0)\
1640\009\009else\
1641\009\009\009setTextColor(colors.white)\
1642\009\009\009setBackgroundColor(colors.lime)\
1643\009\009\009local files = fs.list(instFolder)\
1644\009\009\009for i=1,#files do\
1645\009\009\009\009if files[i] == name..\".apk\" then\
1646\009\009\009\009\009mods=\" Update \"\
1647\009\009\009\009\009setTextColor(colors.lime)\
1648\009\009\009\009\009setBackgroundColor(colors.white)\
1649\009\009\009\009end\
1650\009\009\009end\
1651\009\009\009if name == 'Store@' then\
1652\009\009\009\009setTextColor(colors.lime)\
1653\009\009\009\009setBackgroundColor(colors.white)\
1654\009\009\009\009mods = ' Update '\
1655\009\009\009end\
1656\009\009\009newObj(name,xSize-1-#mods,y+5,xSize-2,y+5)\
1657\009\009end\
1658\009else\
1659\009\009newObj(name,0,0,0,0)\
1660\009\009setTextColor(colors.orange)\
1661\009\009setBackgroundColor(colors.white)\
1662\009\009mods = \"Coming soon\"\
1663\009end\
1664\009usualText(mods,xSize-1-#mods,y+3)\
1665\009newObj(name..\".inf\",2,y+2,xSize-1,y+5)\
1666end\
1667\
1668local instApp = function(name,ico,x,y)\
1669\009image.draw(x,y,ico)\
1670\009setBackgroundColor(colors.white)\
1671\009setTextColor(colors.black)\
1672\009usualText(name,x+7,y+1)\
1673\009usualText(\" \",x+#name+3,y+1)\
1674\009newObj(name,xSize-10,y+5,xSize-2,y+5)\
1675\009local size = fs.getSize(\"/.ds/\"..l_login..'/'..name..\"/main\")\
1676\009size = math.floor(size/1024)\
1677\009setTextColor(colors.gray)\
1678\009usualText(\"Size: \"..size..\" KB\",x+7,y+2)\
1679\009setTextColor(colors.red)\
1680\009usualText(\"Delete\",xSize-7,y+3)\
1681end\
1682\
1683local delObj = function()\
1684\009local files = refresh()\
1685\009for i=1,#files-1 do\
1686\009\009obj[files[i]][\"x1\"]=-1\
1687\009\009obj[files[i]][\"y1\"]=-1\
1688\009\009obj[files[i]][\"x2\"]=-1\
1689\009\009obj[files[i]][\"y2\"]=-1\
1690\009end\
1691end\
1692\
1693local function seeApps(apps,y)\
1694\009for i=1,#apps do\
1695\009\009app(apps[i],i*5-5+y)\
1696\009end\
1697end\
1698\
1699local function drawNews()\
1700\009local news = load(\"/.ds/sys/Store@.apk/Resources/news.cfg\")\
1701\009maxPage = #news\
1702\009while true do\
1703\009\009if page == 1 then\
1704\009\009\009local b = pags\
1705\009\009\009setTextColor(colors.black)\
1706\009\009\009setBackgroundColor(colors.white)\
1707\009\009\009usualText('Interesting',xCenter-12,3)\
1708\009\009\009setTextColor(colors.lightGray)\
1709\009\009\009for i=1,maxPage do\
1710\009\009\009\009usualText(string.char(7),xCenter+12-i,3)\
1711\009\009\009end\
1712\009\009\009newObj('news',xCenter-12,3,xCenter+12-1,12)\
1713\009\009\009if comp == 1 then\
1714\009\009\009\009if pags > 1 then\
1715\009\009\009\009\009image.draw(xCenter-12-24,4,'/.ds/sys/Store@.apk/Resources/news/'..news[pags-1][\"img\"])\
1716\009\009\009\009else\
1717\009\009\009\009\009image.draw(xCenter-12-24,4,'/.ds/sys/Store@.apk/Resources/news/'..news[maxPage][\"img\"])\
1718\009\009\009\009end\
1719\009\009\009\009if pags < maxPage then\
1720\009\009\009\009\009image.draw(xCenter+12,4,'/.ds/sys/Store@.apk/Resources/news/'..news[pags+1][\"img\"])\
1721\009\009\009\009else\
1722\009\009\009\009\009image.draw(xCenter+12,4,'/.ds/sys/Store@.apk/Resources/news/'..news[1][\"img\"])\
1723\009\009\009\009end\
1724\009\009\009end\
1725\009\009\009image.draw(xCenter-12,4,'/.ds/sys/Store@.apk/Resources/news/'..news[pags][\"img\"])\
1726\009\009\009setTextColor(term.getBackgroundColor())\
1727\009\009\009setBackgroundColor(colors.white)\
1728\009\009\009usualText(string.char(7),xCenter+12-maxPage+pags-1,3)\
1729\009\009\009setTextColor(colors.black)\
1730\009\009\009usualText('<',1,7-4*comp)\
1731\009\009\009usualText('>',xSize,7-4*comp)\
1732\009\009\009setBackgroundColor(colors.lime)\
1733\009\009\009setTextColor(colors.white)\
1734\009\009\009usualText(\" Learn More \",xCenter,10)\
1735\009\009\009for i=1,10 do\
1736\009\009\009\009if b == pags then\
1737\009\009\009\009\009sleep(0.5)\
1738\009\009\009\009else\
1739\009\009\009\009\009break\
1740\009\009\009\009end\
1741\009\009\009end\
1742\009\009\009if b == pags then\
1743\009\009\009\009if maxPage > pags then\
1744\009\009\009\009\009pags = pags+1\
1745\009\009\009\009else\
1746\009\009\009\009\009pags = 1\
1747\009\009\009\009end\
1748\009\009\009end\
1749\009\009else\
1750\009\009\009sleep(0.5)\
1751\009\009end\
1752\009end\
1753end\
1754\
1755local redraw = function()\
1756\009if page == 1 then\
1757\009\009clear(colors.white)\
1758\009\009history = {}\
1759\009\009history[1] = 1\
1760\009\009setTextColor(colors.black)\
1761\009\009usualText('See all apps',2,13)\
1762\009\009usualText('Categories',2,15)\
1763\009\009usualText('Installed apps',2,17)\
1764\009--[[elseif page == 2 then\
1765\009\009clear(colors.white)\
1766\009\009local new = load('/.ds/sys/Store@.apk/Resources/news.cfg')\
1767\009\009if #new[screen] > 1 then\
1768\009\009\009seeApps(new[screen],3)\
1769\009\009else\
1770\009\009\009appinfo(new[screen][1])\
1771\009\009end]]\
1772\009elseif page == 3 then\
1773\009\009term.redirect(screen)\
1774\009\009clear(colors.white)\
1775\009\009local ender = math.floor((-pos-1)/5+ySize/5)\
1776\009\009if ender > #files then\
1777\009\009\009ender = #files\
1778\009\009end\
1779\009\009for i=math.floor((-pos-1)/5)+1,ender do\
1780\009\009\009local info = load(\"/.ds/sys/Store@.apk/Resources/repo/\"..files[i])\
1781\009\009\009app(info['name'],i*5+pos-2)\
1782\009\009end\
1783\009\009term.redirect(term.native())\
1784\009\009step = sysbar.scrollBar(#files,5,posScroll,2)\
1785\009elseif page == 4 then\
1786\009\009elms = 6\
1787\009\009clear(colors.white)\
1788\009\009sysbar.header('Store@',colors.lightGray,colors.white)\
1789\009\009sysbar.draw(colors.white,colors.black,noty,true,false)\
1790\009\009cursor = 0\
1791\009\009local info = load(\"/.ds/sys/Store@.apk/Resources/repo/\"..id..\".inf\")\
1792\009\009image.draw(2,pos + 4,\"/.ds/sys/Store@.apk/Resources/repo/\"..id..\".png\")\
1793\009\009setBackgroundColor(colors.white)\
1794\009\009setTextColor(colors.black)\
1795\009\009usualText(id,10,pos + 5)\
1796\009\009usualText('>',xSize-1,pos + 9)\
1797\009\009usualText('>',xSize-1,pos + 11)\
1798\009\009setTextColor(colors.lightGray)\
1799\009\009usualText(\"Category: \"..info['category'],2,pos + 9)\
1800\009\009usualText(\"Author: \"..info['by'],2,pos + 11)\
1801\009\009mods = ' Install '\
1802\009\009if info['code'] then\
1803\009\009\009if info['vedroidos'] and (OSversion < info['vedroidos']) or info['craftos'] and (string.sub(os.version(),9) < info['craftos']) or info['apilevel'] and (APIlevel < tonumber(info['apilevel'])) then\
1804\009\009\009\009setTextColor(colors.red)\
1805\009\009\009\009setBackgroundColor(colors.white)\
1806\009\009\009\009mods = 'Not supported'\
1807\009\009\009\009newObj('info',0,0,0,0)\
1808\009\009\009else\
1809\009\009\009\009local files = fs.list(instFolder)\
1810\009\009\009\009setBackgroundColor(colors.lime)\
1811\009\009\009\009setTextColor(colors.white)\
1812\009\009\009\009for i=1,#files do\
1813\009\009\009\009\009if files[i] == id..\".apk\" then\
1814\009\009\009\009\009\009mods=\" Update \"\
1815\009\009\009\009\009\009setTextColor(colors.lime)\
1816\009\009\009\009\009\009setBackgroundColor(colors.white)\
1817\009\009\009\009\009end\
1818\009\009\009\009end\
1819\009\009\009\009if id == 'Store@' then\
1820\009\009\009\009\009setTextColor(colors.lime)\
1821\009\009\009\009\009setBackgroundColor(colors.white)\
1822\009\009\009\009\009mods = ' Update '\
1823\009\009\009\009end\
1824\009\009\009\009usualText(mods,xSize-1-#mods,pos + 7)\
1825\009\009\009\009newObj('info',xSize-1-#mods,pos + 7,xSize-3,pos + 7)\
1826\009\009\009end\
1827\009\009else\
1828\009\009\009newObj('info',0,0,0,0)\
1829\009\009\009setTextColor(colors.orange)\
1830\009\009\009setBackgroundColor(colors.white)\
1831\009\009\009mods = \"Coming soon\"\
1832\009\009end\
1833\009\009usualText(mods,xSize-1-#mods,pos + 7)\
1834\009\009if info['about'] ~= nil then\
1835\009\009\009textPrinter(info['about'], pos + 13, colors.black, colors.white)\
1836\009\009end\
1837\009\009if info['vedroidos'] ~= nil then\
1838\009\009\009local x, y = term.getCursorPos()\
1839\009\009\009term.setCursorPos(2,y+2)\
1840\009\009\009setTextColor(colors.lightGray)\
1841\009\009\009if OSversion < info['vedroidos'] then\
1842\009\009\009\009setTextColor(colors.red)\
1843\009\009\009else\
1844\009\009\009\009setTextColor(colors.lightGray)\
1845\009\009\009end\
1846\009\009\009term.write(\"Gapple mOS version: \"..info['vedroidos'])\
1847\009\009\009elms = elms + 1\
1848\009\009end\
1849\009\009if info['craftos'] ~= nil then\
1850\009\009\009local x, y = term.getCursorPos()\
1851\009\009\009term.setCursorPos(2,y+2)\
1852\009\009\009if string.sub(os.version(),9) < info['craftos'] then\
1853\009\009\009\009setTextColor(colors.red)\
1854\009\009\009else\
1855\009\009\009\009setTextColor(colors.lightGray)\
1856\009\009\009end\
1857\009\009\009term.write(\"CraftOS version: \"..info['craftos'])\
1858\009\009\009elms = elms + 1\
1859\009\009end\
1860\009\009if info['apilevel'] ~= nil then\
1861\009\009\009local x, y = term.getCursorPos()\
1862\009\009\009term.setCursorPos(2,y+2)\
1863\009\009\009if APIlevel < tonumber(info['apilevel']) then\
1864\009\009\009\009setTextColor(colors.red)\
1865\009\009\009else\
1866\009\009\009\009setTextColor(colors.lightGray)\
1867\009\009\009end\
1868\009\009\009term.write(\"API level: \"..info['apilevel'])\
1869\009\009\009elms = elms + 1\
1870\009\009end\
1871\009\009if info['size'] ~= nil then\
1872\009\009\009local x, y = term.getCursorPos()\
1873\009\009\009term.setCursorPos(2,y+2)\
1874\009\009\009setTextColor(colors.lightGray)\
1875\009\009\009term.write(\"Size: \"..info['size'])\
1876\009\009\009elms = elms + 1\
1877\009\009end\
1878\009\009step = sysbar.scrollBar(elms-1,2,posScroll,2)\
1879\009elseif page == 5 then\
1880\009\009term.redirect(screen)\
1881\009\009clear(colors.white)\
1882\009\009categories = refreshCat()\
1883\009\009setTextColor(colors.black)\
1884\009\009for i=1,#categories do\
1885\009\009\009usualText(categories[i],2,i*2+pos)\
1886\009\009\009usualText(\">\",xSize-1,i*2+pos)\
1887\009\009\009newObj(categories[i],1,i*2+pos-2,xSize,i*2+pos)\
1888\009\009end\
1889\009\009term.redirect(term.native())\
1890\009\009step = sysbar.scrollBar(#categories-1,2,posScroll,2)\
1891\009elseif page == 6 then\
1892\009\009term.redirect(screen)\
1893\009\009clear(colors.white)\
1894\009\009files = fs.list('/.ds/'..l_login)\
1895\009\009local ender = math.floor((-pos-1)/5+ySize/5)\
1896\009\009if ender > #files then\
1897\009\009\009ender = #files\
1898\009\009end\
1899\009\009for i=math.floor((-pos-1)/5)+1,ender do\
1900\009\009\009instApp(files[i],\"/.ds/\"..l_login..'/'..files[i]..\"/Resources/icon.png\",1,i*5+pos-2)\
1901\009\009end\
1902\009\009term.redirect(term.native())\
1903\009\009step = sysbar.scrollBar(#files,5,posScroll,2)\
1904\009end\
1905\009sysbar.header('Store@',colors.lightGray,colors.white)\
1906\009sysbar.draw(colors.white,colors.black,noty,true,false)\
1907end\
1908\
1909local appinfo = function(name)\
1910\009--files = {}\
1911\009--files[1] = name..'.inf'\
1912\009prevScrl[#prevScrl+1] = {}\
1913\009prevScrl[#prevScrl][1] = pos\
1914\009prevScrl[#prevScrl][2] = posScroll\
1915\009posScroll = 0\
1916\009pos = -1\
1917\009if #prevID > 0 then\
1918\009\009prevID[#prevID+1] = id\
1919\009else\
1920\009\009prevID[1] = id\
1921\009end\
1922\009id = name\
1923\009page = 4\
1924\009history[#history+1] = page\
1925\009redraw()\
1926end\
1927\
1928local showCat = function(name)\
1929\009local fil = refresh()\
1930\009local j = 1\
1931\009local inf = \"\"\
1932\009prevFiles[#prevFiles+1] = files\
1933\009files = {}\
1934\009for i=1,#fil do\
1935\009\009inf = load(\"/.ds/sys/Store@.apk/Resources/repo/\"..fil[i])\
1936\009\009if inf[\"category\"] == name then\
1937\009\009\009files[j] = fil[i]\
1938\009\009\009j = j + 1\
1939\009\009end\
1940\009end\
1941\009page = 3\
1942\009prevScrl[#prevScrl+1] = {}\
1943\009prevScrl[#prevScrl][1] = pos\
1944\009prevScrl[#prevScrl][2] = posScroll\
1945\009pos = -1\
1946\009posScroll = 0\
1947\009history[#history+1] = page\
1948\009redraw()\
1949end\
1950\
1951local showAuth = function(name)\
1952\009local fil = refresh()\
1953\009local j = 1\
1954\009local inf = \"\"\
1955\009prevFiles[#prevFiles+1] = files\
1956\009files = {}\
1957\009for i=1,#fil do\
1958\009\009inf = load(\"/.ds/sys/Store@.apk/Resources/repo/\"..fil[i])\
1959\009\009if inf[\"by\"] == name then\
1960\009\009\009files[j] = fil[i]\
1961\009\009\009j = j + 1\
1962\009\009end\
1963\009end\
1964\009page = 3\
1965\009prevScrl[#prevScrl+1] = {}\
1966\009prevScrl[#prevScrl][1] = pos\
1967\009prevScrl[#prevScrl][2] = posScroll\
1968\009pos = -1\
1969\009posScroll = 0\
1970\009history[#history+1] = page\
1971\009redraw()\
1972end\
1973\
1974local inst = function(name)\
1975\009page = 7\
1976\009local info = load(\"/.ds/sys/Store@.apk/Resources/repo/\"..name)\
1977\009--shell.run(\"rm /.ds/\"..l_login..\"/\"..info['name']..\".apk\")\
1978\009clear(colors.white)\
1979\009setTextColor(colors.black)\
1980\009usualText(\"Installing \"..info['name'],xCenter-11,ySize-6)\
1981\009usualText(\"Please wait...\",xCenter-11,ySize-5)\
1982\009paintutils.drawLine(xCenter-11,ySize-2,xCenter+12,ySize-2,colors.gray)\
1983\
1984\009paintutils.drawPixel(xCenter-11,ySize-2,colors.lime)\
1985\
1986\009if pastebin(info['code'],\"/.ds/\"..l_login..\"/\"..info['name']..\".apk/main\") then\
1987\009\009sleep(0.7)\
1988\
1989\009\009paintutils.drawLine(xCenter-11,ySize-2,xCenter,ySize-2,colors.lime)\
1990\009\009fs.makeDir('/.ds/'..l_login..'/'..info['name']..'.apk/Resources')\
1991\
1992\009\009paintutils.drawLine(xCenter-11,ySize-2,xCenter+5,ySize-2,colors.lime)\
1993\009\009local f = fs.list('/.ds/'..l_login..'/'..info['name']..'.apk/Resources')\
1994\009\009for i=1,#f do\
1995\009\009\009if f[i] == 'icon.png' then\
1996\009\009\009\009fs.delete('/.ds/'..l_login..'/'..info['name']..'.apk/Resources/icon.png')\
1997\009\009\009\009break\
1998\009\009\009end\
1999\009\009end\
2000\009\009fs.copy('/.ds/sys/Store@.apk/Resources/repo/'..info['name']..'.png', '/.ds/'..l_login..'/'..info['name']..'.apk/Resources/icon.png')\
2001\
2002\009\009if info['res'] then\
2003\009\009\009for i=1,#info['res'] do\
2004\009\009\009\009pastebin(info['res'][i]['code'],'/.ds/'..l_login..'/'..info['name']..'.apk/Resources/'..info['res'][i]['name'])\
2005\009\009\009end\
2006\009\009end\
2007\
2008\009\009if info['adds'] then\
2009\009\009\009for i=1,#info['adds'] do\
2010\009\009\009\009pastebin(info['adds'][i]['code'],'/.ds/'..l_login..'/'..info['name']..'.apk/'..info['adds'][i]['name'])\
2011\009\009\009end\
2012\009\009end\
2013\
2014\009\009if info['api'] then\
2015\009\009\009for i=1,#info['api'] do\
2016\009\009\009\009pastebin(info['api'][i]['code'],info['api'][i]['name'])\
2017\009\009\009end\
2018\009\009end\
2019\
2020\009\009paintutils.drawLine(xCenter-11,ySize-2,xCenter+12,ySize-2,colors.lime)\
2021\009\009sleep(0.5)\
2022\
2023\009\009if noty ~= nil then\
2024\009\009\009noty[#noty+1]={[\"app\"]=info['name'], [\"text\"]=info['name']..\" installed\", [\"button\"]=\" Launch \", [\"ico\"]=string.char(25)}\
2025\009\009else\
2026\009\009\009noty[1]={[\"app\"]=info['name'], [\"text\"]=info['name']..\" installed\", [\"button\"]=\" Launch \", [\"ico\"]=string.char(25)}\
2027\009\009end\
2028\009end\
2029\
2030\009page = history[#history]\
2031\009if page == 4 then\
2032\009\009appinfo(info['name'])\
2033\009else\
2034\009\009redraw()\
2035\009end\
2036end\
2037\
2038local running = function()\
2039\009while run == true and l_login ~= '...' and l_login ~= nil and l_login ~= '' do\
2040\009\009event, side, x, y = os.pullEvent()\
2041\009\009if event == \"mouse_scroll\" then\
2042\009\009\009if side == 1 then\
2043\009\009\009\009if page == 3 or page == 6 or page == 5 then\
2044\009\009\009\009\009if (pos>-#files*5+ySize-5 and (page == 3 or page == 6)) or (pos > -#categories*2+ySize-2 and page == 5) then\
2045\009\009\009\009\009\009posScroll = posScroll-step\
2046\009\009\009\009\009\009pos = pos-2\
2047\009\009\009\009\009\009redraw()\
2048\009\009\009\009\009else\
2049\009\009\009\009\009\009if page == 3 or page == 6 then\
2050\009\009\009\009\009\009\009pos = -#files*5+ySize-5\
2051\009\009\009\009\009\009else\
2052\009\009\009\009\009\009\009pos = -#categories*2+ySize-2\
2053\009\009\009\009\009\009end\
2054\009\009\009\009\009end\
2055\009\009\009\009--[[else\
2056\009\009\009\009\009screen = screen+1\
2057\009\009\009\009\009if screen > maxScreen then\
2058\009\009\009\009\009\009screen = maxScreen\
2059\009\009\009\009\009else\
2060\009\009\009\009\009\009clear(colors.white)\
2061\009\009\009\009\009\009redraw()\
2062\009\009\009\009\009end]]\
2063\009\009\009\009elseif page == 4 then\
2064\009\009\009\009\009if pos>-elms*2+ySize-2 then\
2065\009\009\009\009\009\009posScroll = posScroll-step\
2066\009\009\009\009\009\009pos = pos-2\
2067\009\009\009\009\009\009redraw()\
2068\009\009\009\009\009else\
2069\009\009\009\009\009\009pos = -elms*2+ySize-2\
2070\009\009\009\009\009end\
2071\009\009\009\009end\
2072\009\009\009elseif side == -1 then\
2073\009\009\009\009if page == 3 or page == 6 or page == 5 or page == 4 then\
2074\009\009\009\009\009if pos<-1 then\
2075\009\009\009\009\009\009pos = pos+2\
2076\009\009\009\009\009\009posScroll = posScroll+step\
2077\009\009\009\009\009\009if pos > -1 then\
2078\009\009\009\009\009\009\009pos = -1\
2079\009\009\009\009\009\009end\
2080\009\009\009\009\009\009redraw()\
2081\009\009\009\009\009end\
2082\009\009\009\009--[[else\
2083\009\009\009\009\009screen = screen-1\
2084\009\009\009\009\009if screen < 1 then\
2085\009\009\009\009\009\009screen = 1\
2086\009\009\009\009\009else\
2087\009\009\009\009\009\009clear(colors.white)\
2088\009\009\009\009\009\009redraw()\
2089\009\009\009\009\009end]]\
2090\009\009\009\009end\
2091\009\009\009end\
2092\009\009--[[elseif event == \"key\" then\
2093\009\009\009if side == 208 then\
2094\009\009\009\009screen = screen+1\
2095\009\009\009\009if screen > maxScreen then\
2096\009\009\009\009\009screen = maxScreen\
2097\009\009\009\009else\
2098\009\009\009\009\009clear(colors.white)\
2099\009\009\009\009\009redraw()\
2100\009\009\009\009end\
2101\009\009\009elseif side == 200 then\
2102\009\009\009\009screen = screen-1\
2103\009\009\009\009if screen < 1 then\
2104\009\009\009\009\009screen = 1\
2105\009\009\009\009else\
2106\009\009\009\009\009clear(colors.white)\
2107\009\009\009\009\009redraw()\
2108\009\009\009\009end\
2109\009\009\009end]]\
2110\009\009elseif event == \"mouse_click\" then\
2111\009\009\009if sysbar.back(x,y) == true then\
2112\009\009\009\009if #history > 1 then\
2113\009\009\009\009\009x = 0\
2114\009\009\009\009\009y = 0\
2115\009\009\009\009\009if page == 4 then\
2116\009\009\009\009\009\009id = prevID[#prevID]\
2117\009\009\009\009\009\009prevID[#prevID] = nil\
2118\009\009\009\009\009\009--[[pos = bpos\
2119\009\009\009\009\009\009bpos = -1\
2120\009\009\009\009\009\009posScroll = bposScrll\
2121\009\009\009\009\009\009bposScrll = 0]]\
2122\009\009\009\009\009elseif page == 3 or page == 6 then\
2123\009\009\009\009\009\009if #prevFiles > 0 then\
2124\009\009\009\009\009\009\009files = prevFiles[#prevFiles]\
2125\009\009\009\009\009\009end\
2126\009\009\009\009\009\009prevFiles[#prevFiles] = nil\
2127\009\009\009\009\009end\
2128\009\009\009\009\009page = history[#history-1]\
2129\009\009\009\009\009history[#history] = nil\
2130\009\009\009\009\009pos = prevScrl[#prevScrl][1]\
2131\009\009\009\009\009posScroll = prevScrl[#prevScrl][2]\
2132\009\009\009\009\009prevScrl[#prevScrl] = nil\
2133\009\009\009\009\009redraw()\
2134\009\009\009\009else\
2135\009\009\009\009\009term.clear()\
2136\009\009\009\009\009term.setCursorPos(1,1)\
2137\009\009\009\009\009run = false\
2138\009\009\009\009end\
2139\009\009\009elseif sysbar.home(x,y) == true then\
2140\009\009\009\009term.clear()\
2141\009\009\009\009term.setCursorPos(1,1)\
2142\009\009\009\009home = true\
2143\009\009\009\009run = false\
2144\009\009\009elseif page == 1 then\
2145\009\009\009\009if x==1 and y==7-4*comp then\
2146\009\009\009\009\009setBackgroundColor(colors.lightGray)\
2147\009\009\009\009\009setTextColor(colors.white)\
2148\009\009\009\009\009usualText('<',1,7-4*comp)\
2149\009\009\009\009\009pags = pags - 1\
2150\009\009\009\009\009if pags < 1 then\
2151\009\009\009\009\009\009pags = maxPage\
2152\009\009\009\009\009end\
2153\009\009\009\009elseif x==xSize and y==7-4*comp then\
2154\009\009\009\009\009setBackgroundColor(colors.lightGray)\
2155\009\009\009\009\009setTextColor(colors.white)\
2156\009\009\009\009\009usualText('>',xSize,7-4*comp)\
2157\009\009\009\009\009pags = pags + 1\
2158\009\009\009\009\009if pags > maxPage then\
2159\009\009\009\009\009\009pags = 1\
2160\009\009\009\009\009end\
2161\009\009\009\009elseif y==13 then\
2162\009\009\009\009\009paintutils.drawLine(1,13,xSize,13,colors.lightGray)\
2163\009\009\009\009\009setTextColor(colors.white)\
2164\009\009\009\009\009usualText('See all apps',2,13)\
2165\009\009\009\009\009prevFiles[#prevFiles] = files\
2166\009\009\009\009\009page = 3\
2167\009\009\009\009\009prevScrl[#prevScrl+1] = {}\
2168\009\009\009\009\009prevScrl[#prevScrl][1] = pos\
2169\009\009\009\009\009prevScrl[#prevScrl][2] = posScroll\
2170\009\009\009\009\009pos = -1\
2171\009\009\009\009\009posScroll = 0\
2172\009\009\009\009\009files = refresh()\
2173\009\009\009\009\009history[#history+1] = page\
2174\009\009\009\009\009sleep(0.1)\
2175\009\009\009\009\009redraw()\
2176\009\009\009\009elseif y==15 then\
2177\009\009\009\009\009paintutils.drawLine(1,15,xSize,15,colors.lightGray)\
2178\009\009\009\009\009setTextColor(colors.white)\
2179\009\009\009\009\009usualText('Categories',2,15)\
2180\009\009\009\009\009prevScrl[#prevScrl+1] = {}\
2181\009\009\009\009\009prevScrl[#prevScrl][1] = pos\
2182\009\009\009\009\009prevScrl[#prevScrl][2] = posScroll\
2183\009\009\009\009\009pos = -1\
2184\009\009\009\009\009posScroll = 0\
2185\009\009\009\009\009page = 5\
2186\009\009\009\009\009history[#history+1] = page\
2187\009\009\009\009\009sleep(0.1)\
2188\009\009\009\009\009redraw()\
2189\009\009\009\009elseif y==17 then\
2190\009\009\009\009\009paintutils.drawLine(1,17,xSize,17,colors.lightGray)\
2191\009\009\009\009\009setTextColor(colors.white)\
2192\009\009\009\009\009usualText('Installed apps',2,17)\
2193\009\009\009\009\009page = 6\
2194\009\009\009\009\009prevScrl[#prevScrl+1] = {}\
2195\009\009\009\009\009prevScrl[#prevScrl][1] = pos\
2196\009\009\009\009\009prevScrl[#prevScrl][2] = posScroll\
2197\009\009\009\009\009pos = -1\
2198\009\009\009\009\009posScroll = 0\
2199\009\009\009\009\009history[#history+1] = page\
2200\009\009\009\009\009sleep(0.1)\
2201\009\009\009\009\009redraw()\
2202\009\009\009\009elseif x>=obj[\"news\"][\"x1\"] and x<=obj[\"news\"][\"x2\"] and y>=obj[\"news\"][\"y1\"] and y<=obj[\"news\"][\"y2\"] then\
2203\009\009\009\009\009local new = load('/.ds/sys/Store@.apk/Resources/news.cfg')\
2204\009\009\009\009\009if #new[pags]['apps'] > 1 then\
2205\009\009\009\009\009\009prevFiles[#prevFiles + 1] = files\
2206\009\009\009\009\009\009page = 3\
2207\009\009\009\009\009\009prevScrl[#prevScrl+1] = {}\
2208\009\009\009\009\009\009prevScrl[#prevScrl][1] = pos\
2209\009\009\009\009\009\009prevScrl[#prevScrl][2] = posScroll\
2210\009\009\009\009\009\009pos = -1\
2211\009\009\009\009\009\009posScroll = 0\
2212\009\009\009\009\009\009files = {}\
2213\009\009\009\009\009\009for i = 1, #new[pags]['apps'] do\
2214\009\009\009\009\009\009\009files[i] = new[pags]['apps'][i]..\".inf\"\
2215\009\009\009\009\009\009end\
2216\009\009\009\009\009\009history[#history+1] = page\
2217\009\009\009\009\009\009redraw()\
2218\009\009\009\009\009else\
2219\009\009\009\009\009\009appinfo(new[pags]['apps'][1])\
2220\009\009\009\009\009end\
2221\009\009\009\009end\
2222\009\009\009elseif page == 3 then\
2223\009\009\009\009--files = refresh()\
2224\009\009\009\009for i=1,#files do\
2225\009\009\009\009\009local info = load(\"/.ds/sys/Store@.apk/Resources/repo/\"..files[i])\
2226\009\009\009\009\009if x>=obj[info['name']][\"x1\"] and x<=obj[info['name']][\"x2\"] and y>=obj[info['name']][\"y1\"] and y<=obj[info['name']][\"y2\"] then\
2227\009\009\009\009\009\009inst(files[i])\
2228\009\009\009\009\009\009break\
2229\009\009\009\009\009elseif x>=obj[files[i]][\"x1\"] and x<=obj[files[i]][\"x2\"] and y>=obj[files[i]][\"y1\"] and y<=obj[files[i]][\"y2\"] then\
2230\009\009\009\009\009\009appinfo(info['name'])\
2231\009\009\009\009\009\009--history[#history+1] = 4\
2232\009\009\009\009\009\009break\
2233\009\009\009\009\009end\
2234\009\009\009\009end\
2235\009\009\009elseif page == 4 then\
2236\009\009\009\009if x>=obj['info'][\"x1\"] and x<=obj['info'][\"x2\"] and y>=obj['info'][\"y1\"] and y<=obj['info'][\"y2\"] then\
2237\009\009\009\009\009inst(id..\".inf\")\
2238\009\009\009\009elseif y==pos + 9 then\
2239\009\009\009\009\009local info = load(\"/.ds/sys/Store@.apk/Resources/repo/\"..id..\".inf\")\
2240\009\009\009\009\009paintutils.drawLine(1,pos + 9,xSize,pos + 9,colors.lightGray)\
2241\009\009\009\009\009setTextColor(colors.white)\
2242\009\009\009\009\009usualText(\"Category: \"..info['category'],2,pos + 9)\
2243\009\009\009\009\009sleep(0.1)\
2244\009\009\009\009\009showCat(info[\"category\"])\
2245\009\009\009\009elseif y==pos + 11 then\
2246\009\009\009\009\009local info = load(\"/.ds/sys/Store@.apk/Resources/repo/\"..id..\".inf\")\
2247\009\009\009\009\009paintutils.drawLine(1,pos + 11,xSize,pos + 11,colors.lightGray)\
2248\009\009\009\009\009setTextColor(colors.white)\
2249\009\009\009\009\009usualText(\"Author: \"..info['by'],2,pos + 11)\
2250\009\009\009\009\009sleep(0.1)\
2251\009\009\009\009\009showAuth(info[\"by\"])\
2252\009\009\009\009end\
2253\009\009\009elseif page == 5 then\
2254\009\009\009\009for i=1,#categories do\
2255\009\009\009\009\009if y == i*2 + 1 then\
2256\009\009\009\009\009\009paintutils.drawLine(1,i*2 + 1,xSize,i*2 + 1,colors.lightGray)\
2257\009\009\009\009\009\009setTextColor(colors.white)\
2258\009\009\009\009\009\009usualText(categories[i],2,i*2 + 1)\
2259\009\009\009\009\009\009sleep(0.1)\
2260\009\009\009\009\009\009showCat(categories[i])\
2261\009\009\009\009\009\009break\
2262\009\009\009\009\009end\
2263\009\009\009\009end\
2264\009\009\009elseif page == 6 then\
2265\009\009\009\009files = fs.list('/.ds/'..l_login)\
2266\009\009\009\009local ender = math.floor((-pos-1)/5+ySize/5)\
2267\009\009\009 if ender > #files then\
2268\009\009\009 \009 ender = #files\
2269\009\009\009 end\
2270\009\009\009\009for i=math.floor((-pos-1)/5)+1,ender do\
2271\009\009\009\009\009if x>=obj[files[i]][\"x1\"] and x<=obj[files[i]][\"x2\"] and y>=obj[files[i]][\"y1\"] and y<=obj[files[i]][\"y2\"] then\
2272\009\009\009\009\009\009local but = windows.select({\"Delete\"},{\"Are you sure?\"},{\"Yes\",colors.red,colors.white},{\"No\",colors.gray,colors.white})\
2273\009\009\009\009\009\009if but == \"Yes\" then\
2274\009\009\009\009\009\009\009fs.delete(\"/.ds/\"..l_login..'/'..files[i])\
2275\009\009\009\009\009\009\009redraw()\
2276\009\009\009\009\009\009\009break\
2277\009\009\009\009\009\009elseif but == \"No\" then\
2278\009\009\009\009\009\009\009redraw()\
2279\009\009\009\009\009\009end\
2280\009\009\009\009\009end\
2281\009\009\009\009end\
2282\009\009\009end\
2283\009\009end\
2284\009end\
2285end\
2286\
2287local start = function()\
2288\009redraw()\
2289\009running()\
2290end\
2291\
2292clear(colors.white)\
2293setTextColor(colors.black)\
2294usualText(\"Loading...\",xSize-10,19)\
2295pastebin(\"42ujyRYf\",\"/.ds/sys/Store@.apk/Resources/repo.zip\")\
2296zip.unarchive(\"/.ds/sys/Store@.apk/Resources/repo.zip\",\"/\")\
2297fs.delete(\"/.ds/sys/Store@.apk/Resources/repo.zip\")\
2298if l_login == '...' or l_login == nil or l_login == '' then\
2299\009pastebin(\"AH3k8DMa\",\"/System/ver.sec\")\
2300\009shell.run('/System/ver.sec')\
2301end\
2302parallel.waitForAny(start,drawNews, sysBar)\
2303clear(colors.black)",
2304 path = "//.ds/sys/Store@.apk/main",
2305 },
2306 {
2307 text = " 00 00 00 00 00 00\
2308 00 00u80p80 00 00\
2309 00 00O50S50 00 00\
2310 00 00 00 00 00 00",
2311 path = "//.ds/sys/Updater.apk/Resources/icon.png",
2312 },
2313 {
2314 text = "local run = true\
2315local xSize, ySize = term.getSize()\
2316local xCenter, yCenter = math.floor(xSize/2), math.floor(ySize/2-4)\
2317local screen = 1\
2318local maxScreen = 2\
2319local intro = \"OS beta installer\"\
2320\
2321local clear = function(color)\
2322 term.setCursorPos(1,1)\
2323 term.setBackgroundColor(color)\
2324 term.clear()\
2325end\
2326\
2327local usualText = function(string,xPos,yPos)\
2328 term.setCursorPos(xPos,yPos)\
2329 term.write(string)\
2330end\
2331\
2332local function restore(chto,kuda)\
2333\009local file = fs.open(chto,\"r\")\
2334\009Massiv = textutils.unserialise(file.readAll())\
2335\009file.close()\
2336\009for i=1,#Massiv do\
2337\009\009if Massiv[i][\"text\"] == \"@empty@empty\" then\
2338\009\009\009fs.makeDir(kuda..\"/\"..Massiv[i][\"path\"])\
2339\009\009else\
2340\009\009\009local file = fs.open(kuda..\"/\"..Massiv[i][\"path\"],\"w\")\
2341\009\009\009if Massiv[i]['text'] ~= nil then\
2342\009\009\009\009file.write(Massiv[i][\"text\"])\
2343\009\009\009else\
2344\009\009\009\009file.write(' ')\
2345\009\009\009end\
2346\009\009\009file.close()\
2347\009\009end\
2348\009end\
2349\009fs.delete('/System/desks/desk.back')\
2350\009fs.delete('/System/accounts/accs.back')\
2351end\
2352\
2353local pastebin = function(paste,filename)\
2354 local file = http.get(\"http://pastebin.com/raw.php?i=\"..paste)\
2355 if file then\
2356 file = file.readAll()\
2357 h=fs.open(filename,\"w\")\
2358 h.write(file)\
2359 h.close()\
2360 else\
2361 clear(colors.black)\
2362 term.setTextColor(colors.white)\
2363 usualText(\"ERROR!\",xSize/2-6,ySize/2)\
2364 end\
2365end\
2366\
2367local redraw = function()\
2368 clear(colors.black)\
2369 local bar = function()\
2370 term.setBackgroundColor(colors.white)\
2371 term.setTextColor(colors.lightGray)\
2372 usualText(intro,1,1)\
2373 end\
2374 if screen == 1 then\
2375 clear(colors.white)\
2376 bar()\
2377 term.setTextColor(colors.black)\
2378 term.setBackgroundColor(colors.lime)\
2379 term.setTextColor(colors.white)\
2380 usualText(\" Next \",xSize-6,ySize-1)\
2381 term.setBackgroundColor(colors.gray)\
2382 usualText(\" Exit \",2,ySize-1)\
2383 term.setBackgroundColor(colors.white)\
2384 term.setTextColor(colors.black)\
2385 usualText(\"This program will install\",xCenter-11,yCenter)\
2386 usualText(\"beta version of Gapple mOS\",xCenter-11,yCenter+1)\
2387 term.setTextColor(colors.red)\
2388 usualText(\"WARNING:\",xCenter-11,yCenter+3)\
2389 usualText(\"It may be unstable\",xCenter-11,yCenter+4)\
2390 usualText(\"Your Files may be deleted\",xCenter-11,yCenter+5)\
2391 term.setTextColor(colors.lightGray)\
2392 usualText(\"If you want to continue,\",xCenter-11,yCenter+7)\
2393 usualText('you should press \"Next\"',xCenter-11,yCenter+8)\
2394 elseif screen == 2 then\
2395 clear(colors.white)\
2396 bar()\
2397 term.setTextColor(colors.lightGray)\
2398 usualText(\"Updating:\",xCenter-11,ySize-4)\
2399 term.setTextColor(colors.black)\
2400 paintutils.drawLine(xCenter-11,ySize-1,xCenter+12,ySize-1,colors.gray)\
2401 paintutils.drawPixel(xCenter-11,ySize-1,colors.lime)\
2402 term.setBackgroundColor(colors.white)\
2403 usualText(\"Downloading rom...\",xCenter-11,ySize-3)\
2404 pastebin(\"Ld2SfQNW\",\"/OSrom\")\
2405 sleep(1)\
2406 paintutils.drawLine(xCenter-11,ySize-1,xCenter+1,ySize-1,colors.lime)\
2407 term.setBackgroundColor(colors.white)\
2408 usualText(\"Flashing rom... \",xCenter-11,ySize-3)\
2409 restore('/OSrom','')\
2410 fs.delete('/OSrom')\
2411 sleep(1)\
2412 paintutils.drawLine(xCenter-11,ySize-1,xCenter+12,ySize-1,colors.lime)\
2413 sleep(0.5)\
2414 clear(colors.white)\
2415 term.setTextColor(colors.lime)\
2416 usualText(\"Done\",xCenter-2,yCenter+4)\
2417 sleep(0.5)\
2418 run = false\
2419 end\
2420end\
2421\
2422local start = function()\
2423 while run do\
2424 event, side, x, y = os.pullEvent()\
2425 if event == \"mouse_click\" then\
2426 if x>=xSize-6 and x<=xSize-1 and y==ySize-1 then\
2427 screen = 2\
2428 redraw()\
2429 elseif x>=1 and x<=7 and y==ySize-1 then\
2430 run = false\
2431 end\
2432 end\
2433 end\
2434end\
2435\
2436redraw()\
2437start()\
2438clear(colors.black)\
2439fs.delete(\"/System/prog/up\")\
2440os.reboot()",
2441 path = "//.ds/sys/Updater.apk/main",
2442 },
2443 {
2444 text = "local xSize, ySize = term.getSize()\
2445local comp = false\
2446\
2447local usualText = function(string,xPos,yPos)\
2448\009term.setCursorPos(xPos,yPos)\
2449\009term.write(string)\
2450end\
2451\
2452function main(...)\
2453\009local waitFor = true\
2454\009local x = arg[1]\
2455\009local y = arg[2]\
2456\009local maxLenth = 3\
2457\009local output = nil\
2458\009for i=3,#arg do\
2459\009\009if #arg[i] > maxLenth then\
2460\009\009\009maxLenth = #arg[i]\
2461\009\009end\
2462\009end\
2463\009maxLenth = maxLenth + 1\
2464\009local xend = x+maxLenth\
2465\009local yend = y+#arg-1\
2466\009if x+maxLenth > xSize then\
2467\009\009xend = x\
2468\009\009x = x-maxLenth\
2469\009end\
2470\009if y+#arg > ySize then\
2471\009\009yend = y\
2472\009\009y = y-#arg+1\
2473\009end\
2474\009paintutils.drawFilledBox(x,y,xend,yend,colors.gray)\
2475\009term.setTextColor(colors.white)\
2476\009for i=3,#arg do\
2477\009\009usualText(arg[i],x+math.floor((maxLenth-1)/2)-math.floor(#arg[i]/2)+1,y+i-2)\
2478\009end\
2479\009while waitFor do\
2480\009\009event, side, xp, yp = os.pullEvent()\
2481\009\009if event == 'mouse_click' then \
2482\009\009\009for i=1,#arg-2 do\
2483\009\009\009\009if xp >= x and xp <= xend and yp >= y and yp <= yend then\
2484\009\009\009\009\009if yp == y+i then\
2485\009\009\009\009\009\009paintutils.drawFilledBox(x,y+i,xend,y+i,colors.lightGray)\
2486\009\009\009\009\009\009usualText(arg[i+2],x+math.floor((maxLenth-1)/2)-math.floor(#arg[i+2]/2)+1,y+i)\
2487\009\009\009\009\009\009sleep(0.1)\
2488\009\009\009\009\009\009output = arg[i+2]\
2489\009\009\009\009\009end\
2490\009\009\009\009end\
2491\009\009\009end\
2492\009\009\009return output\
2493\009\009end\
2494\009end\
2495end",
2496 path = "//System/API/contexts",
2497 },
2498 {
2499 text = "function draw(startX,startY,image,cutX,cutY)\
2500\009local Colors = {\
2501\009\009[\"0\"] = 1,\
2502\009\009[\"1\"] = 2,\
2503\009\009[\"2\"] = 4,\
2504\009\009[\"3\"] = 8,\
2505\009\009[\"4\"] = 16,\
2506\009\009[\"5\"] = 32,\
2507\009\009[\"6\"] = 64,\
2508\009\009[\"7\"] = 128,\
2509\009\009[\"8\"] = 256,\
2510\009\009[\"9\"] = 512,\
2511\009\009[\"a\"] = 1024,\
2512\009\009[\"b\"] = 2048,\
2513\009\009[\"c\"] = 4096,\
2514\009\009[\"d\"] = 8192,\
2515\009\009[\"e\"] = 16384,\
2516\009\009[\"f\"] = 32768\
2517\009}\
2518\009local Pixels = {}\
2519\
2520\009local function convert(mode,color)\
2521\009\009if mode == \"from cc\" then\
2522\009\009\009for key,value in pairs(Colors) do\
2523\009\009\009\009if color == value then\
2524\009\009\009\009\009return key\
2525\009\009\009\009end\
2526\009\009\009end\
2527\009\009else\
2528\009\009\009if color == \"#\" then\
2529\009\009\009\009return \"0\"\
2530\009\009\009else\
2531\009\009\009\009return Colors[color]\
2532\009\009\009end\
2533\009\009end\
2534\009end\
2535\
2536\009local function load(path)\
2537\009\009local file = fs.open(path,\"r\")\
2538\009\009if file == nil then\
2539\009\009\009file = fs.open('/System/imgError.png','r')\
2540\009\009end\
2541\009\009local lineCounter = 1\
2542\009\009while true do\
2543\009\009\009local line = file.readLine()\
2544\009\009\009Pixels[lineCounter]={}\
2545\009\009\009if line ~= nil then\
2546\009\009\009\009for i=1,#line,3 do\
2547\009\009\009\009\009Pixels[lineCounter][(i+2)/3]={[\"symbol\"] = string.sub(line,i,i),[\"textColor\"] = convert(\"to cc\",string.sub(line,i+1,i+1)),[\"backColor\"] = convert(\"to cc\",string.sub(line,i+2,i+2))}\
2548\009\009\009\009end\
2549\009\009\009\009lineCounter = lineCounter + 1\
2550\009\009\009else\
2551\009\009\009\009break\
2552\009\009\009end\
2553\009\009end\
2554\009\009file.close()\
2555\009end\
2556\
2557\009load(image)\
2558\
2559\009if cutX == nil or cutY == nil then\
2560\009\009cutX = #Pixels[1]\
2561\009\009cutY = #Pixels-1\
2562\009else\
2563\009\009if cutY >= #Pixels then cutY = #Pixels-1 end\
2564\009\009if cutX > #Pixels[1] then cutX = #Pixels[1] end\
2565\009end\
2566\
2567\009local function LT()\
2568\009\009for y=1,math.floor(cutY/2) do\
2569\009\009\009for x=1,math.floor(cutX/2) do\
2570\009\009\009\009if Pixels[y][x][\"symbol\"] ~= \"#\" then\
2571\009\009\009\009\009term.setTextColor(Pixels[y][x][\"textColor\"])\
2572\009\009\009\009\009term.setBackgroundColor(Pixels[y][x][\"backColor\"])\
2573\009\009\009\009\009term.setCursorPos(startX+x-1,startY+y-1)\
2574\009\009\009\009\009term.write(Pixels[y][x][\"symbol\"])\
2575\009\009\009\009end\
2576\009\009\009end\
2577\009\009end\
2578\009end\
2579\
2580\009local function LD()\
2581\009\009for y=math.floor(cutY/2)+1,cutY do\
2582\009\009\009for x=1,math.floor(cutX/2) do\
2583\009\009\009\009if Pixels[y][x][\"symbol\"] ~= \"#\" then\
2584\009\009\009\009\009term.setTextColor(Pixels[y][x][\"textColor\"])\
2585\009\009\009\009\009term.setBackgroundColor(Pixels[y][x][\"backColor\"])\
2586\009\009\009\009\009term.setCursorPos(startX+x-1,startY+y-1)\
2587\009\009\009\009\009term.write(Pixels[y][x][\"symbol\"])\
2588\009\009\009\009end\
2589\009\009\009end\
2590\009\009end\
2591\009end\
2592\
2593\009local function RT()\
2594\009\009for y=1,math.floor(cutY/2) do\
2595\009\009\009for x=math.floor(cutX/2)+1,cutX do\
2596\009\009\009\009if Pixels[y][x][\"symbol\"] ~= \"#\" then\
2597\009\009\009\009\009term.setTextColor(Pixels[y][x][\"textColor\"])\
2598\009\009\009\009\009term.setBackgroundColor(Pixels[y][x][\"backColor\"])\
2599\009\009\009\009\009term.setCursorPos(startX+x-1,startY+y-1)\
2600\009\009\009\009\009term.write(Pixels[y][x][\"symbol\"])\
2601\009\009\009\009end\
2602\009\009\009end\
2603\009\009end\
2604\009end\
2605\
2606\009local function RD()\
2607\009\009for y=math.floor(cutY/2)+1,cutY do\
2608\009\009\009for x=math.floor(cutX/2)+1,cutX do\
2609\009\009\009\009if Pixels[y][x][\"symbol\"] ~= \"#\" and Pixels[y][x][\"symbol\"] ~= \"\" then\
2610\009\009\009\009\009term.setTextColor(Pixels[y][x][\"textColor\"])\
2611\009\009\009\009\009term.setBackgroundColor(Pixels[y][x][\"backColor\"])\
2612\009\009\009\009\009term.setCursorPos(startX+x-1,startY+y-1)\
2613\009\009\009\009\009term.write(Pixels[y][x][\"symbol\"])\
2614\009\009\009\009end\
2615\009\009\009end\
2616\009\009end\
2617\009end\
2618\
2619\009parallel.waitForAll(LT,RT,LD,RD)\
2620end",
2621 path = "//System/API/image",
2622 },
2623 {
2624 text = "local APIlevel = 6\
2625local OSver = '5.6.0'\
2626\
2627function os()\
2628\009return OSver\
2629end\
2630\
2631function api()\
2632\009return APIlevel\
2633end",
2634 path = "//System/API/os_versions",
2635 },
2636 {
2637 text = "local xSize, ySize = term.getSize()\
2638local comp = false\
2639os.loadAPI('/System/API/windows')\
2640\
2641function checkInternet()\
2642\009local sTime = os.time()\
2643\009--math.abs((startSec - endSec)*100\
2644\009local file = http.get(\"http://pastebin.com/raw.php?i=euuA2T0D\")\
2645\009if file == nil then\
2646\009\009return 0\
2647\009else\
2648\009\009local eTime = os.time()\
2649\009\009local speed = 50 / (math.abs(sTime - eTime)*10)\
2650\009\009return speed\
2651\009end\
2652\009file.close()\
2653end\
2654\
2655function webStatus()\
2656\009local speed = checkInternet()\
2657\009local status = ''\
2658\009if speed > 0 then\
2659\009\009--132 144 148 149\
2660\009\009if speed < 1000 then\
2661\009\009\009status = string.char(132)\
2662\009\009elseif speed < 10000 then\
2663\009\009\009status = string.char(132)..string.char(132)\
2664\009\009else\
2665\009\009\009status = string.char(132)..string.char(132)..string.char(132)\
2666\009\009end\
2667\009else\
2668\009\009status = string.char(132)..string.char(132)..'x'\
2669\009end\
2670\009return status\
2671end\
2672\
2673local usualText = function(string,xPos,yPos)\
2674\009term.setCursorPos(xPos,yPos)\
2675\009term.write(string)\
2676end\
2677\
2678function draw(color,textColor,noty,inapp,settings,timer,showWebStatus)\
2679\009local time = ''\
2680\009if timer ~= false then\
2681\009\009time = textutils.formatTime(os.time(),true)\
2682\009end\
2683\
2684\009local function bar()\
2685\009\009local obj = {}\
2686\009\009if xSize > 30 then comp = true end\
2687\009\009term.setTextColor(textColor)\
2688\009\009term.setBackgroundColor(color)\
2689\
2690\009\009if comp == false then\
2691\009\009\009if inapp == false then\
2692\009\009\009\009paintutils.drawLine(0,1,xSize,1,color)\
2693\009\009\009\009usualText(time,xSize-#time,1)\
2694\009\009\009\009if noty~=nil then\
2695\009\009\009\009\009for i=1,#noty do\
2696\009\009\009\009\009\009if noty[i][\"ico\"] ~= nil then\
2697\009\009\009\009\009\009\009usualText(noty[i][\"ico\"],i,1)\
2698\009\009\009\009\009\009else\
2699\009\009\009\009\009\009\009usualText(\"+\",i,1)\
2700\009\009\009\009\009\009end\
2701\009\009\009\009\009end\
2702\009\009\009\009end\
2703\009\009\009end\
2704\009\009\009paintutils.drawLine(0,ySize,xSize,ySize,color)\
2705\009\009\009usualText(\"()\",xSize/2,ySize)\
2706\009\009\009usualText(\"<<\",xSize/2-4,ySize)\
2707\009\009\009usualText(\"[]\",xSize/2+4,ySize)\
2708\009\009\009if settings == true then\
2709\009\009\009\009usualText(\"|\",xSize,ySize)\
2710\009\009\009end\
2711\009\009elseif comp == true then\
2712\009\009\009local padd = 0\
2713\009\009\009if showWebStatus then\
2714\009\009\009\009padd = 4\
2715\009\009\009end\
2716\009\009\009paintutils.drawLine(0,ySize,xSize,ySize,color)\
2717\009\009\009usualText(time,xSize-#time-1,ySize)\
2718\009\009\009usualText(\"()\",5,ySize)\
2719\009\009\009usualText(\"<<\",2,ySize)\
2720\009\009\009usualText(\"[]\",8,ySize)\
2721\009\009\009if settings == true then\
2722\009\009\009\009usualText(\"|\",xSize,ySize)\
2723\009\009\009end\
2724\009\009\009if noty~=nil then\
2725\009\009\009\009for i=1,#noty do\
2726\009\009\009\009\009if noty[i][\"ico\"] ~= nil then\
2727\009\009\009\009\009\009usualText(noty[i][\"ico\"],xSize-2-i-padd-#time,ySize)\
2728\009\009\009\009\009else\
2729\009\009\009\009\009\009usualText(\"+\",xSize-2-i-padd-#time,ySize)\
2730\009\009\009\009\009end\
2731\009\009\009\009end\
2732\009\009\009end\
2733\009\009end\
2734\009end\
2735\
2736\009local function webStat()\
2737\009\009if showWebStatus then\
2738\009\009\009local stat = webStatus()\
2739\009\009\009if comp then\
2740\009\009\009\009usualText(stat,xSize-#time-5,ySize)\
2741\009\009\009else\
2742\009\009\009\009if not inapp then\
2743\009\009\009\009\009usualText(stat,xSize-#time-4,1)\
2744\009\009\009\009end\
2745\009\009\009end\
2746\009\009end\
2747\009end\
2748\009--bar()\
2749\009parallel.waitForAll(bar,webStat)\
2750end\
2751\
2752function back(x,y)\
2753\009if xSize > 30 then comp = true end\
2754\009if comp == false then\
2755\009\009if (x >= math.floor(xSize/2)-4 and x <= math.floor(xSize/2)-3) and y==ySize then\
2756\009\009\009term.setBackgroundColor(colors.lightGray)\
2757\009\009\009term.setTextColor(colors.white)\
2758\009\009\009usualText(\" << \",xSize/2-5,ySize)\
2759\009\009\009sleep(0.1)\
2760\009\009\009return true\
2761\009\009else\
2762\009\009\009return false\
2763\009\009end\
2764\009elseif comp == true then\
2765\009\009if (x == 2 or x == 3) and y==ySize then\
2766\009\009\009term.setBackgroundColor(colors.lightGray)\
2767\009\009\009term.setTextColor(colors.white)\
2768\009\009\009usualText(\" << \",1,ySize)\
2769\009\009\009sleep(0.1)\
2770\009\009\009return true\
2771\009\009else\
2772\009\009\009return false\
2773\009\009end\
2774\009end\
2775end\
2776\
2777function home(x,y)\
2778\009if xSize > 30 then comp = true end\
2779\009if comp == false then\
2780\009\009if (x >= math.floor(xSize/2) and x <= math.floor(xSize/2)+1) and y==ySize then\
2781\009\009\009term.setBackgroundColor(colors.lightGray)\
2782\009\009\009term.setTextColor(colors.white)\
2783\009\009\009usualText(\" () \",xSize/2-1,ySize)\
2784\009\009\009sleep(0.1)\
2785\009\009\009home = true\
2786\009\009\009return true\
2787\009\009else\
2788\009\009\009return false\
2789\009\009end\
2790\009elseif comp == true then\
2791\009\009if (x == 5 or x == 6) and y==ySize then\
2792\009\009\009term.setBackgroundColor(colors.lightGray)\
2793\009\009\009term.setTextColor(colors.white)\
2794\009\009\009usualText(\" () \",4,ySize)\
2795\009\009\009sleep(0.1)\
2796\009\009\009home = true\
2797\009\009\009return true\
2798\009\009else\
2799\009\009\009return false\
2800\009\009end\
2801\009end\
2802end\
2803\
2804function recents(x,y)\
2805\009if xSize > 30 then comp = true end\
2806\009if comp == false then\
2807\009\009if (x >= math.floor(xSize/2)+4 and x <= math.floor(xSize/2)+5) and y==ySize then\
2808\009\009\009term.setBackgroundColor(colors.lightGray)\
2809\009\009\009term.setTextColor(colors.white)\
2810\009\009\009usualText(\" [] \",xSize/2+3,ySize)\
2811\009\009\009sleep(0.1)\
2812\009\009\009return true\
2813\009\009else\
2814\009\009\009return false\
2815\009\009end\
2816\009elseif comp == true then\
2817\009\009if (x == 8 or x == 9) and y==ySize then\
2818\009\009\009term.setBackgroundColor(colors.lightGray)\
2819\009\009\009term.setTextColor(colors.white)\
2820\009\009\009usualText(\" [] \",7,ySize)\
2821\009\009\009sleep(0.1)\
2822\009\009\009return true\
2823\009\009else\
2824\009\009\009return false\
2825\009\009end\
2826\009end\
2827end\
2828\
2829function notifyCheck(x,y)\
2830\009local time = textutils.formatTime(os.time(),true)\
2831\009if xSize > 30 then comp = true end\
2832\009if comp == false then\
2833\009\009if y==1 then\
2834\009\009\009return true\
2835\009\009else\
2836\009\009\009return false\
2837\009\009end\
2838\009elseif comp == true then\
2839\009\009if (x > 9 and x < xSize-#time-1) and y==ySize then\
2840\009\009\009return true\
2841\009\009else\
2842\009\009\009return false\
2843\009\009end\
2844\009end\
2845end\
2846\
2847function header(text,textColor,backColor)\
2848\009paintutils.drawLine(1,1,xSize,1,backColor)\
2849\009paintutils.drawLine(1,2,xSize,2,backColor)\
2850\009term.setTextColor(textColor)\
2851\009usualText(text,1,1)\
2852end\
2853\
2854function switch(y, pos, color)\
2855\009if pos == nil then\
2856\009\009pos = false\
2857\009end\
2858\009if color == nil then\
2859\009\009color = colors.lightBlue\
2860\009end\
2861\009paintutils.drawLine(xSize-7,y,xSize-2,y,colors.gray)\
2862\009if pos==true or pos==1 then\
2863\009\009paintutils.drawLine(xSize-4,y,xSize-2,y,color)\
2864\009else\
2865\009\009paintutils.drawLine(xSize-7,y,xSize-5,y,colors.lightGray)\
2866\009end\
2867end\
2868\
2869function scrollBar(count, size, pos, sizeStep, color2, color1)\
2870\009local lenthScroll = 0\
2871\009local posScroll = 0\
2872\009local lenthPage = 0\
2873\009local step = 0\
2874\009if color1 == nil then\
2875\009\009color1 = colors.white\
2876\009end\
2877\009if color2 == nil then\
2878\009\009color2 = colors.lightGray\
2879\009end\
2880\009paintutils.drawLine(xSize,3,xSize,ySize-1,color2)\
2881\009if count>0 then\
2882\009\009if count*size > ySize-3 then\
2883\009\009\009lenthPage = count*size\
2884\009\009\009lenthScroll = math.floor((ySize-3)/(lenthPage/(ySize-3)))\
2885\009\009\009step = ((ySize-4)-lenthScroll)/math.floor((lenthPage-(ySize-4))/sizeStep)\
2886\
2887\009\009else\
2888\009\009\009step = 0\
2889\009\009\009lenthScroll = ySize-3\
2890\009\009end\
2891\009else\
2892\009\009lenthScroll = ySize-3\
2893\009end\
2894\009paintutils.drawLine(xSize,3-pos,xSize,3+lenthScroll-pos,color1)\
2895\009return step\
2896end\
2897\
2898function search(path, expand, input)\
2899\009if path == nil then path = \"\" end\
2900\009local waitFor = true\
2901\009local output = nil\
2902\009term.setTextColor(colors.black)\
2903\009if xSize > 30 then comp = 1 else comp = 0 end\
2904\009paintutils.drawLine(3,2-comp,xSize-2,2-comp,colors.white)\
2905\009paintutils.drawLine(3,3-comp,xSize-2,3-comp,colors.white)\
2906\009paintutils.drawLine(3,4-comp,xSize-2,4-comp,colors.white)\
2907\009term.setCursorPos(4,3-comp)\
2908\009local keyWord = read()\
2909\009if input == false or input == nil then\
2910\009\009local result = {}\
2911\009\009if keyWord ~= \"\" then\
2912\009\009\009result = fs.find(path..keyWord..\"*\")\
2913\009\009end\
2914\009\009if expand == true then\
2915\009\009\009if result ~= nil then\
2916\009\009\009\009local i = 1\
2917\009\009\009\009while result[i] ~= nil do\
2918\009\009\009\009\009if fs.isDir(result[i]) == true then\
2919\009\009\009\009\009\009for ii=i,#result-1 do\
2920\009\009\009\009\009\009\009result[ii] = result[ii+1]\
2921\009\009\009\009\009\009end\
2922\009\009\009\009\009\009result[#result] = nil\
2923\009\009\009\009\009end\
2924\009\009\009\009\009i = i +1\
2925\009\009\009\009end\
2926\009\009\009\009term.setTextColor(colors.white)\
2927\009\009\009\009paintutils.drawLine(3,5-comp,xSize-2,5-comp,colors.lightGray)\
2928\009\009\009\009for i=1,#result do\
2929\009\009\009\009\009paintutils.drawLine(3,5-comp+i,xSize-2,5-comp+i,colors.lightGray)\
2930\009\009\009\009\009usualText(result[i],5,5-comp+i)\
2931\009\009\009\009\009paintutils.drawLine(3,6-comp+i,xSize-2,6-comp+i,colors.lightGray)\
2932\009\009\009\009end\
2933\009\009\009end\
2934\009\009\009while waitFor==true and keyWord~=\"\" do\
2935\009\009\009\009local event, side, xp, yp = os.pullEvent()\
2936\009\009\009\009if event == 'mouse_click' then\
2937\009\009\009\009\009for i=1,#result do\
2938\009\009\009\009\009\009if xp >= 3 and xp <= xSize-2 and yp==i+5-comp then\
2939\009\009\009\009\009\009\009output = result[i]\
2940\009\009\009\009\009\009end\
2941\009\009\009\009\009end\
2942\009\009\009\009\009waitFor = false\
2943\009\009\009\009\009comp = false\
2944\009\009\009\009\009return output\
2945\009\009\009\009end\
2946\009\009\009end\
2947\009\009else\
2948\009\009\009comp = false\
2949\009\009\009return result\
2950\009\009end\
2951\009else\
2952\009\009comp = false\
2953\009\009return keyWord\
2954\009end\
2955end",
2956 path = "//System/API/sysbar",
2957 },
2958 {
2959 text = "local OSversion = \"5.6.0\"\
2960local APIlevel = 6\
2961\
2962local xSize, ySize = term.getSize()\
2963os.loadAPI('/System/API/windows')\
2964\
2965local function getLastVer(arg)\
2966\009local file = http.get(\"http://pastebin.com/raw.php?i=Qz17077y\")\
2967\009if file then\
2968\009\009file = file.readAll()\
2969\009\009h=fs.open(\"/System/API/os_versions\",\"w\")\
2970\009\009h.write(file)\
2971\009\009h.close()\
2972\009\009os.loadAPI(\"/System/API/os_versions\")\
2973\009\009if arg == nil then\
2974\009\009\009return os_versions.os(), os_versions.api()\
2975\009\009elseif arg == true then\
2976\009\009\009return os_versions.os()\
2977\009\009elseif arg == false then\
2978\009\009\009return os_versions.api()\
2979\009\009end\
2980\009\009os.unloadAPI(\"os_versions\")\
2981\009\009fs.delete(\"/System/API/os_versions\")\
2982\009else\
2983\009\009--windows.attention({\"Attention!\",},{\"Check your Internet connection\"})\
2984\009\009windows.error(\"Check your Internet connection\")\
2985\009\009return 'nil'\
2986\009end\
2987end\
2988\
2989local usualText = function(string,xPos,yPos)\
2990\009term.setCursorPos(xPos,yPos)\
2991\009term.write(string)\
2992end\
2993\
2994function getOSversion()\
2995\009\009return OSversion\
2996end\
2997\
2998function getAPIlevel()\
2999\009\009return APIlevel\
3000end\
3001\
3002function getVersions()\
3003\009\009return OSversion, APIlevel\
3004end\
3005\
3006function lastOSversion()\
3007\009\009return getLastVer(true)\
3008end\
3009\
3010function lastAPIlevel()\
3011\009\009return getLastVer(false)\
3012end\
3013\
3014function lastVersions()\
3015\009\009return getLastVer()\
3016end\
3017\
3018function takeScreenshot(from,path,func)\
3019\009local oldOpen = fs.open\
3020\009if func then\
3021\009\009fs.open = func\
3022\009end\
3023\009local file = fs.open(path,'w')\
3024\009local maxY = 0\
3025\009for i=1,#from do\
3026\009\009if #from[i] > maxY then\
3027\009\009\009maxY = #from[i]\
3028\009\009end\
3029\009end\
3030\
3031\009for i=1,#from do\
3032\009\009local line = ''\
3033\009\009for j=1,maxY do\
3034\009\009\009if from[i][j] == nil then\
3035\009\009\009\009from[i][j] = \"###\"\
3036\009\009\009end\
3037\009\009\009line = line..from[i][j]\
3038\009\009end\
3039\009\009file.writeLine(line)\
3040\009end\
3041\009file.close()\
3042\009if func then\
3043\009\009fs.open = oldOpen\
3044\009end\
3045\009return true\
3046end\
3047\
3048function runApp(name,args)\
3049\009\009local files = fs.list('/.ds/sys')\
3050\009\009local find = false\
3051\009\009local error = ''\
3052\009\009for i=1,#files do\
3053\009\009\009\009if files[i] == name..'.apk' then\
3054\009\009\009\009\009\009find = true\
3055\009\009\009\009\009\009break\
3056\009\009\009\009end\
3057\009\009end\
3058\009\009if not find then\
3059\009\009\009\009files = fs.list('/.ds/'..env['l_login'])\
3060\009\009\009\009for i=1,#files do\
3061\009\009\009\009\009\009if files[i] == name..'.apk' then\
3062\009\009\009\009\009\009\009\009find = true\
3063\009\009\009\009\009\009\009\009break\
3064\009\009\009\009\009\009end\
3065\009\009\009\009end\
3066\009\009end\
3067\009\009if find then\
3068\009\009\009\009error = os.run(env['env'],app,args)\
3069\009\009\009\009term.redirect(term.native())\
3070\009\009\009\009--access = 1\
3071\009\009\009\009if error then\
3072\009\009\009\009\009\009windows.error(error)\
3073\009\009\009\009else\
3074\009\009\009\009\009\009error = nil\
3075\009\009\009\009end\
3076\009\009else\
3077\009\009\009\009error = 'File not found'\
3078\009\009\009\009windows.error(error)\
3079\009\009end\
3080\009\009return error\
3081end",
3082 path = "//System/API/vedroid",
3083 },
3084 {
3085 text = "local xSize,ySize = term.getSize()\
3086local centerX,centerY = math.floor(xSize/2),math.floor(ySize/2)\
3087\
3088function findPeripheral(whatToFind)\
3089 local PeriList = peripheral.getNames()\
3090 for i=1,#PeriList do\
3091 if peripheral.getType(PeriList[i]) == whatToFind then\
3092 return PeriList[i]\
3093 end\
3094 end\
3095end\
3096\
3097function findWirelessModem()\
3098\009local periList = peripheral.getNames()\
3099\009for i=1,#periList do\
3100\009\009if peripheral.getType(periList[i]) == \"modem\" then\
3101\009\009\009local govno = peripheral.wrap(periList[i])\
3102\009\009\009if govno.isWireless() then\
3103\009\009\009\009return periList[i]\
3104\009\009\009end\
3105\009\009end\
3106\009end\
3107end\
3108\
3109function clickedAtArea(x,y,sx,sy,ex,ey)\
3110 if (x >= sx) and (x <= ex) and (y >= sy) and (y <= ey) then return true end\
3111 return false\
3112end\
3113\
3114function toboolean(s)\
3115\009if s == \"true\" then\
3116\009\009return true\
3117\009else\
3118\009\009return false\
3119\009end\
3120end\
3121\
3122function colorText(x,y,text,textColor)\
3123\009term.setTextColor(textColor)\
3124\009term.setCursorPos(x,y)\
3125\009term.write(text)\
3126end\
3127\
3128function colorTextWithBack(x,y,text,textColor,backColor)\
3129\009term.setTextColor(textColor)\
3130\009term.setBackgroundColor(backColor)\
3131\009term.setCursorPos(x,y)\
3132\009term.write(text)\
3133end\
3134\
3135function usualText(x,y,text)\
3136\009term.setCursorPos(x,y)\
3137\009term.write(text)\
3138end\
3139\
3140local function textToTable(text)\
3141 local words = {}\
3142\009local pos = 1\
3143\
3144\009for i = 1, #text do\
3145\009\009if string.sub(text,i,i) ~= \" \" then\
3146\009\009\009if words[pos] == nil then\
3147\009\009\009\009words[pos] = \"\"\
3148\009\009\009end\
3149\009\009\009words[pos] = words[pos]..string.sub(text,i,i)\
3150\009\009else\
3151\009\009\009pos = pos + 1\
3152\009\009end\
3153\009end\
3154 return words\
3155end\
3156\
3157local function textPrinter(text,y,colorT,colorB,align)\
3158 if colorT then\
3159 term.setTextColor(colorT)\
3160 end\
3161 if colorB then\
3162\009 term.setBackgroundColor(colorB)\
3163 end\
3164 local words = textToTable(text)\
3165 local lines = {}\
3166\009local pos = 2+#words[1]\
3167 local elms = 1\
3168\
3169 lines[1] = words[1]..\" \"\
3170 for i=2, #words do\
3171\009\009pos = pos + #words[i]\
3172\009\009if pos <= xSize-1 then\
3173\009\009\009lines[elms] = lines[elms]..words[i]..\" \"\
3174\009\009\009pos = pos+1\
3175\009\009else\
3176 lines[elms] = string.sub(lines[elms],1,#lines[elms]-1)\
3177\009\009\009elms = elms + 1\
3178 lines[elms] = words[i]..\" \"\
3179 \009\009pos = 2 + #words[i]\
3180\009\009end\
3181\009end\
3182\
3183 if align == 'justify' then\
3184 for i=1,#lines do\
3185 if #lines[i] < xSize-3 and #lines[i] > math.floor(xSize/2 + xSize/5) then\
3186 local j = 1\
3187 local space = 0\
3188 while j < #lines[i] and #lines[i] <= xSize-3 do\
3189 if j < #lines[i] and string.sub(lines[i],j,j) == ' ' then\
3190 lines[i] = string.sub(lines[i],1,j)..string.sub(lines[i],j,#lines[i])\
3191 j = j + 3 + space\
3192 else\
3193 j = j + 1\
3194 end\
3195 if j >= #lines[i] then\
3196 j = 1\
3197 space = space + 1\
3198 end\
3199 end\
3200 end\
3201 end\
3202 end\
3203\
3204 if colorT then\
3205\009 for i=1, #lines do\
3206 if align == 'center' then\
3207 term.setCursorPos(math.floor(xSize/2-#lines[i]/2)+1,i+y-1)\
3208 elseif align == 'right' then\
3209 term.setCursorPos(xSize-#lines[i]+1,i+y-1)\
3210 else\
3211 term.setCursorPos(2,i+y-1)\
3212 end\
3213\009\009 term.write(lines[i])\
3214 end\
3215 end\
3216 return elms\
3217end\
3218\
3219function centerText(how,coord,text,textColor,backColor)\
3220\009term.setTextColor(textColor)\
3221\009term.setBackgroundColor(backColor)\
3222\009if how == \"xy\" then\
3223\009\009term.setCursorPos(math.floor(xSize/2-#text/2),math.floor(ySize/2))\
3224\009elseif how == \"x\" then\
3225\009\009term.setCursorPos(math.floor(xSize/2-#text/2),coord)\
3226\009elseif how == \"y\" then\
3227\009\009term.setCursorPos(coord,math.floor(ySize/2))\
3228\009end\
3229\009term.write(text)\
3230end\
3231\
3232function square(x1,y1,width,height,color)\
3233\009local string = string.rep(\" \",width)\
3234\009term.setBackgroundColor(color)\
3235\009for y=y1,(y1+height-1) do\
3236\009\009usualText(x1,y,string)\
3237\009end\
3238end\
3239\
3240function circle(cx, cy, radius, char, backColor, textColor)\
3241\009local x = radius\
3242 local y = 0\
3243 local radiusError = 1 - x\
3244 term.setTextColor(textColor)\
3245 term.setBackgroundColor(backColor)\
3246 while (x >= y) do\
3247 usualText(x + cx, y + cy, char)\
3248 usualText(y + cx, x + cy, char)\
3249 usualText(-x + cx, y + cy, char)\
3250 usualText(-y + cx, x + cy, char)\
3251 usualText(-x + cx, -y + cy, char)\
3252 usualText(-y + cx, -x + cy, char)\
3253 usualText(x + cx, -y + cy, char)\
3254 usualText(y + cx, -x + cy, char)\
3255 y = y + 1\
3256 if (radiusError < 0) then\
3257 radiusError = radiusError + (2 * y + 1)\
3258 else\
3259 x = x - 1\
3260 radiusError = radiusError + (2 * (y - x + 1))\
3261 end\
3262 end\
3263end\
3264\
3265function clearScreen(color)\
3266\009term.setBackgroundColor(color)\
3267\009term.clear()\
3268end\
3269\
3270function fadeIn(time)\
3271\009clearScreen(colors.gray)\
3272\009sleep(time)\
3273\009clearScreen(colors.lightGray)\
3274\009sleep(time)\
3275\009clearScreen(colors.white)\
3276\009sleep(time)\
3277end\
3278\
3279function fadeOut(time)\
3280\009clearScreen(colors.lightGray)\
3281\009sleep(time)\
3282\009clearScreen(colors.gray)\
3283\009sleep(time)\
3284\009clearScreen(colors.black)\
3285\009sleep(time)\
3286\009term.setCursorPos(1,1)\
3287\009term.setTextColor(colors.white)\
3288end\
3289\
3290function emptyWindow(xStart,yStart,xWindowSize,yWindowSize,title)\
3291\009--DRAW WINDOW\
3292 square(xStart+1,yStart-1,xWindowSize,yWindowSize+2,colors.lightGray)\
3293\009square(xStart+1,yStart,xWindowSize,yWindowSize,colors.white)\
3294\009colorText(math.floor(xStart+xWindowSize/2-#title/2),yStart,title,colors.gray)\
3295end\
3296\
3297function sampleWindow(xStart,yStart,xWindowSize,yWindowSize)\
3298\009square(xStart+1,yStart,xWindowSize,yWindowSize,colors.white)\
3299end\
3300\
3301function stringLimit(mode,text,size,noDots)\
3302\009if string.len(text)<=size then return text end\
3303\009if mode == \"start\" then\
3304\009\009if noDots then\
3305\009\009\009return string.sub(text,#text-size+1,-1)\
3306\009\009else\
3307\009\009\009return \"...\"..string.sub(text,#text-size+4,-1)\
3308\009\009end\
3309\009else\
3310\009\009if noDots then\
3311\009\009\009return string.sub(text,1,size)\
3312\009\009else\
3313\009\009\009return string.sub(text,1,size-3)..\"...\"\
3314\009\009end\
3315\009end\
3316end\
3317\
3318function getFileFormat(path)\
3319\009local name = fs.getName(path)\
3320\009local starting,ending = string.find(name,\"(.)%.[%d%w]*$\")\
3321\009if starting == nil then\
3322\009\009return nil\
3323\009else\
3324\009\009return string.sub(name,starting+1,-1)\
3325\009end\
3326end\
3327\
3328function isFileHidden(path)\
3329\009local name = fs.getName(path)\
3330\009local starting,ending = string.find(name,\"^%.(.*)$\")\
3331\009if starting == nil then\
3332\009\009return false\
3333\009else\
3334\009\009return true\
3335\009end\
3336end\
3337\
3338function hideFileFormat(path)\
3339\009local name = fs.getName(path)\
3340\009local fileFormat = getFileFormat(name)\
3341\009if fileFormat == nil then\
3342\009\009return name\
3343\009else\
3344\009\009return string.sub(name,1,#name-#fileFormat)\
3345\009end\
3346end\
3347\
3348function getFileSize(path)\
3349\009local allFilesSize = 0\
3350\009if fs.isDir(path) then\
3351\009\009local fileList = fs.list(path)\
3352\009\009for i=1,#fileList do\
3353\009\009\009allFilesSize = allFilesSize + getFileSize(path..\"/\"..fileList[i])\
3354\009\009end\
3355\009else\
3356\009\009allFilesSize = allFilesSize + fs.getSize(path)\
3357\009end\
3358\009return allFilesSize\
3359end\
3360\
3361--[[function getFileType(path)\
3362\009local fileTypes = {\
3363\009\009[\".png\"] = \"Image\",\
3364\009\009[\".cfg\"] = \"Config\",\
3365\009\009[\".zip\"] = \"Archive\",\
3366\009\009[\".app\"] = \"Application\",\
3367\009}\
3368\
3369\009local currentFileType = nil\
3370\
3371\009local fileFormat = getFileFormat(path)\
3372\009if fileFormat == nil then\
3373\009\009if fs.isDir(path) then\
3374\009\009\009currentFileType = \"Folder\"\
3375\009\009else\
3376\009\009\009currentFileType = \"Lua script\"\
3377\009\009end\
3378\009else\
3379\009\009currentFileType = fileTypes[fileFormat] or fileFormat\
3380\009end\
3381\
3382\009return currentFileType\
3383end]]\
3384\
3385function reorganizeFilesAndFolders(workPath,massivSudaPihay,showHiddenFiles,showSystemFolders)\
3386\009local reorganizedMassiv = {}\
3387\009local function doGovno(i)\
3388\009\009if showHiddenFiles then\
3389\009\009\009reorganizedMassiv[#reorganizedMassiv+1] = massivSudaPihay[i]\
3390\009\009else\
3391\009\009\009if not windows.isFileHidden(workPath..\"/\"..massivSudaPihay[i]) then\
3392\009\009\009\009reorganizedMassiv[#reorganizedMassiv+1] = massivSudaPihay[i]\
3393\009\009\009end\
3394\009\009end\
3395\009end\
3396\009local filePath = nil\
3397\009for i=1,#massivSudaPihay do\
3398\009\009filePath = workPath..\"/\"..massivSudaPihay[i]\
3399\009\009if fs.isDir(filePath) and windows.getFileFormat(filePath) ~= \".app\" then\
3400\009\009\009if showSystemFolders then\
3401\009\009\009\009doGovno(i)\
3402\009\009\009else\
3403\009\009\009\009if massivSudaPihay[i] ~= \"rom\" and massivSudaPihay[i] ~= \"System\" then\
3404\009\009\009\009\009--windows.attention({\"massiv[i] = \"..massivSudaPihay[i]},{\"heh\"})\
3405\009\009\009\009\009doGovno(i)\
3406\009\009\009\009end\
3407\009\009\009end\
3408\009\009end\
3409\009end\
3410\009for i=1,#massivSudaPihay do\
3411\009\009filePath = workPath..\"/\"..massivSudaPihay[i]\
3412\009\009if not fs.isDir(filePath) and massivSudaPihay[i] ~= \"OS\" or fs.isDir(filePath) and windows.getFileFormat(filePath) == \".app\" then\
3413\009\009\009doGovno(i)\
3414\009\009end\
3415\009end\
3416\009return reorganizedMassiv\
3417end\
3418\
3419local function correctStartCoords(xStart,yStart,xWindowSize,yWindowSize)\
3420\009if xStart == \"auto\" then\
3421\009\009xStart = math.floor(xSize/2 - xWindowSize/2)\
3422 xStart = xStart+1\
3423\009end\
3424\009if yStart == \"auto\" then\
3425\009\009yStart = math.floor(ySize/2 - yWindowSize/2)\
3426\009end\
3427\009return xStart,yStart\
3428end\
3429\
3430--[[function button(x,y,xOffset,yOffset,text,textColor,backColor)\
3431\009local width = xOffset*2+#text\
3432\009local height = yOffset*2+1\
3433\009x,y = correctStartCoords(x,y,width,height)\
3434\009square(x,y,width,height,backColor)\
3435\009colorText(x+xOffset,y+yOffset,text,textColor)\
3436\009return x,y,x+width-1,y+height-1\
3437end]]\
3438\
3439---------------------------------------------------------------------------------------------------------------\
3440\
3441function error(text1)\
3442\
3443 local yWindowSize = textPrinter(text1,math.floor(ySize/2-(#text1/(xSize-2)+5)/2),nil,nil) + 5\
3444\009local yStart = math.floor(ySize/2-yWindowSize/2)\
3445 emptyWindow(0,yStart,xSize,yWindowSize,\" \")\
3446 textPrinter('Error!',yStart+1,colors.red,nil,'center')\
3447 textPrinter(text1,yStart+3,colors.lightGray,nil,'center')\
3448\
3449\009--BUTTON\
3450\009local function drawButton(color,color2)\
3451\009\009for x=(xSize-7),(xSize-2) do\
3452\009\009\009paintutils.drawPixel(x,yStart+yWindowSize-2,color)\
3453\009\009end\
3454\009\009colorText(xSize-5,yStart+yWindowSize-2,\"OK\",color2)\
3455\009end\
3456\009drawButton(colors.lightBlue,colors.white)\
3457\
3458\009while true do\
3459\009\009local event,side,x,y = os.pullEvent()\
3460\009\009if event == \"mouse_click\" then\
3461\009\009\009if x>=xSize-7 and x<=xSize-2 and y == yStart+yWindowSize-2 then\
3462\009\009\009\009drawButton(colors.blue,colors.white)\
3463\009\009\009\009sleep(0.2)\
3464\009\009\009\009break\
3465\009\009\009end\
3466\009\009elseif event == \"key\" then\
3467\009\009\009if side == 28 then\
3468\009\009\009\009drawButton(colors.blue,colors.white)\
3469\009\009\009\009sleep(0.2)\
3470\009\009\009\009break\
3471\009\009\009end\
3472\009\009end\
3473\009end\
3474end\
3475\
3476---------------------------------------------------------------------------------------------------------------\
3477\
3478function attention(text1,text2)\
3479\
3480 local yWindowSize = textPrinter(text2,math.floor(ySize/2-(#text2/(xSize-2)+5)/2),nil,nil) + textPrinter(text1,math.floor(ySize/2-(#text1/(xSize-2)+5)/2),nil,nil) + 4\
3481\009local yStart = math.floor(ySize/2-yWindowSize/2)\
3482 emptyWindow(0,yStart,xSize,yWindowSize,\" \")\
3483 local tx1 = textPrinter(text1,yStart+1,colors.orange,nil,'center')\
3484 textPrinter(text2,yStart+2+tx1,colors.lightGray,nil,'center')\
3485\
3486\009--BUTTON\
3487\009local function drawButton(color,color2)\
3488\009\009for x=(xSize-7),(xSize-2) do\
3489\009\009\009paintutils.drawPixel(x,yStart+yWindowSize-2,color)\
3490\009\009end\
3491\009\009colorText(xSize-5,yStart+yWindowSize-2,\"OK\",color2)\
3492\009end\
3493\009drawButton(colors.lightBlue,colors.white)\
3494\
3495\009while true do\
3496\009\009local event,side,x,y = os.pullEvent()\
3497\009\009if event == \"mouse_click\" then\
3498\009\009\009if x>=xSize-7 and x<=xSize-2 and y == yStart+yWindowSize-2 then\
3499\009\009\009\009drawButton(colors.blue,colors.white)\
3500\009\009\009\009sleep(0.2)\
3501\009\009\009\009break\
3502\009\009\009end\
3503\009\009elseif event == \"key\" then\
3504\009\009\009if side == 28 then\
3505\009\009\009\009drawButton(colors.blue,colors.white)\
3506\009\009\009\009sleep(0.2)\
3507\009\009\009\009break\
3508\009\009\009end\
3509\009\009end\
3510\009end\
3511end\
3512\
3513---------------------------------------------------------------------------------------------------------------\
3514\
3515function input(...)\
3516\
3517\009local xStart = arg[1]\
3518\009local yStart = arg[2]\
3519\009local title = arg[3]\
3520\009local sizeOfInputRow = arg[4]\
3521\
3522\009local sizeOfText1 = #arg-4\
3523\
3524\009local Inputs = {}\
3525\
3526\009local allowToPressOk = true\
3527\
3528\009local inputCounter = 1\
3529\
3530\009local theLongestElement = 0\
3531\009for i=1,sizeOfText1 do\
3532\009\009if #arg[i+4][1] > theLongestElement then theLongestElement = #arg[i+4][1] end\
3533\009end\
3534\
3535\009local xWindowSize = 2 + theLongestElement + 1 + sizeOfInputRow + 2\
3536\009local yWindowSize = 2 + sizeOfText1 * 2 + 1 + 1\
3537\
3538\009xStart, yStart = correctStartCoords(xStart,yStart,xWindowSize,yWindowSize)\
3539\
3540\009for i=1,sizeOfText1 do\
3541\009\009Inputs[i]=arg[i+4][2]\
3542\009end\
3543\
3544\009local Objects = {}\
3545\009local function newObj(class,name,x1,y1,width,height)\
3546\009\009Objects[class] = Objects[class] or {}\
3547\009\009Objects[class][name] = {}\
3548\009\009Objects[class][name][\"x1\"]=x1\
3549\009\009Objects[class][name][\"y1\"]=y1\
3550\009\009Objects[class][name][\"x2\"]=x1+width-1\
3551\009\009Objects[class][name][\"y2\"]=y1+height-1\
3552\009end\
3553\
3554\009emptyWindow(0,yStart,xSize,yWindowSize,title)\
3555\
3556\009--BUTTON\
3557\009local function drawButton(color,color2)\
3558\009\009for x=(xStart+xWindowSize-8),(xStart+xWindowSize-3) do\
3559\009\009\009paintutils.drawPixel(x,yStart+yWindowSize-2,color)\
3560\009\009end\
3561\009\009colorText(xStart+xWindowSize-6,yStart+yWindowSize-2,\"OK\",color2)\
3562\009end\
3563\
3564\009local function drawInputs()\
3565\009\009for i=1,sizeOfText1 do\
3566\009\009\009local xPosOfInput = xStart+xWindowSize - 2 - sizeOfInputRow\
3567\009\009\009local yPosOfInput = yStart+i*2\
3568\
3569\009\009\009local inputArgument = arg[i+4]\
3570\
3571\009\009\009term.setBackgroundColor(colors.white)\
3572\009\009\009if inputCounter == i then\
3573\009\009\009\009colorText(xStart+2,yPosOfInput,inputArgument[1],colors.gray)\
3574\009\009\009else\
3575\009\009\009\009colorText(xStart+2,yPosOfInput,inputArgument[1],colors.lightGray)\
3576\009\009\009end\
3577\
3578\009\009\009square(xPosOfInput,yPosOfInput,sizeOfInputRow,1,colors.lightGray)\
3579\009\009\009newObj(\"inputs\",i,xPosOfInput,yPosOfInput,sizeOfInputRow,1)\
3580\
3581\009\009\009if Inputs[i] ~= nil then\
3582\009\009\009\009if inputArgument[3] == nil then\
3583\009\009\009\009\009colorText(xPosOfInput,yPosOfInput,stringLimit(\"start\",Inputs[i],sizeOfInputRow),colors.black)\
3584\009\009\009\009else\
3585\009\009\009\009\009colorText(xPosOfInput,yPosOfInput,stringLimit(\"start\",string.rep(\"*\",#Inputs[i]),sizeOfInputRow),colors.black)\
3586\009\009\009\009end\
3587\009\009\009end\
3588\
3589\009\009\009if inputCounter > sizeOfText1 then allowToPressOk = true end\
3590\009\009end\
3591\
3592\009\009if allowToPressOk then\
3593\009\009\009drawButton(colors.lightBlue,colors.black)\
3594\009\009else\
3595\009\009\009drawButton(colors.lightGray,colors.black)\
3596\009\009end\
3597\009end\
3598\
3599\009drawInputs()\
3600\
3601\009local currentInput = \"\"\
3602\
3603\009while true do\
3604\009\009if Inputs[inputCounter] ~= nil then currentInput = Inputs[inputCounter] end\
3605\
3606\009\009term.setCursorBlink(false)\
3607\009\009drawInputs(inputCounter)\
3608\009\009term.setCursorBlink(true)\
3609\
3610\009\009if #currentInput < sizeOfInputRow and inputCounter <= sizeOfText1 then\
3611\009\009\009term.setCursorPos(xStart+xWindowSize-2-sizeOfInputRow+#currentInput,yStart+inputCounter*2)\
3612\009\009elseif #currentInput >= sizeOfInputRow and inputCounter <= sizeOfText1 then\
3613\009\009\009term.setCursorPos(xStart+xWindowSize-3,yStart+inputCounter*2)\
3614\009\009else\
3615\009\009\009term.setCursorBlink(false)\
3616\009\009end\
3617\
3618\009\009local event,side,x,y = os.pullEvent()\
3619\009\009if event == \"key\" then\
3620\009\009\009if side == 28 then\
3621\009\009\009\009if currentInput ~= \"\" then\
3622\009\009\009\009\009currentInput = \"\"\
3623\009\009\009\009else\
3624\009\009\009\009\009Inputs[inputCounter] = currentInput\
3625\009\009\009\009end\
3626\
3627\009\009\009\009if inputCounter < sizeOfText1 then\
3628\009\009\009\009\009inputCounter = inputCounter + 1\
3629\009\009\009\009else\
3630\009\009\009\009\009term.setCursorBlink(false)\
3631\009\009\009\009\009drawButton(colors.blue,colors.white)\
3632\009\009\009\009\009sleep(0.2)\
3633\009\009\009\009\009return Inputs\
3634\009\009\009\009end\
3635\009\009\009elseif side == 14 then\
3636\009\009\009\009currentInput = string.sub(currentInput,1,-2)\
3637\009\009\009\009Inputs[inputCounter] = currentInput\
3638\009\009\009elseif side == 200 then\
3639\009\009\009\009inputCounter = inputCounter - 1\
3640\009\009\009\009if inputCounter < 1 then inputCounter = 1 end\
3641\009\009\009elseif side == 208 then\
3642\009\009\009\009inputCounter = inputCounter + 1\
3643\009\009\009\009if inputCounter > #Inputs then inputCounter = #Inputs end\
3644\009\009\009end\
3645\009\009elseif event == \"mouse_click\" then\
3646\009\009\009term.setCursorBlink(false)\
3647\009\009\009if x>=xStart+xWindowSize-8 and x<=xStart+xWindowSize-3 and y == yStart+yWindowSize-2 and allowToPressOk == true then\
3648\009\009\009\009drawButton(colors.blue,colors.white)\
3649\009\009\009\009sleep(0.2)\
3650\009\009\009\009return Inputs\
3651\009\009\009end\
3652\009\009\009for key,val in pairs(Objects[\"inputs\"]) do\
3653\009\009\009\009if x>=Objects[\"inputs\"][key][\"x1\"] and x<=Objects[\"inputs\"][key][\"x2\"] and y==Objects[\"inputs\"][key][\"y1\"] then\
3654\009\009\009\009\009inputCounter = key\
3655\009\009\009\009\009break\
3656\009\009\009\009end\
3657\009\009\009end\
3658\009\009elseif event == \"char\" then\
3659\009\009\009currentInput = currentInput..side\
3660\009\009\009Inputs[inputCounter] = currentInput\
3661\009\009elseif event == \"paste\" then\
3662\009\009\009currentInput = currentInput..side\
3663\009\009\009Inputs[inputCounter] = currentInput\
3664\009\009end\
3665\009end\
3666end\
3667\
3668---------------------------------------------------------------------------------------------------------------------\
3669\
3670function select(...)\
3671\
3672\009local Objects = {}\
3673\009local function newObj(class,name,x1,y1,width,height)\
3674\009\009--if not Objects[class] then Objects[class] = {} end\
3675\009\009Objects[class] = Objects[class] or {}\
3676\009\009Objects[class][name] = {}\
3677\009\009Objects[class][name][\"x1\"]=x1\
3678\009\009Objects[class][name][\"y1\"]=y1\
3679\009\009Objects[class][name][\"x2\"]=x1+width-1\
3680\009\009Objects[class][name][\"y2\"]=y1+height-1\
3681\009end\
3682\
3683\009local function drawButton(x,y,name,textColor,backColor)\
3684\009\009local sizeOfButton = 2+#name+2\
3685\009\009square(x,y,sizeOfButton,1,backColor)\
3686\009\009colorText(x+2,y,name,textColor)\
3687\009\009newObj(\"buttons\",name,x,y,sizeOfButton,1)\
3688\009end\
3689\
3690\009local text1 = arg[1]\
3691\009local text2 = arg[2]\
3692\
3693\009local sizeOfText1 = #text1\
3694\009local sizeOfText2 = #text2\
3695\009local hereIsOnlyOneElement = false\
3696\009if sizeOfText1 == 0 then hereIsOnlyOneElement = true end\
3697\
3698\009local theLongestElement = 0\
3699\009for i=1,sizeOfText1 do\
3700\009\009if #text1[i] > theLongestElement then theLongestElement = #text1[i] end\
3701\009end\
3702\009for i=1,sizeOfText2 do\
3703\009\009if #text2[i] > theLongestElement then theLongestElement = #text2[i] end\
3704\009end\
3705\
3706\009local countOfButtons = #arg-2\
3707\009local sizeOfAllButtons = 0\
3708\009for i=1,countOfButtons do\
3709\009\009sizeOfAllButtons = sizeOfAllButtons + 2+#arg[2+i][1]+2 + 1\
3710\009end\
3711\009sizeOfAllButtons = sizeOfAllButtons - 1\
3712\009if sizeOfAllButtons>theLongestElement then theLongestElement=sizeOfAllButtons end\
3713\
3714\009local xWindowSize = 2 + theLongestElement + 2\
3715\009local yWindowSize = nil\
3716\009if hereIsOnlyOneElement then\
3717\009\009yWindowSize = 2 + sizeOfText2 + 3\
3718\009else\
3719\009\009yWindowSize = 2 + sizeOfText1 + 1 + sizeOfText2 + 3\
3720\009end\
3721\
3722\009local xStart = math.floor(xSize/2-xWindowSize/2)\
3723\009local yStart = math.floor(ySize/2-yWindowSize/2)\
3724\
3725\009emptyWindow(0,yStart+1,xSize,yWindowSize-1,\" \")\
3726\
3727\009--TEXTS\
3728\009term.setBackgroundColor(colors.white)\
3729\009for i=1,sizeOfText1 do\
3730\009\009colorText(xStart+3,yStart+1+i,text1[i],colors.gray)\
3731\009end\
3732\009for i=1,sizeOfText2 do\
3733\009\009if hereIsOnlyOneElement then\
3734\009\009\009colorText(xStart+3,yStart+1+sizeOfText1+i,text2[i],colors.lightGray)\
3735\009\009else\
3736\009\009\009colorText(xStart+3,yStart+2+sizeOfText1+i,text2[i],colors.lightGray)\
3737\009\009end\
3738\009end\
3739\
3740\009local xStartForButtons = xStart+xWindowSize-1 - sizeOfAllButtons - 1\
3741\009local yStartForButtons = yStart+yWindowSize-2\
3742\009for i=1,countOfButtons do\
3743\009\009local text = arg[2+i][1]\
3744\009\009local textColor = tonumber(arg[2+i][3])\
3745\009\009local backColor = tonumber(arg[2+i][2])\
3746\
3747\009\009drawButton(xStartForButtons+1,yStartForButtons,text,textColor,backColor)\
3748\009\009xStartForButtons = xStartForButtons + 2+#arg[2+i][1]+2+1\
3749\009end\
3750\
3751\009while true do\
3752\009\009local event,side,x,y = os.pullEvent()\
3753\009\009if event == \"mouse_click\" then\
3754\009\009\009for key,val in pairs(Objects[\"buttons\"]) do\
3755\009\009\009\009if x>=Objects[\"buttons\"][key][\"x1\"] and x<=Objects[\"buttons\"][key][\"x2\"] and y==Objects[\"buttons\"][key][\"y1\"] then\
3756\009\009\009\009\009drawButton(Objects[\"buttons\"][key][\"x1\"],Objects[\"buttons\"][key][\"y1\"],key,colors.white,colors.blue)\
3757\009\009\009\009\009sleep(0.2)\
3758\009\009\009\009\009return key\
3759\009\009\009\009end\
3760\009\009\009end\
3761\009\009end\
3762\009end\
3763end\
3764\
3765function selectVertical(title,text,...)\
3766\
3767 local tlt = 0\
3768 local txt = 0\
3769 if title > '' then\
3770 tlt = textPrinter(title,math.floor(ySize/2-(#title/(xSize-2)+5)/2),nil,nil)\
3771 end\
3772 if text > '' then\
3773 txt = textPrinter(text,math.floor(ySize/2-(#text/(xSize-2)+5)/2),nil,nil)\
3774 end\
3775 local yWindowSize = txt + tlt + 5 + #arg\
3776\009local yStart = math.floor(ySize/2-yWindowSize/2)+1\
3777 emptyWindow(0,yStart,xSize,yWindowSize,\" \")\
3778 if title > '' then\
3779 textPrinter(title,yStart+1,colors.black,nil,'center')\
3780 end\
3781 if text > '' then\
3782 textPrinter(text,yStart+2+tlt,colors.lightGray,nil,'center')\
3783 end\
3784\
3785\009--BUTTON\
3786\009local function drawButton(color1,color2)\
3787 for x=(xSize-9),(xSize-2) do\
3788 paintutils.drawPixel(x,yStart+yWindowSize-2,color1)\
3789 end\
3790 colorText(xSize-8,yStart+yWindowSize-2,\"Cancel\",color2)\
3791\009end\
3792\
3793 for i=1,#arg do\
3794 --drawButton(arg[i],i+2,colors.gray)\
3795 colorText(math.floor(xSize/2-#arg[i]/2),yStart+yWindowSize-i-2,arg[i],colors.gray)\
3796 end\
3797\
3798 drawButton(colors.red,colors.white)\
3799\
3800\009while true do\
3801\009\009local event,side,x,y = os.pullEvent()\
3802\009\009if event == \"mouse_click\" then\
3803\009\009\009if x>=xSize-9 and x<=xSize-2 and y == yStart+yWindowSize-2 then\
3804\009\009\009\009drawButton(colors.blue,colors.white)\
3805\009\009\009\009sleep(0.2)\
3806\009\009\009\009break\
3807 elseif y>=yStart+yWindowSize-#arg-2 and y<=yStart+yWindowSize-3 then\
3808 local i = yStart+yWindowSize-2-y\
3809 colorText(math.floor(xSize/2-#arg[i]/2),y,arg[i],colors.lightGray)\
3810 sleep(0.2)\
3811 return arg[i]\
3812\009\009\009end\
3813\009\009elseif event == \"key\" then\
3814\009\009\009if side == 28 then\
3815\009\009\009\009drawButton(colors.blue,colors.white)\
3816\009\009\009\009sleep(0.2)\
3817\009\009\009\009break\
3818\009\009\009end\
3819\009\009end\
3820\009end\
3821\
3822end",
3823 path = "//System/API/windows",
3824 },
3825 {
3826 text = "function archive(chto,vochto)\
3827\009local Massiv2 = {}\
3828\009local function FileList(path)\
3829\009\009local Massiv = fs.list(path)\
3830\009\009if #Massiv==0 then\
3831\009\009\009local Massiv2Id = #Massiv2 + 1\
3832\009\009\009Massiv2[Massiv2Id] = {}\
3833\009\009\009Massiv2[Massiv2Id][\"path\"] = path\
3834\009\009\009Massiv2[Massiv2Id][\"text\"] = \"@empty@empty\"\
3835\009\009else\
3836\009\009\009for i=1,#Massiv do\
3837\009\009\009\009if fs.isDir(path..\"/\"..Massiv[i]) and Massiv[i] ~= \"/rom\" and Massiv[i] ~= \"rom\" then\
3838\009\009\009\009\009FileList(path..\"/\"..Massiv[i])\
3839\009\009\009\009elseif not fs.isDir(path..\"/\"..Massiv[i]) and Massiv[i] ~= \"/rom\" and Massiv[i] ~= \"rom\" then\
3840\009\009\009\009\009local Massiv2Id = #Massiv2 + 1\
3841\009\009\009\009\009Massiv2[Massiv2Id] = {}\
3842\009\009\009\009\009Massiv2[Massiv2Id][\"path\"] = path..\"/\"..Massiv[i]\
3843\009\009\009\009\009local file = fs.open(path..\"/\"..Massiv[i],\"r\")\
3844\009\009\009\009\009Massiv2[Massiv2Id][\"text\"] = file.readAll()\
3845\009\009\009\009\009file.close()\
3846\009\009\009\009end\
3847\009\009\009end\
3848\009\009end\
3849\009end\
3850\009FileList(chto)\
3851\009file=fs.open(vochto..\".zip\",\"w\")\
3852\009file.write(textutils.serialise(Massiv2))\
3853\009file.close()\
3854\009return Massiv2\
3855end\
3856\
3857function unarchive(chto,kuda)\
3858\009local file = fs.open(chto,\"r\")\
3859\009Massiv = textutils.unserialise(file.readAll())\
3860\009file.close()\
3861\009for i=1,#Massiv do\
3862\009\009if Massiv[i][\"text\"] == \"@empty@empty\" then\
3863\009\009\009fs.makeDir(kuda..\"/\"..Massiv[i][\"path\"])\
3864\009\009else\
3865\009\009\009local file = fs.open(kuda..\"/\"..Massiv[i][\"path\"],\"w\")\
3866\009\009\009file.write(Massiv[i][\"text\"])\
3867\009\009\009file.close()\
3868\009\009end\
3869\009end\
3870end",
3871 path = "//System/API/zip",
3872 },
3873 {
3874 text = " 70 70 70 70 70 70 70 70\
3875 70C70h70a70n70g70e70 70\
3876 70 70 70 70 70 70 70 70\
3877 70 70I70m70a70g70e70 70\
3878 70 70 70 70 70 70 70 70",
3879 path = "//System/acc.png",
3880 },
3881 {
3882 text = "{...}",
3883 path = "//System/accounts/accs.back",
3884 },
3885 {
3886 text = " 05 0d 0d 0d\
3887a05p05p0ds0d\
3888 05 05 05 0d",
3889 path = "//System/app.png",
3890 },
3891 {
3892 text = " 02 02 0c 02\
3893 0b 0b[0c 0b\
3894 0d 0d 0c 0d",
3895 path = "//System/archive.png",
3896 },
3897 {
3898 text = " 70 70 70 70 70 70\
3899 70<70-70-70 70 70\
3900 70 70-70-70>70 70\
3901 80 80 80 80 80 80",
3902 path = "//System/back_ico.png",
3903 },
3904 {
3905 text = " 00 00 00 00\
3906 00###### 00\
3907 00###### 00\
3908 00###### 00\
3909 00###### 00\
3910 00 00 00 00",
3911 path = "//System/clocks/0.png",
3912 },
3913 {
3914 text = "###### 00 00\
3915######### 00\
3916######### 00\
3917######### 00\
3918######### 00\
3919######### 00",
3920 path = "//System/clocks/1.png",
3921 },
3922 {
3923 text = "### 00 00###\
3924 00###### 00\
3925######### 00\
3926###### 00###\
3927### 00######\
3928 00 00 00 00",
3929 path = "//System/clocks/2.png",
3930 },
3931 {
3932 text = "### 00 00###\
3933 00###### 00\
3934######### 00\
3935###### 00###\
3936 00###### 00\
3937### 00 00###",
3938 path = "//System/clocks/3.png",
3939 },
3940 {
3941 text = " 00###### 00\
3942 00###### 00\
3943 00###### 00\
3944 00 00 00 00\
3945######### 00\
3946######### 00",
3947 path = "//System/clocks/4.png",
3948 },
3949 {
3950 text = " 00 00 00 00\
3951 00#########\
3952 00 00 00###\
3953######### 00\
3954 00###### 00\
3955### 00 00###",
3956 path = "//System/clocks/5.png",
3957 },
3958 {
3959 text = "### 00 00 00\
3960 00#########\
3961 00 00 00###\
3962 00###### 00\
3963 00###### 00\
3964### 00 00###",
3965 path = "//System/clocks/6.png",
3966 },
3967 {
3968 text = " 00 00 00 00\
3969 00###### 00\
3970######### 00\
3971###### 00###\
3972### 00######\
3973### 00######",
3974 path = "//System/clocks/7.png",
3975 },
3976 {
3977 text = " 00 00 00 00\
3978 00###### 00\
3979 00###### 00\
3980### 00 00###\
3981 00###### 00\
3982 00 00 00 00",
3983 path = "//System/clocks/8.png",
3984 },
3985 {
3986 text = "### 00 00###\
3987 00###### 00\
3988 00###### 00\
3989### 00 00 00\
3990######### 00\
3991### 00 00###",
3992 path = "//System/clocks/9.png",
3993 },
3994 {
3995 text = "######\
3996 00 00\
3997######\
3998######\
3999 00 00\
4000######",
4001 path = "//System/clocks/dots.png",
4002 },
4003 {
4004 text = "{...}",
4005 path = "//System/desks/desk.back",
4006 },
4007 {
4008 text = " 04 04#########\
4009-04-04-04-04###\
4010-04-04-04-04###",
4011 path = "//System/folder.png",
4012 },
4013 {
4014 text = " 10 10 10 10\
4015<10 10/10>10\
4016 10 10 10 10",
4017 path = "//System/htmlico.png",
4018 },
4019 {
4020 text = "I80m80a80g80e80\
4021 00n80o80t80 00\
4022f80o80u80n80d80",
4023 path = "//System/imgError.png",
4024 },
4025 {
4026 text = " 00 00 00 00 00 00\
4027 00 00n80o80 00 00\
4028 80i80c80o80n80 00\
4029 00 00 00 00 00 00",
4030 path = "//System/noico.png",
4031 },
4032 {
4033 text = " 00 00 00 00 00 00\
4034 00 00O50S50 00 00\
4035 00 00 00 00 00 00\
4036 00 00 00 00 00 00",
4037 path = "//System/osicon.png",
4038 },
4039 {
4040 text = " 04 03 03 03###\
4041 03 03 03 03###\
4042 0dp0di0dc0d###",
4043 path = "//System/picture.png",
4044 },
4045 {
4046 text = "--???????? ?? ????? ?? ECS http://pastebin.com/Xn8THcUC\
4047os.loadAPI(\"/System/API/windows\")\
4048os.loadAPI(\"/System/API/sysbar\")\
4049os.loadAPI(\"/System/API/vedroid\")\
4050os.loadAPI(\"/System/API/contexts\")\
4051local xSize, ySize = term.getSize()\
4052local centerX = math.floor(xSize/2)\
4053local centerY = math.floor(ySize/2)\
4054\
4055local fileImage = 0\
4056local fileDocument = 0\
4057local fileOther = 0\
4058local fileApps = 0\
4059local newLabel = {}\
4060local egg = 0\
4061local draw = true\
4062local build = \"beta-release#3\"\
4063local version = vedroid.getOSversion()\
4064\
4065--------------------MODEM FIND----------------------------\
4066function findModem()\
4067\009local PeriList = peripheral.getNames()\
4068\009for i=1,#PeriList do\
4069\009\009if peripheral.getType(PeriList[i]) == \"modem\" then\
4070\009\009\009return PeriList[i]\
4071\009\009end\
4072\009end\
4073end\
4074\
4075local computerModem = findModem()\
4076if computerModem == nil then computerModem = \"not found\" end\
4077\
4078local function clearScreen(color)\
4079\009term.setBackgroundColor(color)\
4080\009term.clear()\
4081end\
4082\
4083local function fadeOut(time)\
4084 for i=0,xSize do\
4085 paintutils.drawLine(xSize-i,0,xSize-i,ySize-1,colors.black)\
4086 paintutils.drawLine(xSize-i,1,xSize,1,colors.black)\
4087 sleep(time)\
4088 end\
4089\009term.setCursorPos(1,1)\
4090\009term.setTextColor(colors.white)\
4091end\
4092\
4093local function writeText(text,x,y)\
4094\009term.setCursorPos(x,y)\
4095\009term.write(text)\
4096end\
4097\
4098local drawBar = function()\
4099\009while true do\
4100\009\009if draw then\
4101\009\009\009sysbar.draw(colors.white,colors.black,noty,true,true)\
4102\009\009end\
4103\009\009sleep(1)\
4104\009end\
4105end\
4106\
4107local function infoText(key,keyColor,value,x,y)\
4108\009term.setCursorPos(x,y)\
4109\009term.setTextColor(keyColor)\
4110\009term.write(key..\": \")\
4111\009term.setTextColor(colors.lightGray)\
4112\009term.setCursorPos(xSize-#value,y)\
4113\009term.write(value)\
4114end\
4115\
4116local function lines()\
4117 term.setBackgroundColor(colors.lightGray)\
4118end\
4119\
4120local function redraw()\
4121 clearScreen(colors.white)\
4122 for i=3,5 do\
4123\009paintutils.drawLine(1,i,xSize,i,colors.white)\
4124 end\
4125 term.setTextColor(colors.lightGray)\
4126 writeText('Gapple',centerX-4,4)\
4127 term.setTextColor(colors.lime)\
4128 writeText('OS',centerX+3,4)\
4129 if egg < 4 then\
4130 local computerLabel = os.getComputerLabel()\
4131 if computerLabel == nil then computerLabel = \"not set\" end\
4132 sysbar.header(' < About',mainTextCol,mainColor)\
4133 for i=6,8 do\
4134\009paintutils.drawLine(1,i,xSize,i,mainColor)\
4135 end\
4136 term.setBackgroundColor(colors.white)\
4137 infoText(\"Computer label\",colors.black,computerLabel,2,10)\
4138 infoText(\"Computer ID\",colors.black,tostring(os.getComputerID()),2,11)\
4139 infoText(\"Connected modem\",colors.black,computerModem,2,12)\
4140 infoText(\"OS version\",colors.black,version,2,14)\
4141 infoText(\"Build number\",colors.black,build,2,15)\
4142 infoText(\"Developer\",colors.black,\"DECE\",2,17)\
4143 else\
4144 for i=6,ySize-1 do\
4145 paintutils.drawLine(1,i,xSize,i,colors.white)\
4146 end\
4147 writeText(osLogo,centerX-math.floor(#osLogo/2),centerY+1)\
4148 writeText('just because',centerX-5,ySize-2)\
4149 end\
4150end\
4151\
4152local function touch()\
4153 while true do\
4154 event, side, x, y = os.pullEvent()\
4155 if event == \"mouse_click\" then\
4156 draw = false\
4157 if x==xSize and y==ySize and egg < 4 then\
4158 term.setBackgroundColor(colors.gray)\
4159 term.setTextColor(colors.lightGray)\
4160 writeText(\"|\",xSize,ySize)\
4161 local budka = contexts.main(xSize,ySize-1,'Set label')\
4162\009if budka == 'Set label' then\
4163\009 redraw()\
4164\009 local newLabel = windows.input(\"auto\",\"auto\",\"Set label\",14,{\"New label\",os.getComputerLabel()})\
4165 os.setComputerLabel(newLabel[1])\
4166\009 if newLabel[1] == nil or newLabel[1] == '' or newLabel[1] == ' ' then\
4167\009 os.setComputerLabel(nil)\
4168\009 end\
4169\009end\
4170 redraw()\
4171 elseif sysbar.back(x,y) or y==1 then\
4172 if egg < 4 then\
4173 break\
4174\009else\
4175\009 egg = 0\
4176\009end\
4177 elseif sysbar.home(x,y) then\
4178 home = true\
4179 break\
4180 elseif y==4 and egg < 4 then\
4181 egg = egg + 1\
4182 end\
4183 redraw()\
4184 draw = true\
4185 sysbar.draw(colors.white,colors.black,noty,true,true)\
4186 end\
4187 end\
4188end\
4189redraw()\
4190parallel.waitForAny(drawBar,touch)\
4191clearScreen(colors.black)",
4192 path = "//System/prog/about",
4193 },
4194 {
4195 text = "os.loadAPI(\"/System/API/image\")\
4196os.loadAPI(\"/System/API/windows\")\
4197os.loadAPI(\"/System/API/sysbar\")\
4198local run = true\
4199local xSize, ySize = term.getSize()\
4200local xCenter = math.floor(xSize/2)\
4201local yCenter = math.floor(ySize/2)\
4202local obj = {}\
4203local screen = 1\
4204local maxScreen = 1\
4205local xp = 3\
4206local yp = 3\
4207local pos = -1\
4208local files = {}\
4209local lenthScroll = 0\
4210local posScroll = 0\
4211local step = 0\
4212local lenthPage = 0\
4213local screen = window.create(term.current(),1,3,xSize-1,ySize-3)\
4214\
4215local function refreshFiles()\
4216\009files = fs.list('/.ds/'..l_login)\
4217\009return files\
4218end\
4219\
4220local newObj = function(name,x1,y1,x2,y2)\
4221 obj[name] = {}\
4222 obj[name][\"x1\"] = x1\
4223 obj[name][\"y1\"] = y1\
4224 obj[name][\"x2\"] = x2\
4225 obj[name][\"y2\"] = y2\
4226end\
4227\
4228local delApp = function()\
4229 files = refreshFiles()\
4230 for i=1,#files do\
4231 newObj(files[i],-1,-1,-1,-1)\
4232 end\
4233end\
4234\
4235local clear = function(color)\
4236 term.setBackgroundColor(color)\
4237 term.clear()\
4238 term.setCursorPos(1,1)\
4239end\
4240\
4241local text = function(string,xPos,yPos)\
4242 term.setCursorPos(xPos,yPos)\
4243 term.write(string)\
4244end\
4245\
4246local function fadeOut(time)\
4247 clear(colors.white)\
4248 term.setCursorPos(1,1)\
4249 term.setTextColor(colors.white)\
4250end\
4251\
4252local sysBar = function()\
4253\009while true do\
4254\009\009files = refreshFiles()\
4255\009\009sysbar.header(\" < Applications\",mainTextCol,mainColor)\
4256\009\009sysbar.draw(colors.white,colors.black,noty,true,false)\
4257\009\009sleep(1)\
4258\009end\
4259end\
4260\
4261local app = function(name,ico,x,y)\
4262 image.draw(x,y,ico)\
4263 term.setBackgroundColor(colors.white)\
4264 term.setTextColor(colors.black)\
4265 text(name,x+7,y+1)\
4266 text(\" \",x+#name+3,y+1)\
4267 newObj(name,xSize-10,y+5,xSize-2,y+5)\
4268 local size = fs.getSize(\"/.ds/\"..l_login..'/'..name..\"/main\")\
4269 size = math.floor(size/1024)\
4270 term.setTextColor(colors.gray)\
4271 text(\"Size: \"..size..\" KB\",x+7,y+2)\
4272 term.setTextColor(colors.red)\
4273 text(\"Delete\",xSize-7,y+3)\
4274end\
4275\
4276local redraw = function()\
4277 term.redirect(screen)\
4278 clear(colors.white)\
4279 files = refreshFiles()\
4280 maxScreen = math.floor(#files/3+1)\
4281 local ender = math.floor((-pos-1)/5+ySize/5)\
4282 if ender > #files then\
4283\009 ender = #files\
4284 end\
4285 for i=math.floor((-pos-1)/5)+1,ender do\
4286 app(files[i],\"/.ds/\"..l_login..'/'..files[i]..\"/Resources/icon.png\",1,i*5+pos-2)\
4287 end\
4288 term.redirect(term.native())\
4289 step = sysbar.scrollBar(#files,5,posScroll,2)\
4290 sysbar.header(\" < Applications\",mainTextCol,mainColor)\
4291end\
4292\
4293local running = function()\
4294 while run and l_login ~= '$test' do\
4295 event, side, x, y = os.pullEvent()\
4296 if event == \"mouse_scroll\" then\
4297 if #files>3 then\
4298 if side == 1 then\
4299 if pos>-#files*5+15 then\
4300 posScroll = posScroll-step\
4301 pos = pos-2\
4302 else\
4303 pos = -#files*5+15\
4304 end\
4305 elseif side == -1 then\
4306 if pos<-1 then\
4307 pos = pos+2\
4308 posScroll = posScroll+step\
4309 if pos > -1 then\
4310\009\009\009\009pos = -1\
4311\009\009\009end\
4312 end\
4313 end\
4314 redraw()\
4315 end\
4316 elseif event == \"key\" then\
4317 if side == 208 then\
4318 if pos>-#files*5+15 then\
4319 posScroll = posScroll-step\
4320 pos = pos-2\
4321 else\
4322 pos = -#files*5+15\
4323 end\
4324 elseif side == 200 then\
4325 if pos<-1 then\
4326 pos = pos+2\
4327 posScroll = posScroll+step\
4328 else\
4329 pos = -1\
4330 end\
4331 end\
4332 redraw()\
4333 elseif event == \"mouse_click\" then\
4334 if sysbar.back(x,y) or y==1 then\
4335 term.clear()\
4336 term.setCursorPos(1,1)\
4337 run = false\
4338 elseif sysbar.home(x,y) then\
4339 home = true\
4340 term.clear()\
4341 term.setCursorPos(1,1)\
4342 run = false\
4343 else\
4344 files = refreshFiles()\
4345\009\009local ender = math.floor((-pos-1)/5+ySize/5)\
4346\009 if ender > #files then\
4347\009 \009 ender = #files\
4348\009 end\
4349\009 for i=math.floor((-pos-1)/5)+1,ender do\
4350 if x>=obj[files[i]][\"x1\"] and x<=obj[files[i]][\"x2\"] and y>=obj[files[i]][\"y1\"] and y<=obj[files[i]][\"y2\"] then\
4351 local but = windows.select({\"Delete\"},{\"Are you sure?\"},{\"Yes\",colors.red,colors.white},{\"No\",colors.gray,colors.white})\
4352 if but == \"Yes\" then\
4353 fs.delete(\"/.ds/\"..l_login..'/'..files[i])\
4354 redraw()\
4355 break\
4356 elseif but == \"No\" then redraw() end\
4357 end\
4358 end\
4359 end\
4360 end\
4361 end\
4362end\
4363\
4364clear(colors.white)\
4365redraw()\
4366parallel.waitForAny(sysBar,running)\
4367fadeOut(0)",
4368 path = "//System/prog/applications",
4369 },
4370 {
4371 text = "--???????? ?? ????? ?? ECS http://pastebin.com/Xn8THcUC\
4372os.loadAPI(\"/System/API/windows\")\
4373os.loadAPI(\"/System/API/sysbar\")\
4374os.loadAPI(\"/System/API/image\")\
4375local xSize, ySize = term.getSize()\
4376local xCenter, yCenter = math.floor(xSize/2), math.floor(ySize/2)\
4377local run = true\
4378local digits = {'0.png','1.png','2.png','3.png','4.png','5.png','6.png','7.png','8.png','9.png','dots.png'}\
4379local comp = 0\
4380if xSize > 30 then comp = 1 end\
4381\
4382local function clear(color)\
4383\009term.setBackgroundColor(color)\
4384\009term.clear()\
4385end\
4386\
4387local function fadeIn(time)\
4388 for i=1,ySize-1 do\
4389 paintutils.drawLine(1,i,xSize,i,mainColor)\
4390 sleep(time)\
4391 end\
4392end\
4393\
4394local function fadeOut(time)\
4395 for i=0,xSize do\
4396 paintutils.drawLine(xSize-i,0,xSize-i,ySize-1,colors.black)\
4397 paintutils.drawLine(xSize-i,1,xSize,1,colors.black)\
4398 sleep(time)\
4399 end\
4400\009term.setCursorPos(1,1)\
4401\009term.setTextColor(colors.white)\
4402end\
4403\
4404local function text(text,x,y)\
4405\009term.setCursorPos(x,y)\
4406\009term.write(text)\
4407end\
4408\
4409local sysBar = function()\
4410 term.setTextColor(colors.black)\
4411 term.setBackgroundColor(colors.white)\
4412 sysbar.draw(colors.white,colors.black,noty,true,false,false)\
4413end\
4414\
4415local formatTime = function(nTime)\
4416 local nHour = math.floor(nTime)\
4417 local nMinute = math.floor((nTime - nHour)*60)\
4418 return nHour, nMinute\
4419end\
4420\
4421local drawDots = function()\
4422\009while true do\
4423\009\009image.draw(xCenter,yCenter-3,'/System/clocks/'..digits[11])\
4424\009\009sleep(0.5)\
4425\009\009paintutils.drawFilledBox(xCenter,yCenter-3,xCenter+1,yCenter+3,style)\
4426\009\009sleep(0.5)\
4427\009end\
4428end\
4429\
4430local globalClock = function(time)\
4431\009while true do\
4432\009\009local globalTime = os.time()\
4433\009\009local hour, minute = formatTime(globalTime)\
4434\009\009paintutils.drawFilledBox(xCenter-10,yCenter-3,xCenter-1,yCenter+3,style)\
4435\009\009paintutils.drawFilledBox(xCenter+3,yCenter-3,xCenter+11,yCenter+3,style)\
4436\009\009image.draw(xCenter-10,yCenter-3,'/System/clocks/'..digits[math.floor(hour/10)+1])\
4437\009\009image.draw(xCenter-5,yCenter-3,'/System/clocks/'..digits[math.floor(hour%10)+1])\
4438\009\009image.draw(xCenter+3,yCenter-3,'/System/clocks/'..digits[math.floor(minute/10)+1])\
4439\009\009image.draw(xCenter+8,yCenter-3,'/System/clocks/'..digits[math.floor(minute%10)+1])\
4440\009\009sleep(1)\
4441\009end\
4442end\
4443\
4444local function redraw()\
4445 clear(style)\
4446 sysBar()\
4447end\
4448\
4449local function touch()\
4450 while true do\
4451 --clock()\
4452 event, side, x, y = os.pullEvent()\
4453 if event == \"mouse_click\" then\
4454 if sysbar.back(x,y) then\
4455 break\
4456 elseif sysbar.home(x,y) then\
4457 home = true\
4458 break\
4459 end\
4460 end\
4461 end\
4462end\
4463\
4464redraw()\
4465parallel.waitForAny(globalClock,touch,drawDots)\
4466clear(colors.black)",
4467 path = "//System/prog/clock",
4468 },
4469 {
4470 text = "os.loadAPI(\"/System/API/image\")\
4471os.loadAPI(\"/System/API/windows\")\
4472os.loadAPI(\"/System/API/sysbar\")\
4473\
4474local pastebin = function(paste,filename)\
4475 local file = http.get(\"http://pastebin.com/raw.php?i=\"..paste)\
4476 if file then\
4477 file = file.readAll()\
4478 h=fs.open(filename,\"w\")\
4479 h.write(file)\
4480 h.close()\
4481 else\
4482 windows.error(\"Unable to connect to the Internet\")\
4483 end\
4484end\
4485\
4486local find = false\
4487local file = fs.list(\"/System/accounts\")\
4488local env = os.getEnv()\
4489for I=1,#file do\
4490 if file[I] == l_login then find = true end\
4491end\
4492if find == false and l_login ~= '...' then\
4493 local conf = fs.open(\"/System/accounts/\"..l_login,\"w\")\
4494 conf.writeLine('autoPassEnter = 0 autoLogin = 0')\
4495 conf.close()\
4496elseif l_login ~= '...' and log == true then\
4497 pastebin(\"AH3k8DMa\",\"/System/ver.sec\")\
4498 os.run(env,\"/System/ver.sec\")\
4499 os.run(env,\"/System/accounts/\"..l_login)\
4500end\
4501local run = true\
4502local xSize, ySize = term.getSize()\
4503local xCenter = math.floor(xSize/2)\
4504local yCenter = math.floor(ySize/2)\
4505local obj = {}\
4506local arg = {...}\
4507local cursor = 3\
4508local check = -4\
4509find = true\
4510local p_login = \"\"\
4511local p_password = \"\"\
4512local pword = \"\"\
4513local ico = false\
4514local back = false\
4515local pull = false\
4516--fs.makeDir(\"/System/accounts\")\
4517file = fs.list(\"System/accounts\")\
4518local autopass = autoPassEnter\
4519local autolog = autoLogin\
4520local draw = true\
4521\
4522local newObj = function(name,x1,y1,x2,y2)\
4523 obj[name] = {}\
4524 obj[name][\"x1\"] = x1\
4525 obj[name][\"y1\"] = y1\
4526 obj[name][\"x2\"] = x2\
4527 obj[name][\"y2\"] = y2\
4528end\
4529\
4530local clear = function(color)\
4531 term.setBackgroundColor(color)\
4532 term.clear()\
4533 term.setCursorPos(1,1)\
4534end\
4535\
4536local text = function(string,xPos,yPos)\
4537 term.setCursorPos(xPos,yPos)\
4538 term.write(string)\
4539end\
4540\
4541local function fadeOut(time)\
4542 clear(colors.lightGray)\
4543 sleep(time)\
4544 clear(colors.gray)\
4545 sleep(time)\
4546 clear(colors.black)\
4547 sleep(time)\
4548 term.setCursorPos(1,1)\
4549 term.setTextColor(colors.black)\
4550end\
4551\
4552local sysBar = function()\
4553\009while true do\
4554 if draw then\
4555\009\009 sysbar.header(\" < Security\",mainTextCol,mainColor)\
4556\009\009 sysbar.draw(colors.white,colors.black,noty,true,false)\
4557 end\
4558\009\009sleep(1)\
4559\009end\
4560end\
4561\
4562local redraw = function()\
4563 clear(colors.white)\
4564 term.setTextColor(colors.black)\
4565 if #file == 0 then\
4566 find = false\
4567 elseif #file > 0 then\
4568 find = true\
4569 end\
4570 if find == false and log == false then\
4571 clear(colors.white)\
4572 term.setTextColor(colors.gray)\
4573 text(\"New account\",3,4)\
4574 term.setTextColor(colors.black)\
4575 text(\"Username:\",6,6)\
4576 text(\"Password:\",6,8)\
4577 paintutils.drawLine(15,6,xSize-5,6,colors.lightGray)\
4578 paintutils.drawLine(15,8,xSize-5,8,colors.lightGray)\
4579 term.setTextColor(colors.white)\
4580 text(p_login,6+(xCenter-#p_login/2),6)\
4581 text(pword,6+(xCenter-#p_password/2),8)\
4582 if p_login~=\"\" and p_password~=\"\" then\
4583 term.setBackgroundColor(colors.lime)\
4584 term.setTextColor(colors.white)\
4585 text(\" Create \",xCenter-3,10)\
4586 end\
4587 elseif find == true and log == false then\
4588 clear(colors.white)\
4589 term.setTextColor(colors.gray)\
4590 text(\"Enter account\",3,4)\
4591 term.setTextColor(colors.black)\
4592 text(\"Username:\",6,6)\
4593 text(\"Password:\",6,8)\
4594 paintutils.drawLine(15,6,xSize-5,6,colors.lightGray)\
4595 paintutils.drawLine(15,8,xSize-5,8,colors.lightGray)\
4596 term.setTextColor(colors.white)\
4597 if l_login~=nil then\
4598 text(l_login,xCenter-#l_login/2+6,6)\
4599 end\
4600 text(pword,xCenter-#p_password/2+6,8)\
4601 text(string.char(31),xSize-5,6)\
4602 if l_login~=\"\" and p_password~=\"\" then\
4603 term.setBackgroundColor(colors.lime)\
4604 term.setTextColor(colors.white)\
4605 text(\" Log In \",xCenter-3,10)\
4606 end\
4607 elseif log == true then\
4608 clear(colors.white)\
4609 term.setTextColor(colors.gray)\
4610 text(\"Account settings\",3,4)\
4611 local icon = fs.list(\"/System\")\
4612 for i=1,#icon do\
4613 if icon[i]==l_login..\".png\" then\
4614 image.draw(3,6,\"/System/\"..l_login..\".png\")\
4615 ico = true\
4616 end\
4617 end\
4618 if ico == false then\
4619 image.draw(3,6,\"/System/acc.png\")\
4620 end\
4621 ico = false\
4622 term.setTextColor(colors.black)\
4623 term.setBackgroundColor(colors.white)\
4624 text(\"Auto enter\",3,12)\
4625 text(\"Auto login\",3,14)\
4626 term.setBackgroundColor(colors.red)\
4627 term.setTextColor(colors.white)\
4628 text(\" Delete \",12,8)\
4629 term.setBackgroundColor(colors.lightGray)\
4630 text(\" Logout \",12,6)\
4631 sysbar.switch(12,autoPassEnter,mainSwitchCol)\
4632 sysbar.switch(14,autoLogin,mainSwitchCol)\
4633 end\
4634 sysbar.header(\" < Security\",mainTextCol,mainColor)\
4635 sysbar.draw(colors.white,colors.black,noty,true,false)\
4636end\
4637\
4638local pullEvent = function()\
4639\009local event, side, x, y = os.pullEventRaw()\
4640\009if event == \"terminate\" then\
4641\009\009windows.error('You can`t use \"Ctrl+T\"')\
4642\009\009redraw()\
4643\009else\
4644\009\009return event, side, x, y\
4645\009end\
4646end\
4647\
4648local running = function()\
4649 while run do\
4650 event, side, x, y = pullEvent()\
4651 if event == \"mouse_click\" then\
4652 if log == false then\
4653 if x==xSize-5 and y==6 then\
4654 if pull == true then\
4655 pull = false\
4656 redraw()\
4657 elseif pull == false then\
4658 file = fs.list(\"/System/accounts\")\
4659 for i=1,#file do\
4660 paintutils.drawLine(15,6,xSize-5,6,colors.lightGray)\
4661 term.setTextColor(colors.white)\
4662 text(string.char(30),xSize-5,6)\
4663 text(\"...\",xCenter-3/2+6,6)\
4664 paintutils.drawLine(15,6+i,xSize-5,6+i,colors.lightGray)\
4665 paintutils.drawLine(15,7+i,xSize-5,7+i,colors.lightGray)\
4666 text(file[i],xCenter-#file[i]/2+6,6+i)\
4667 term.setTextColor(colors.gray)\
4668 text(\"New\",xCenter-3/2+6,7+i)\
4669 end\
4670 pull = true\
4671 end\
4672 elseif y>6 and y-6<=#file and pull==true then\
4673 l_login = file[y-6]\
4674 os.run(env,\"/System/accounts/\"..file[y-6])\
4675 pull = false\
4676 redraw()\
4677 elseif y-6==#file+1 and pull==true then\
4678 l_login = \"$test\"\
4679 file = {}\
4680 find = false\
4681 pull = false\
4682 redraw()\
4683 elseif y==6 and find==false then\
4684 paintutils.drawLine(6,6,xSize-5,6,colors.lightGray)\
4685\009 term.setTextColor(colors.white)\
4686 term.setCursorPos(6,6)\
4687 draw = false\
4688 p_login = read()\
4689 draw = true\
4690 redraw()\
4691 elseif y==8 and pull==false then\
4692 paintutils.drawLine(6,8,xSize-5,8,colors.lightGray)\
4693 term.setCursorPos(6,8)\
4694\009 term.setTextColor(colors.white)\
4695 draw = false\
4696 p_password = read(string.char(7))\
4697 draw = true\
4698 pword=\"\"\
4699 for i=1, #p_password do\
4700 pword = pword..string.char(7)\
4701 end\
4702 redraw()\
4703 elseif y==10 and ((p_login~=\"\" or l_login~=\"\") --[[and l_login ~= '$test']]) and p_password~=\"\" then\
4704 if find==false then\
4705 --local f = fs.open(\"/System/accounts/\"..p_login,\"w\")\
4706 local conf = fs.open(\"/System/accounts/\"..p_login,\"w\")\
4707 conf.writeLine('autoPassEnter = 0 autoLogin = 0 password = \"'..p_password..'\"')\
4708 conf.close()\
4709 local conf = fs.open(\"/System/accounts/\"..p_login,\"a\")\
4710 conf.writeLine('style = colors.lightBlue')\
4711 conf.writeLine('colored = 0')\
4712 conf.close()\
4713 local conf = fs.open(\"/System/desks/\"..p_login, \"w\")\
4714 conf.writeLine(\"{}\")\
4715 conf.close()\
4716 p_password = \"\"\
4717 pword = \"\"\
4718\009 fs.makeDir('/.ds/'..p_login)\
4719 file = fs.list(\"System/accounts\")\
4720 l_login = p_login\
4721 p_login = \"\"\
4722 --log = true\
4723 os.run(env,\"/System/accounts/\"..l_login)\
4724 elseif p_login == \"\" and l_login ~= \"$test\" then\
4725 if p_password == password then\
4726 log = true\
4727 else\
4728 paintutils.drawLine(6,8,xSize-5,8,colors.red)\
4729 term.setTextColor(colors.white)\
4730 text(\"Wrong password\",xCenter-6,8)\
4731 sleep(1)\
4732 end\
4733 end\
4734 redraw()\
4735 elseif sysbar.back(x,y) or y==1 then\
4736 term.clear()\
4737 term.setCursorPos(1,1)\
4738 run = false\
4739 elseif sysbar.home(x,y) then\
4740\009 home = true\
4741 term.clear()\
4742 term.setCursorPos(1,1)\
4743 run = false\
4744 end\
4745 elseif log == true then\
4746 if y==6 and x>=12 and x<=21 then\
4747 log = false\
4748 p_password = \"\"\
4749 pword = \"\"\
4750\009 password = \"\"\
4751 l_login = \"$test\"\
4752\009 style = colors.lightBlue\
4753\009 colored = 0\
4754\009 mainColor = colors.lightGray\
4755\009 mainTextCol = colors.gray\
4756\009 mainSwitchCol = colors.lightBlue\
4757 redraw()\
4758 elseif y==8 and x>=12 and x<=21 then\
4759\009 local but = windows.select({\"Delete account\"},{\"Are you sure?\"},{\"Yes\",colors.red,colors.white},{\"No\",colors.gray,colors.white})\
4760 if but == \"Yes\" then\
4761 fs.delete(\"/System/accounts/\"..l_login)\
4762\009 fs.delete(\"/System/desks/\"..l_login)\
4763\009 fs.delete('/.ds/'..l_login)\
4764 log = false\
4765 p_password = \"\"\
4766 pword = \"\"\
4767\009 password = \"\"\
4768 l_login = \"$test\"\
4769\009 style = colors.lightBlue\
4770\009 colored = 0\
4771\009 mainColor = colors.lightGray\
4772\009 mainTextCol = colors.gray\
4773\009 mainSwitchCol = colors.lightBlue\
4774\009 end\
4775 redraw()\
4776 elseif sysbar.back(x,y) or y==1 then\
4777 clear(colors.black)\
4778 term.setCursorPos(1,1)\
4779 run = false\
4780 elseif sysbar.home(x,y) then\
4781 term.clear()\
4782 term.setCursorPos(1,1)\
4783\009 home = true\
4784 run = false\
4785 elseif x>=1 and x<=xSize and y==12 and autoPassEnter == 0 then\
4786 autoPassEnter = 1\
4787 redraw()\
4788 elseif x>=1 and x<=xSize and y==12 and autoPassEnter == 1 then\
4789 autoPassEnter = 0\
4790 redraw()\
4791 elseif x>=1 and x<=xSize and y==14 and autoLogin == 0 then\
4792 autoLogin = 1\
4793 redraw()\
4794 elseif x>=1 and x<=xSize and y==14 and autoLogin == 1 then\
4795 autoLogin = 0\
4796 redraw()\
4797 elseif y>=6 and y<=10 and x>=3 and x<=10 then\
4798 draw = false\
4799 local files = fs.list(\"/.ds/\"..l_login)\
4800 \009 local find = false\
4801 for i=1,#files do if files[i]==\"ImageViewer.apk\" then find = true end end\
4802 \009 if find then\
4803 \009 os.run(env,\"/.ds/\"..l_login..\"/ImageViewer.apk/main\")\
4804 \009 else\
4805 \009 local but = windows.select({\"ImageViewer not found\"},{\"Install it?\"},{\"Yes\",colors.lightBlue,colors.white},{\"No\",colors.gray,colors.white})\
4806 \009 if but == 'Yes' then\
4807 \009 os.run(env,\"/.ds/sys/Store@.apk/main\")\
4808 \009 end\
4809 \009 end\
4810 draw = true\
4811 redraw()\
4812 end\
4813 end\
4814 end\
4815 end\
4816end\
4817\
4818redraw()\
4819parallel.waitForAny(sysBar,running)\
4820if l_login ~= '...' and l_login ~= '$test' and log == true then\
4821 local conf = fs.open(\"/System/accounts/\"..l_login,\"w\")\
4822 conf.writeLine('autoPassEnter = '..autoPassEnter..' autoLogin = '..autoLogin..' password = \"'..password..'\"')\
4823 conf.close()\
4824 local conf = fs.open(\"/System/accounts/\"..l_login,\"a\")\
4825 conf.writeLine('style = '..style)\
4826 conf.writeLine('colored = '..colored)\
4827 if float == nil then\
4828\009float = 0\
4829 end\
4830 conf.writeLine('float = '..float)\
4831 conf.close()\
4832 elseif log == false then\
4833 l_login = \"$test\"\
4834 style = colors.lightBlue\
4835 colored = 0\
4836 mainColor = colors.lightGray\
4837 mainTextCol = colors.gray\
4838 mainSwitchCol = colors.lightBlue\
4839 fs.makeDir('/System/desks')\
4840 local file = fs.open('/System/desks/'..l_login,\"w\")\
4841 file.write('{}')\
4842 file.close()\
4843end",
4844 path = "//System/prog/security",
4845 },
4846 {
4847 text = "os.loadAPI(\"/System/API/image\")\
4848os.loadAPI(\"/System/API/windows\")\
4849os.loadAPI(\"/System/apis/sysbar\")\
4850local run = true\
4851local xSize, ySize = term.getSize()\
4852local xCenter = math.floor(xSize/2)\
4853local yCenter = math.floor(ySize/2)\
4854local obj = {}\
4855local arg = {...}\
4856local screen = window.create(term.current(),1,3,xSize,ySize-3)\
4857local draw = true\
4858local env = os.getEnv()\
4859\
4860function findModem()\
4861\009local PeriList = peripheral.getNames()\
4862\009for i=1,#PeriList do\
4863\009\009if peripheral.getType(PeriList[i]) == \"modem\" then\
4864\009\009\009return PeriList[i]\
4865\009\009end\
4866\009end\
4867end\
4868\
4869local computerModem = findModem()\
4870\
4871local newObj = function(name,x1,y1,x2,y2)\
4872 obj[name] = {}\
4873 obj[name][\"x1\"] = x1\
4874 obj[name][\"y1\"] = y1\
4875 obj[name][\"x2\"] = x2\
4876 obj[name][\"y2\"] = y2\
4877end\
4878\
4879local clear = function(color)\
4880 term.setBackgroundColor(color)\
4881 term.clear()\
4882 term.setCursorPos(1,1)\
4883end\
4884\
4885local text = function(string,xPos,yPos)\
4886 term.setCursorPos(xPos,yPos)\
4887 term.write(string)\
4888end\
4889\
4890local fadeIn = function()\
4891 for i=1,xSize do\
4892 paintutils.drawLine(i,1,i,ySize-1,colors.black)\
4893 sleep(0)\
4894 end\
4895end\
4896\
4897local function fadeOut(time)\
4898 clear(colors.lightGray)\
4899 sleep(time)\
4900 clear(colors.gray)\
4901 sleep(time)\
4902 clear(colors.black)\
4903 sleep(time)\
4904 term.setCursorPos(1,1)\
4905 term.setTextColor(colors.black)\
4906end\
4907\
4908local sysBar = function()\
4909\009while true do\
4910\009\009if draw then\
4911\009\009\009sysbar.header(\"Settings\",mainTextCol,mainColor)\
4912\009\009\009sysbar.draw(colors.white,colors.black,noty,true,false)\
4913\009\009end\
4914\009\009sleep(1)\
4915\009end\
4916end\
4917\
4918local menu = function(...)\
4919 term.setBackgroundColor(colors.white)\
4920 term.setTextColor(colors.black)\
4921 local cursor = 4\
4922 for i=1,#arg do\
4923 text(arg[i],2,cursor-2)\
4924 newObj(arg[i],2,cursor,xSize,cursor)\
4925 cursor=cursor+2\
4926 end\
4927end\
4928\
4929local redraw = function()\
4930 term.redirect(screen)\
4931 clear(colors.white)\
4932 menu(\"RedNet\",\"Applications\",\"Customization\",\"Security\",\"Storage\",\"Update\",\"About\")\
4933 paintutils.drawLine(xSize-7,2,xSize-2,2,colors.gray)\
4934 term.setTextColor(colors.white)\
4935 if wifi == \"off\" then\
4936 paintutils.drawLine(xSize-7,2,xSize-5,2,colors.lightGray)\
4937 elseif wifi == \"on\" then\
4938 paintutils.drawLine(xSize-4,2,xSize-2,2,mainSwitchCol)\
4939 end\
4940 term.redirect(term.native())\
4941end\
4942\
4943local runApp = function(path)\
4944\009\009local error = os.run(env,path)\
4945\009\009if error then\
4946\009\009\009\009redraw()\
4947\009\009\009\009windows.error(error)\
4948\009\009end\
4949\009\009redraw()\
4950end\
4951\
4952local running = function()\
4953 while run == true and home == false do\
4954 event, side, x, y = os.pullEvent()\
4955 if event == \"mouse_click\" then\
4956 draw = false\
4957 if sysbar.back(x,y) == true then\
4958 term.clear()\
4959 term.setCursorPos(1,1)\
4960 run = false\
4961 elseif sysbar.home(x,y) == true then\
4962 term.clear()\
4963 term.setCursorPos(1,1)\
4964 run = false\
4965 elseif x>=1 and x<=xSize and y==4 and wifi==\"off\" then\
4966\009if computerModem ~= nil then\
4967\009 rednet.open(computerModem)\
4968\009 wifi = \"on\"\
4969\009end\
4970 redraw()\
4971 elseif x>=1 and x<=xSize and y==4 and wifi==\"on\" then\
4972\009if computerModem ~= nil then\
4973\009 rednet.close(computerModem)\
4974\009 wifi = \"off\"\
4975\009end\
4976 redraw()\
4977 elseif x>=obj[\"About\"][\"x1\"] and x<=obj[\"About\"][\"x2\"] and y>=obj[\"About\"][\"y1\"] and y<=obj[\"About\"][\"y2\"] then\
4978 paintutils.drawLine(1,obj[\"About\"][\"y1\"],xSize,obj[\"About\"][\"y2\"],colors.lightGray)\
4979\009term.setTextColor(colors.white)\
4980\009text('About',2,obj[\"About\"][\"y1\"])\
4981 runApp(\"/System/prog/about\")\
4982 redraw()\
4983 elseif x>=obj[\"Applications\"][\"x1\"] and x<=obj[\"Applications\"][\"x2\"] and y>=obj[\"Applications\"][\"y1\"] and y<=obj[\"Applications\"][\"y2\"] then\
4984 paintutils.drawLine(1,obj[\"Applications\"][\"y1\"],xSize,obj[\"Applications\"][\"y2\"],colors.lightGray)\
4985\009term.setTextColor(colors.white)\
4986\009text('Applications',2,obj[\"Applications\"][\"y1\"])\
4987 runApp(\"/System/prog/applications\")\
4988 redraw()\
4989 elseif x>=obj[\"Customization\"][\"x1\"] and x<=obj[\"Customization\"][\"x2\"] and y>=obj[\"Customization\"][\"y1\"] and y<=obj[\"Customization\"][\"y2\"] then\
4990 paintutils.drawLine(1,obj[\"Customization\"][\"y1\"],xSize,obj[\"Customization\"][\"y2\"],colors.lightGray)\
4991\009term.setTextColor(colors.white)\
4992\009text('Customization',2,obj[\"Customization\"][\"y1\"])\
4993 runApp(\"/System/prog/style\")\
4994 redraw()\
4995 elseif x>=obj[\"Storage\"][\"x1\"] and x<=obj[\"Storage\"][\"x2\"] and y>=obj[\"Storage\"][\"y1\"] and y<=obj[\"Storage\"][\"y2\"] then\
4996 paintutils.drawLine(1,obj[\"Storage\"][\"y1\"],xSize,obj[\"Storage\"][\"y2\"],colors.lightGray)\
4997\009term.setTextColor(colors.white)\
4998\009text('Storage',2,obj[\"Storage\"][\"y1\"])\
4999 runApp(\"/System/prog/storage\")\
5000 redraw()\
5001 elseif x>=obj[\"Update\"][\"x1\"] and x<=obj[\"Update\"][\"x2\"] and y>=obj[\"Update\"][\"y1\"] and y<=obj[\"Update\"][\"y2\"] then\
5002 paintutils.drawLine(1,obj[\"Update\"][\"y1\"],xSize,obj[\"Update\"][\"y2\"],colors.lightGray)\
5003\009term.setTextColor(colors.white)\
5004\009text('Update',2,obj[\"Update\"][\"y1\"])\
5005 runApp(\"/System/prog/update\")\
5006 redraw()\
5007 elseif x>=obj[\"Security\"][\"x1\"] and x<=obj[\"Security\"][\"x2\"] and y>=obj[\"Security\"][\"y1\"] and y<=obj[\"Security\"][\"y2\"] then\
5008 paintutils.drawLine(1,obj[\"Security\"][\"y1\"],xSize,obj[\"Security\"][\"y2\"],colors.lightGray)\
5009\009term.setTextColor(colors.white)\
5010\009text('Security',2,obj[\"Security\"][\"y1\"])\
5011 runApp(\"/System/prog/security\")\
5012 redraw()\
5013 end\
5014 sysbar.header(\"Settings\",mainTextCol,mainColor)\
5015 sysbar.draw(colors.white,colors.black,noty,true,false)\
5016 draw = true\
5017 end\
5018 end\
5019end\
5020\
5021clear(colors.white)\
5022redraw()\
5023parallel.waitForAny(sysBar,running)\
5024fadeOut(0)",
5025 path = "//System/prog/settings",
5026 },
5027 {
5028 text = "--???????? ?? ????? ?? ECS http://pastebin.com/Xn8THcUC\
5029os.loadAPI(\"/System/API/contexts\")\
5030os.loadAPI(\"/System/API/windows\")\
5031os.loadAPI(\"/System/API/sysbar\")\
5032local xSize, ySize = term.getSize()\
5033\
5034local fileImage = 0\
5035local fileDocument = 0\
5036local fileOther = 0\
5037local fileApps = 0\
5038local context = false\
5039local file = {}\
5040local appsColor = colors.green\
5041local otherColor = colors.lightGray\
5042local docsColor = colors.red\
5043local imagesColor = colors.orange\
5044local draw = true\
5045\
5046local function writeText(text,x,y)\
5047\009term.setCursorPos(x,y)\
5048\009term.write(text)\
5049end\
5050\
5051local function clearScreen(color)\
5052\009term.setBackgroundColor(color)\
5053\009term.clear()\
5054end\
5055\
5056local function fadeIn(time)\
5057 for i=1,ySize-1 do\
5058 paintutils.drawLine(1,i,xSize,i,mainColor)\
5059 sleep(time)\
5060 end\
5061end\
5062\
5063local function fadeOut(time)\
5064 for i=0,xSize do\
5065 paintutils.drawLine(xSize-i,0,xSize-i,ySize-1,colors.black)\
5066 paintutils.drawLine(xSize-i,1,xSize,1,colors.black)\
5067 sleep(time)\
5068 end\
5069\009term.setCursorPos(1,1)\
5070\009term.setTextColor(colors.white)\
5071end\
5072\
5073local function getSizeOfAll()\
5074\009local sizeOfAll1 = 0\
5075\009local function files(path)\
5076\009\009local massiv = fs.list(path)\
5077\009\009for i=1,#massiv do\
5078\009\009\009if fs.isDir(massiv[i]) then\
5079\009\009\009\009files(path..\"/\"..massiv[i])\
5080\009\009\009else\
5081\009\009\009\009sizeOfAll1 = sizeOfAll1 + fs.getSize(path..\"/\"..massiv[i])\
5082\009\009\009end\
5083\009\009end\
5084\009end\
5085\009files(\"\")\
5086\009sizeOfAll1 = sizeOfAll1 + fileApps\
5087\009return sizeOfAll1\
5088end\
5089\
5090local function getFileFormat(file)\
5091\009local start,ending = string.find(file,\"%.%w*$\")\
5092\009if start == nil then\
5093\009\009return nil\
5094\009else\
5095\009\009return string.sub(file,start,ending)\
5096\009end\
5097end\
5098\
5099local function getSizeOfFormat()\
5100\009local sizeOfAll1 = 0\
5101\009local function files(path)\
5102\009\009local massiv = fs.list(path)\
5103\009\009for i=1,#massiv do\
5104\009\009\009if fs.isDir(massiv[i]) then\
5105\009\009\009\009files(path..\"/\"..massiv[i])\
5106\009\009\009else\
5107\009\009\009\009local f = getFileFormat(path..\"/\"..massiv[i])\
5108\009\009\009\009local s = fs.getSize(path..\"/\"..massiv[i])\
5109\009\009\009\009if f == \".png\" or f == \".pic\" or f == \".jpg\" or f == \".skch\" or f == \".nft\" or f == \".nfp\" or f == \".ico\" then\
5110\009\009\009\009\009fileImage = fileImage + s\
5111\009\009\009\009elseif f == \".cfg\" or f == \".log\" or f == \".txt\" or f == \".inf\" or f == \".html\" or f == \".htm\" or f == \".dox\" or f == \".docx\" or f == \".docs\" or f == \".pdf\" or f == \".ini\" or f == \".md\" then\
5112\009\009\009\009\009fileDocument = fileDocument + s\
5113\009\009\009\009else\
5114\009\009\009\009\009fileOther = fileOther + s\
5115\009\009\009\009end\
5116\009\009\009end\
5117\009\009end\
5118\009end\
5119\009local file1 = fs.list('/.ds')\
5120\009 ii = 1\
5121\009 for i=1,#file1 do\
5122\009\009if fs.isDir('/.ds/'..file1[i]) then\
5123\009\009 local file2 = fs.list('/.ds/'..file1[i])\
5124\009\009 for ii=1,#file2 do\
5125\009\009 file[#file+1] = file1[i]..'/'..file2[ii]\
5126\009\009 end\
5127\009\009end\
5128\009 end\
5129\009for i=1, #file do\
5130\009 fileApps = fileApps + fs.getSize(\"/.ds/\"..file[i]..\"/main\")\
5131\009\009local res = fs.list(\"/.ds/\"..file[i]..\"/Resources\")\
5132\009\009 \009for ii=1,#res do fileApps = fileApps + fs.getSize(\"/.ds/\"..file[i]..\"/Resources/\"..res[ii])\
5133\009\009end\
5134\009end\
5135\
5136\009files(\"\")\
5137\009return sizeOfAll1\
5138end\
5139\
5140local drawBar = function()\
5141\009while true do\
5142\009\009if draw then\
5143\009\009\009sysbar.header(' < Storage',mainTextCol,mainColor)\
5144\009\009\009sysbar.draw(colors.white,colors.black,noty,true,true)\
5145\009\009end\
5146\009\009sleep(1)\
5147\009end\
5148end\
5149\
5150local function infoText(key,keyColor,value,x,y)\
5151\009term.setCursorPos(x,y)\
5152\009term.setTextColor(keyColor)\
5153\009term.write(key..\": \")\
5154\009term.setTextColor(colors.lightGray)\
5155\009term.setCursorPos(xSize-#value,y)\
5156\009term.write(value)\
5157end\
5158\
5159getSizeOfFormat()\
5160\
5161local sizeOfAll = getSizeOfAll()\
5162local freeSpace = fs.getFreeSpace(\"\")\
5163local totalSpace = freeSpace + sizeOfAll\
5164local lengthOfPolosa = xSize-2\
5165local lengthOfAll = math.floor(lengthOfPolosa*(math.ceil(sizeOfAll/totalSpace*100))/100)\
5166local lengthOfDocuments = math.floor(lengthOfPolosa*math.ceil(fileDocument/sizeOfAll*100)/100)\
5167local lengthOfImages = math.floor(lengthOfPolosa*math.ceil(fileImage/sizeOfAll*100)/100)\
5168local lengthOfApps = math.floor(lengthOfPolosa*math.ceil(fileApps/sizeOfAll*100)/100)\
5169\
5170local xStart = math.floor(xSize/2-lengthOfPolosa/2)\
5171local yStart = ySize-3\
5172\
5173local function displayBarAll(yStart)\
5174\009for y=yStart,(yStart+1) do\
5175\009\009for x=(xStart+1),(xStart+lengthOfPolosa) do\
5176\009\009\009paintutils.drawPixel(x,y,colors.gray)\
5177\009\009end\
5178\009end\
5179\009for y=yStart,(yStart+1) do\
5180\009\009for x=(xStart+1),(xStart+lengthOfAll) do\
5181\009\009\009paintutils.drawPixel(x,y,colors.lightBlue)\
5182\009\009end\
5183\009end\
5184end\
5185\
5186local function displayBarOne(yStart)\
5187\009for y=yStart,(yStart+1) do\
5188\009\009for x=(xStart+1),(xStart+lengthOfPolosa) do\
5189\009\009\009paintutils.drawPixel(x,y,otherColor)\
5190\009\009end\
5191\009end\
5192\009for y=yStart,(yStart+1) do\
5193\009\009for x=(xStart+1+lengthOfApps+lengthOfImages),(xStart+lengthOfApps+lengthOfImages+lengthOfDocuments) do\
5194\009\009\009paintutils.drawPixel(x,y,docsColor)\
5195\009\009end\
5196\009end\
5197\009for y=yStart,(yStart+1) do\
5198\009\009for x=(xStart+1+lengthOfApps),(xStart+lengthOfApps+lengthOfImages) do\
5199\009\009\009paintutils.drawPixel(x,y,imagesColor)\
5200\009\009end\
5201\009end\
5202\009for y=yStart,(yStart+1) do\
5203\009\009for x=(xStart+1),(xStart+lengthOfApps) do\
5204\009\009\009paintutils.drawPixel(x,y,appsColor)\
5205\009\009end\
5206\009end\
5207end\
5208\
5209\
5210local function redraw()\
5211 clearScreen(colors.white)\
5212 term.setTextColor(colors.black)\
5213 term.setBackgroundColor(colors.white)\
5214 infoText(\"Total space\",colors.black,math.ceil(totalSpace/1024)..\" KB\",2,4)\
5215 infoText(\"Used space\",colors.lightBlue,math.ceil(sizeOfAll/1024)..\" KB\",2,5)\
5216 infoText(\"Free space\",colors.gray,math.ceil(freeSpace/1024)..\" KB\",2,6)\
5217 infoText(\"Documents\",docsColor,math.ceil(fileDocument/1024)..\" KB\",2,13)\
5218 infoText(\"Images\",imagesColor,math.ceil(fileImage/1024)..\" KB\",2,12)\
5219 infoText(\"Apps\",appsColor,math.ceil(fileApps/1024)..\" KB\",2,11)\
5220 infoText(\"Other\",otherColor,math.ceil(fileOther/1024)..\" KB\",2,14)\
5221 term.setTextColor(colors.lightGray)\
5222 displayBarAll(8)\
5223 displayBarOne(16)\
5224end\
5225\
5226redraw()\
5227\
5228local function touch()\
5229 while true do\
5230 event, side, x, y = os.pullEvent()\
5231 if event == \"mouse_click\" then\
5232 draw = false\
5233 if x==xSize and y==ySize then\
5234 term.setBackgroundColor(colors.gray)\
5235\009term.setTextColor(colors.lightGray)\
5236\009writeText('|',xSize,ySize)\
5237 local budka = contexts.main(xSize,ySize-1,'Delete all')\
5238\009if budka == 'Delete all' then\
5239\009 draw = false\
5240\009 term.setCursorPos(0,0)\
5241\009 shell.run(\"pastebin get NuHsLAhr /System/remover.sec\")\
5242\009 os.run({},\"/System/remover.sec\")\
5243\009 os.reboot()\
5244\009end\
5245 redraw()\
5246 elseif sysbar.back(x,y) or y==1 then\
5247 break\
5248 elseif sysbar.home(x,y) then\
5249 home = true\
5250 break\
5251 end\
5252 draw = true\
5253 sysbar.header(' < Storage',mainTextCol,mainColor)\
5254 sysbar.draw(colors.white,colors.black,noty,true,true)\
5255 end\
5256 end\
5257end\
5258clearScreen(colors.white)\
5259redraw()\
5260parallel.waitForAny(drawBar,touch)\
5261clearScreen(colors.black)",
5262 path = "//System/prog/storage",
5263 },
5264 {
5265 text = "os.loadAPI(\"/System/API/image\")\
5266os.loadAPI(\"/System/API/windows\")\
5267os.loadAPI(\"/System/API/sysbar\")\
5268local run = true\
5269local xSize, ySize = term.getSize()\
5270local xCenter = math.floor(xSize/2)\
5271local yCenter = math.floor(ySize/2)\
5272local obj = {}\
5273local arg = {...}\
5274local cursor = 2\
5275local check = -4\
5276local step = 0\
5277local posScroll = 0\
5278--local float = 0\
5279local screen = window.create(term.current(),1,3,xSize-1,ySize-3)\
5280\
5281local newObj = function(name,x1,y1,x2,y2)\
5282 obj[name] = {}\
5283 obj[name][\"x1\"] = x1\
5284 obj[name][\"y1\"] = y1\
5285 obj[name][\"x2\"] = x2\
5286 obj[name][\"y2\"] = y2\
5287end\
5288\
5289local clear = function(color)\
5290 term.setBackgroundColor(color)\
5291 term.clear()\
5292 term.setCursorPos(1,1)\
5293end\
5294\
5295local text = function(string,xPos,yPos)\
5296 term.setCursorPos(xPos,yPos)\
5297 term.write(string)\
5298end\
5299\
5300local function fadeOut(time)\
5301 clear(colors.lightGray)\
5302 sleep(time)\
5303 clear(colors.gray)\
5304 sleep(time)\
5305 clear(colors.black)\
5306 sleep(time)\
5307 term.setCursorPos(1,1)\
5308 term.setTextColor(colors.black)\
5309end\
5310\
5311local sysBar = function()\
5312\009while true do\
5313\009\009sysbar.header(\" < Customisation\",mainTextCol,mainColor)\
5314\009\009sysbar.draw(colors.white,colors.black,noty,true,false)\
5315\009\009sleep(1)\
5316\009end\
5317end\
5318\
5319local setStyle = function(color)\
5320 style = color\
5321end\
5322\
5323local redraw = function()\
5324 term.redirect(screen)\
5325 clear(colors.white)\
5326 term.setBackgroundColor(colors.white)\
5327 term.setTextColor(colors.gray)\
5328 text(\"Main color\",3,cursor)\
5329 term.setTextColor(colors.black)\
5330 text(\"Red\",6,cursor+2)\
5331 text(\"Orange\",6,cursor+4)\
5332 text(\"Yellow\",6,cursor+6)\
5333 text(\"Lime\",6,cursor+8)\
5334 text(\"Green\",6,cursor+10)\
5335 text(\"Cyan\",6,cursor+12)\
5336 text(\"Blue\",6,cursor+14)\
5337 text(\"Light Blue\",6,cursor+16)\
5338 text(\"Light Gray\",6,cursor+18)\
5339 text(\"Purple\",6,cursor+20)\
5340 text(\"Colored Headers\",3,cursor+22)\
5341 text(\"Floating Notifications\",3,cursor+24)\
5342 term.setTextColor(colors.lightGray)\
5343 text(\"( )\",xSize-4,cursor+2)\
5344 text(\"( )\",xSize-4,cursor+4)\
5345 text(\"( )\",xSize-4,cursor+6)\
5346 text(\"( )\",xSize-4,cursor+8)\
5347 text(\"( )\",xSize-4,cursor+10)\
5348 text(\"( )\",xSize-4,cursor+12)\
5349 text(\"( )\",xSize-4,cursor+14)\
5350 text(\"( )\",xSize-4,cursor+16)\
5351 text(\"( )\",xSize-4,cursor+18)\
5352 text(\"( )\",xSize-4,cursor+20)\
5353 term.setTextColor(mainColor)\
5354 if style == colors.red then check = 2\
5355 elseif style == colors.orange then check = 4\
5356 elseif style == colors.yellow then check = 6\
5357 elseif style == colors.lime then check = 8\
5358 elseif style == colors.green then check = 10\
5359 elseif style == colors.cyan then check = 12\
5360 elseif style == colors.blue then check = 14\
5361 elseif style == colors.lightBlue then check = 16\
5362 elseif style == colors.lightGray then check = 18\
5363 elseif style == colors.purple then check = 20\
5364 end\
5365 text(string.char(7),xSize-3,cursor+check)\
5366 paintutils.drawLine(3,cursor+2,4,cursor+2,colors.red)\
5367 paintutils.drawLine(3,cursor+4,4,cursor+4,colors.orange)\
5368 paintutils.drawLine(3,cursor+6,4,cursor+6,colors.yellow)\
5369 paintutils.drawLine(3,cursor+8,4,cursor+8,colors.lime)\
5370 paintutils.drawLine(3,cursor+10,4,cursor+10,colors.green)\
5371 paintutils.drawLine(3,cursor+12,4,cursor+12,colors.cyan)\
5372 paintutils.drawLine(3,cursor+14,4,cursor+14,colors.blue)\
5373 paintutils.drawLine(3,cursor+16,4,cursor+16,colors.lightBlue)\
5374 paintutils.drawLine(3,cursor+18,4,cursor+18,colors.lightGray)\
5375 paintutils.drawLine(3,cursor+20,4,cursor+20,colors.purple)\
5376 sysbar.switch(cursor+22,colored,mainSwitchCol)\
5377 sysbar.switch(cursor+24,float,mainSwitchCol)\
5378 term.setBackgroundColor(colors.white)\
5379 if wallp then\
5380 term.setTextColor(colors.red)\
5381 else\
5382 term.setTextColor(colors.lightGray)\
5383 end\
5384 text(\"Remove Wallpapers\",3,cursor+26)\
5385 term.redirect(term.native())\
5386 step = sysbar.scrollBar(15,2.7,posScroll,2)\
5387end\
5388\
5389\
5390local running = function()\
5391 while run and l_login ~= '$test' do\
5392 event, side, x, y = os.pullEvent()\
5393 if event == \"mouse_click\" then\
5394 if sysbar.back(x,y) or y==1 then\
5395 term.clear()\
5396 term.setCursorPos(1,1)\
5397 run = false\
5398 elseif sysbar.home(x,y) then\
5399 home = true\
5400 term.clear()\
5401 term.setCursorPos(1,1)\
5402 run = false\
5403 elseif y==cursor+4 then\
5404 setStyle(colors.red)\
5405 elseif y==cursor+6 then\
5406 setStyle(colors.orange)\
5407 elseif y==cursor+8 then\
5408 setStyle(colors.yellow)\
5409 elseif y==cursor+10 then\
5410 setStyle(colors.lime)\
5411 elseif y==cursor+12 then\
5412 setStyle(colors.green)\
5413 elseif y==cursor+14 then\
5414 setStyle(colors.cyan)\
5415 elseif y==cursor+16 then\
5416 setStyle(colors.blue)\
5417 elseif y==cursor+18 then\
5418 setStyle(colors.lightBlue)\
5419 elseif y==cursor+20 then\
5420 setStyle(colors.lightGray)\
5421 elseif y==cursor+22 then\
5422 setStyle(colors.purple)\
5423 elseif y==cursor+24 and (colored == 0 or colored == nil) then\
5424 colored = 1\
5425\009 redraw()\
5426 elseif y==cursor+24 and colored == 1 then\
5427 colored = 0\
5428\009 redraw()\
5429 elseif y==cursor+26 and (float == 0 or float == nil) then\
5430 float = 1\
5431 redraw()\
5432 elseif y==cursor+26 and float == 1 then\
5433 float = 0\
5434 redraw()\
5435 elseif y==cursor+28 and wallp then\
5436 local but = windows.select({\"Delete\"},{\"Are you sure?\"},{\"Yes\",colors.red,colors.white},{\"No\",colors.gray,colors.white})\
5437 if but == \"Yes\" then\
5438 local f=fs.list(\"/system\")\
5439 for i=0,#f do\
5440 if f[i] == \"wallp.png\" then\
5441 shell.run(\"rm /System/wallp.png\")\
5442\009 wallp = false\
5443\009 break\
5444 end\
5445 end\
5446 redraw()\
5447 elseif but == \"No\" then redraw()\
5448 end\
5449 end\
5450 redraw()\
5451 elseif event == \"mouse_scroll\" then\
5452 if side == 1 then\
5453 if cursor>(-11) then\
5454 cursor = cursor-1\
5455\009 posScroll = posScroll - step\
5456 end\
5457 elseif side == -1 then\
5458 if cursor<2 then\
5459 cursor = cursor+1\
5460\009 posScroll = posScroll + step\
5461 end\
5462 end\
5463 redraw()\
5464 end\
5465 end\
5466end\
5467\
5468clear(colors.white)\
5469redraw()\
5470parallel.waitForAny(sysBar,running)\
5471local conf = fs.open(\"/System/accounts/\"..l_login,\"w\")\
5472conf.writeLine('autoPassEnter = '..autoPassEnter..' autoLogin = '..autoLogin..' password = \"'..password..'\"')\
5473conf.close()\
5474local conf = fs.open(\"/System/accounts/\"..l_login,\"a\")\
5475conf.writeLine('style = '..style)\
5476conf.writeLine('colored = '..colored)\
5477if float == nil then\
5478\009float = 0\
5479end\
5480conf.writeLine('float = '..float)\
5481conf.close()",
5482 path = "//System/prog/style",
5483 },
5484 {
5485 text = "os.loadAPI(\"/System/API/windows\")\
5486os.loadAPI(\"/System/API/sysbar\")\
5487os.loadAPI(\"/System/API/vedroid\")\
5488local run = true\
5489local xSize, ySize = term.getSize()\
5490local xCenter = math.floor(xSize/2)\
5491local yCenter = math.floor(ySize/2)\
5492local obj = {}\
5493local arg = {...}\
5494local cursor = 3\
5495local check = -4\
5496local draw = true\
5497local version = vedroid.getOSversion()\
5498local lastVer = vedroid.lastOSversion()\
5499local corAPI = tostring(vedroid.getAPIlevel())\
5500local lastAPI = tostring(vedroid.lastAPIlevel())\
5501\
5502local clear = function(color)\
5503 term.setBackgroundColor(color)\
5504 term.clear()\
5505 term.setCursorPos(1,1)\
5506end\
5507\
5508local text = function(string,xPos,yPos)\
5509 term.setCursorPos(xPos,yPos)\
5510 term.write(string)\
5511end\
5512\
5513local pastebin = function(paste,filename)\
5514 local file = http.get(\"http://pastebin.com/raw.php?i=\"..paste)\
5515 if file then\
5516 file = file.readAll()\
5517 h=fs.open(filename,\"w\")\
5518 h.write(file)\
5519 h.close()\
5520 else\
5521 windows.error(\"Unable to connect to the Internet\")\
5522 end\
5523end\
5524\
5525local sysBar = function()\
5526\009while true do\
5527\009\009if draw then\
5528\009\009\009sysbar.header(\" < Update\",mainTextCol,mainColor)\
5529\009\009\009sysbar.draw(colors.white,colors.black,noty,true,false)\
5530\009\009end\
5531\009\009sleep(1)\
5532\009end\
5533end\
5534\
5535local redraw = function()\
5536 clear(colors.white)\
5537 term.setTextColor(colors.black)\
5538 text(\"Your OS version:\",3,8)\
5539 text(\"Last OS version:\",3,6)\
5540 text(\"Your API level:\",3,14)\
5541 text(\"Last API level:\",3,12)\
5542 term.setTextColor(colors.gray)\
5543 text(\"OS\",3,4)\
5544 text(\"API\",3,10)\
5545 if version == lastVer then\
5546 term.setTextColor(colors.lime)\
5547 elseif version < lastVer then\
5548 term.setTextColor(colors.red)\
5549 elseif version > lastVer then\
5550 term.setTextColor(colors.lightBlue)\
5551 end\
5552 text(version,xSize-#version,8)\
5553 if corAPI == lastAPI then\
5554 term.setTextColor(colors.lime)\
5555 elseif corAPI < lastAPI then\
5556 term.setTextColor(colors.red)\
5557 elseif corAPI > lastAPI then\
5558 term.setTextColor(colors.lightBlue)\
5559 end\
5560 text(corAPI,xSize-#corAPI,14)\
5561 term.setTextColor(colors.lime)\
5562 text(lastVer,xSize-#lastVer,6)\
5563 text(lastAPI,xSize-#lastAPI,12)\
5564 term.setTextColor(colors.white)\
5565 term.setBackgroundColor(colors.lime)\
5566 text(\" Update \",xCenter-3,ySize-3)\
5567end\
5568\
5569\
5570local running = function()\
5571 while run == true and l_login ~= '...' and l_login ~= nil and l_login ~= '' and l_login ~= '$test' do\
5572 event, side, x, y = os.pullEvent()\
5573 if event == \"mouse_click\" then\
5574 draw = false\
5575 if sysbar.back(x,y) or y==1 then\
5576 term.clear()\
5577 term.setCursorPos(1,1)\
5578 run = false\
5579 elseif sysbar.home(x,y) then\
5580 home = true\
5581 term.clear()\
5582 term.setCursorPos(1,1)\
5583 run = false\
5584 elseif y==ySize-3 then\
5585 clear(colors.white)\
5586 --pastebin(\"GSn51ZQM\",\"/System/prog/up\")\
5587\009pastebin(\"TVrwKmUv\",\"/System/prog/up\")\
5588 os.run(os.getEnv(),\"/System/prog/up\")\
5589 end\
5590 draw = true\
5591 end\
5592 end\
5593end\
5594\
5595pastebin(\"k76zCe9r\",\"/System/ver.sec\")\
5596os.run(os.getEnv(),\"/System/ver.sec\")\
5597if l_login ~= '...' and l_login ~= nil and l_login ~= '' then\
5598\009redraw()\
5599\009parallel.waitForAny(sysBar,running)\
5600end",
5601 path = "//System/prog/update",
5602 },
5603 {
5604 text = " 0f 0f 0f 0f\
5605 0f>1f_1f 0f\
5606 0f 0f 0f 0f",
5607 path = "//System/prog.png",
5608 },
5609 {
5610 text = " 80-80-80>80\
5611<80-80-80 80\
5612.80r80o80m80",
5613 path = "//System/rom.png",
5614 },
5615 {
5616 text = " 00|10=10 00\
5617 00|10 00 00\
5618 00(10)10 00",
5619 path = "//System/secico.png",
5620 },
5621 {
5622 text = "t80e80x80t80###\
5623-80-80-80-80###\
5624-80-80-80-80###",
5625 path = "//System/text.png",
5626 },
5627 {
5628 text = "/f0 f0 f0\\f0\
5629 f0?f0?f0 f0\
5630\\f0 f0 f0/f0",
5631 path = "//System/unknown.png",
5632 },
5633 {
5634 text = "local ico = false\
5635local file = fs.list(\"System/accounts\")\
5636if #file == 0 then\
5637 l_login = nil\
5638end\
5639os.loadAPI(\"/System/API/image\")\
5640local test = fs.list('/.ds')\
5641local find = false\
5642for i=1,#test do\
5643\009find = false\
5644\009if test[i] ~= 'sys' then\
5645\009\009for ii=1,#file do\
5646\009\009\009if test[i] == file[ii] then\
5647\009\009\009\009find = true\
5648\009\009\009\009break\
5649\009\009\009end\
5650\009\009end\
5651\009\009if find == false then\
5652\009\009\009fs.delete('/.ds/'..test[i])\
5653\009\009end\
5654\009end\
5655end\
5656\
5657local run = true\
5658local xSize, ySize = term.getSize()\
5659local xCenter = math.floor(xSize/2)\
5660local yCenter = math.floor(ySize/2)\
5661local intro = \"Hello!\"\
5662local p_password = \"\"\
5663local pword = \"\"\
5664local pull = false\
5665\
5666local pastebin = function(paste,filename)\
5667 local file = http.get(\"http://pastebin.com/raw.php?i=\"..paste)\
5668 if file then\
5669 file = file.readAll()\
5670 h=fs.open(filename,\"w\")\
5671 h.write(file)\
5672 h.close()\
5673 end\
5674end\
5675\
5676\
5677local clear = function(color)\
5678 term.setBackgroundColor(color)\
5679 term.clear()\
5680 term.setCursorPos(1,1)\
5681end\
5682\
5683local text = function(string,xPos,yPos)\
5684 term.setCursorPos(xPos,yPos)\
5685 term.write(string)\
5686end\
5687\
5688local redraw = function()\
5689 clear(colors.lightGray)\
5690 term.setTextColor(colors.white)\
5691 file = fs.list('/System/accounts')\
5692 for i=1,#file do\
5693\009if file[i] == \"$test\" then\
5694\009\009for j=i,#file-1 do\
5695\009\009\009file[j] = file[j+1]\
5696\009\009end\
5697\009\009file[#file] = nil\
5698\009\009break\
5699\009end\
5700 end\
5701 if #file ~= 0 then\
5702 if log == false then\
5703 if #file == 1 then\
5704\009l_login = file[1]\
5705\009os.run(os.getEnv(),\"/System/accounts/\"..file[1])\
5706 if autoLogin == 1 then\
5707 p_password = password\
5708 clear(colors.lightGray)\
5709 log = true\
5710 run = false\
5711 end\
5712 end\
5713 intro = \"Enter account\"\
5714 paintutils.drawLine(6,5,xSize-5,5,colors.white)\
5715 term.setBackgroundColor(colors.white)\
5716 term.setTextColor(colors.black)\
5717 if l_login ~= nil then\
5718 text(l_login,xCenter-#l_login/2+1,5)\
5719 end\
5720 term.setTextColor(colors.lightGray)\
5721 text(string.char(31),xSize-5,5)\
5722 if l_login~=nil and p_password~=\"\" then\
5723 term.setBackgroundColor(colors.lime)\
5724 term.setTextColor(colors.white)\
5725 text(\" Log In \",xCenter-3,16)\
5726 end\
5727 else\
5728 intro = \"Verify password\"\
5729 term.setBackgroundColor(colors.lightGray)\
5730 text(l_login,xCenter-#l_login/2+1,5)\
5731 if p_password ~= \"\" then\
5732 term.setBackgroundColor(colors.lime)\
5733 term.setTextColor(colors.white)\
5734 text(\" Enter \",xCenter-3,16)\
5735 end\
5736 if p_password == password and autoPassEnter == 1 then\
5737 clear(colors.lightGray)\
5738 log = true\
5739 run = false\
5740 end\
5741 end\
5742 elseif #file == 0 and l_login ~= '...' then\
5743 pastebin(\"6VWUw78T\",\"/System/FirstStart\")\
5744 os.run(os.getEnv(),\"/System/FirstStart\")\
5745 fs.delete(\"/System/FirstStart\")\
5746 if #file==0 then\
5747 run=false\
5748 end\
5749 end\
5750 for i=1,5 do\
5751 paintutils.drawLine(1,6+i,xSize,6+i,colors.white)\
5752 end\
5753 if l_login~=nil then\
5754 local icon = fs.list(\"/System\")\
5755 for i=1,#icon do\
5756 if icon[i]==l_login..\".png\" then\
5757 image.draw(xCenter-3,7,\"/System/\"..l_login..\".png\")\
5758 end\
5759 end\
5760 end\
5761 term.setBackgroundColor(colors.lightGray)\
5762 term.setTextColor(colors.white)\
5763 text(\"Password:\",4,14)\
5764 paintutils.drawLine(13,14,xSize-3,14,colors.white)\
5765 term.setTextColor(colors.black)\
5766 text(pword,6+(xCenter-#p_password/2),14)\
5767 term.setTextColor(colors.gray)\
5768 term.setBackgroundColor(colors.lightGray)\
5769 text(intro,xCenter-#intro/2+1,3)\
5770end\
5771\
5772local pullEvent = function()\
5773\009local event, side, x, y = os.pullEventRaw()\
5774\009if event == \"terminate\" then\
5775\009\009windows.error('You can`t use \"Ctrl+T\"')\
5776\009\009redraw()\
5777\009else\
5778\009\009return event, side, x, y\
5779\009end\
5780end\
5781\
5782local running = function()\
5783 while run do\
5784 event, side, x, y = pullEvent()\
5785 if event == \"mouse_click\" then\
5786 if y>5 and y-5<=#file and pull==true then\
5787 l_login = file[y-5]\
5788 os.run(os.getEnv(),\"/System/accounts/\"..file[y-5])\
5789 pull = false\
5790 redraw()\
5791 if autoLogin == 1 then\
5792 p_password = password\
5793 clear(colors.lightGray)\
5794 log = true\
5795 run = false\
5796 end\
5797 elseif y==14 and #file~=0 then\
5798 paintutils.drawLine(3,14,xSize-3,14,colors.white)\
5799 pword = \"\"\
5800 term.setCursorPos(3,14)\
5801 term.setTextColor(colors.black)\
5802 p_password = read(string.char(7))\
5803 for i=1, #p_password do\
5804 pword = pword..string.char(7)\
5805 end\
5806 redraw()\
5807 if autoPassEnter == 1 and p_password == password then\
5808 clear(colors.lightGray)\
5809 log = true\
5810 run = false\
5811 end\
5812 elseif y==16 and #file~=0 and p_password~=\"\" then\
5813 if p_password == password then\
5814 clear(colors.lightGray)\
5815 log = true\
5816 run = false\
5817 else\
5818 term.setTextColor(colors.red)\
5819 text(\"Password:\",4,14)\
5820 paintutils.drawLine(13,14,xSize-3,14,colors.red)\
5821 term.setTextColor(colors.white)\
5822 text(\"Wrong\",6+(xCenter-3),14)\
5823 sleep(1)\
5824 redraw()\
5825 end\
5826 elseif x==xSize-5 and y==5 then\
5827 if pull == true then\
5828 pull = false\
5829 redraw()\
5830 elseif pull == false then\
5831 file = fs.list(\"/System/accounts\")\
5832 for i=1,#file do\
5833 paintutils.drawLine(6,5,xSize-5,5,colors.white)\
5834 term.setTextColor(colors.lightGray)\
5835 text(string.char(30),xSize-5,5)\
5836 text(\"...\",xCenter-3/2+1,5)\
5837 paintutils.drawLine(6,5+i,xSize-5,5+i,colors.white)\
5838 term.setTextColor(colors.black)\
5839 text(file[i],xCenter-#file[i]/2+1,5+i)\
5840 end\
5841 pull = true\
5842 end\
5843 end\
5844 end\
5845 end\
5846end\
5847\
5848redraw()\
5849running()",
5850 path = "//System/ver.sec",
5851 },
5852 {
5853 text = "os.loadAPI(\"/System/API/image\")\
5854os.loadAPI(\"/System/API/windows\")\
5855os.loadAPI(\"/System/API/zip\")\
5856os.loadAPI(\"/System/API/sysbar\")\
5857os.loadAPI(\"/System/API/contexts\")\
5858os.loadAPI(\"/System/API/vedroid\")\
5859\
5860\
5861osexit = false\
5862local xSize, ySize = term.getSize()\
5863local centerX = math.floor(xSize/2)\
5864local centerY = math.floor(ySize/2)\
5865local comp = 0\
5866if xSize > 30 then comp = 1 end\
5867appHistory = {}\
5868local appH = {}\
5869local aph = \"0\"\
5870local run = true\
5871local obj = {}\
5872local screen = 1\
5873local maxScreen = 1\
5874local deskS = 1\
5875local maxDeskS = 1\
5876local topM = \"0\"\
5877local background = colors.lightBlue\
5878local xp = 3\
5879local yp = 3 - comp\
5880local wallpapers = \"wallp.png\"\
5881local notyPos = 1\
5882local set = false\
5883if style == nil then style = colors.lightBlue end\
5884if colored == nil then colored = false end\
5885local files = {}\
5886local Napp = 0\
5887local appMenu = false\
5888local desk = {}\
5889local editMode = false\
5890local sear = nil\
5891local addMode = false\
5892local adds = 0\
5893local draw = true\
5894local env = os.getEnv()\
5895\
5896function getColors()\
5897\009\009return mainColor, mainTextCol, mainSwitchCol\
5898end\
5899\
5900local function refreshFiles()\
5901\009local sys = fs.list('/.ds/sys')\
5902\009local filis = {}\
5903\009for i=1,#sys do\
5904\009\009filis[i] = 'sys/'..sys[i]\
5905\009end\
5906\009if l_login ~= '...' and l_login~='$test' then\
5907\009\009local file = fs.list('/.ds/'..l_login)\
5908\009\009if file ~= nil then\
5909\009\009\009for i=#sys+1,#file+#sys do\
5910\009\009\009\009filis[i] = l_login..'/'..file[i-#sys]\
5911\009\009\009end\
5912\009\009end\
5913\009end\
5914\009return filis\
5915end\
5916\
5917local function saveDesk(table)\
5918\009local file = fs.open('/System/desks/'..l_login,\"w\")\
5919\009file.write(textutils.serialize(table))\
5920\009file.close()\
5921end\
5922\
5923local function refreshDesk()\
5924\009local function load(name)\
5925\009\009local file = fs.open(name,\"r\")\
5926\009\009local data = file.readAll()\
5927\009\009file.close()\
5928\009\009return textutils.unserialize(data)\
5929\009end\
5930\009desk = load('/System/desks/'..l_login)\
5931\009if editMode == false then\
5932\009\009maxDeskS = #desk\
5933\009end\
5934end\
5935\
5936local newObj = function(name,x1,y1,x2,y2)\
5937 obj[name] = {}\
5938 obj[name][\"x1\"] = x1\
5939 obj[name][\"y1\"] = y1\
5940 obj[name][\"x2\"] = x2\
5941 obj[name][\"y2\"] = y2\
5942end\
5943\
5944local pastebin = function(paste,filename)\
5945\009local file = http.get(\"http://pastebin.com/raw.php?i=\"..paste)\
5946\009if file then\
5947\009\009file = file.readAll()\
5948\009\009h=fs.open(filename,\"w\")\
5949\009\009h.write(file)\
5950\009\009h.close()\
5951\009\009return true\
5952\009else\
5953\009\009windows.attention(\"Attention!\",\"Check your Internet connection\")\
5954\009\009return false\
5955\009end\
5956end\
5957\
5958local clear = function(color)\
5959\009term.setBackgroundColor(color)\
5960\009term.clear()\
5961\009term.setCursorPos(1,1)\
5962end\
5963\
5964local usualText = function(string,xPos,yPos)\
5965\009term.setCursorPos(xPos,yPos)\
5966\009term.write(string)\
5967end\
5968\
5969local fadeX = function()\
5970 clear(colors.gray)\
5971 sleep(0.05)\
5972 clear(colors.lightGray)\
5973 sleep(0.05)\
5974 clear(colors.lightBlue)\
5975 sleep(0.05)\
5976end\
5977\
5978local drawBox = function(x1,y1,x2,y2,color1,color2,text)\
5979\009term.setTextColor(color2)\
5980\009term.setBackgroundColor(color1)\
5981\009if text == nil then\
5982\009\009text = \" \"\
5983\009end\
5984\009for i=x1, x2 do\
5985\009\009for ii=y1, y2 do\
5986\009\009\009usualText(text,i,ii)\
5987\009\009end\
5988\009end\
5989end\
5990\
5991local app = function(name,ico,x,y)\
5992\009image.draw(x,y,ico,6,4)\
5993\009newObj(name,x,y,x+5,y+3)\
5994end\
5995\
5996local drawn = function(app,text,button,y)\
5997\009for i=0,3 do\
5998\009\009paintutils.drawLine(xSize-25,y+i,xSize,y+i,colors.lightGray)\
5999\009end\
6000\009if app == 'Settings' or app == 'Store@' or app == 'Clock' then\
6001\009 image.draw(xSize-25,y,\"/.ds/sys/\"..app..\".apk/Resources/icon.png\",6,4)\
6002 elseif app == 'OS' then\
6003\009 image.draw(xSize-25,y,\"/System/osicon.png\",6,4)\
6004\009else\
6005\009 image.draw(xSize-25,y,\"/.ds/\"..l_login..'/'..app..\".apk/Resources/icon.png\",6,4)\
6006\009end\
6007\009term.setBackgroundColor(colors.lightGray)\
6008\009term.setTextColor(colors.gray)\
6009\009usualText(\"x\",xSize,y)\
6010\009usualText(button,xSize-#button+1, y+3)\
6011\009term.setTextColor(colors.white)\
6012\009usualText(text,xSize-26+8,y+1)\
6013\009newObj(app,xSize,y,xSize,y)\
6014end\
6015\
6016local getStyle = function()\
6017\009 os.run(env,\"style\")\
6018end\
6019\
6020local shutAnimation = function()\
6021\009fadeX()\
6022\009clear(colors.white)\
6023\009term.setTextColor(colors.lime)\
6024\009usualText(osLogo,centerX-math.floor(#osLogo/2),centerY+1)\
6025\009sleep(0.3)\
6026\009usualText(osLogo,centerX-math.floor(#osLogo/2)-3,centerY+1)\
6027\009term.setTextColor(colors.lightGray)\
6028\009usualText('Goodbye',centerX-math.floor(#osLogo/2)+6,centerY+1)\
6029\009sleep(0.5)\
6030end\
6031\
6032local nativeReboot = os.reboot\
6033os.reboot = function()\
6034\009shutAnimation()\
6035\009nativeReboot()\
6036\009while true do\
6037 coroutine.yield()\
6038 end\
6039end\
6040\
6041local nativeShutdown = os.shutdown\
6042os.shutdown = function()\
6043\009shutAnimation()\
6044\009nativeShutdown()\
6045 while true do\
6046 coroutine.yield()\
6047 end\
6048end\
6049\
6050local topMenu = function()\
6051\009local time = textutils.formatTime(os.time(),true)\
6052\009files = refreshFiles()\
6053\009for i=1,#files do\
6054\009\009newObj(files[i],-1,-1,-1,-1)\
6055\009end\
6056\009if comp == 0 then\
6057\009\009if noty ~= nil then\
6058\009\009\009for i=1,#noty do\
6059\009\009\009\009drawn(noty[i][\"app\"],noty[i][\"text\"],noty[i][\"button\"],4*i+notyPos)\
6060\009\009\009end\
6061\009\009end\
6062\009\009paintutils.drawLine(0,2,xSize,2,colors.gray)\
6063\009\009term.setTextColor(colors.lightGray)\
6064\009\009for i=1,4 do\
6065\009\009\009paintutils.drawLine(0,i,xSize,i,colors.gray)\
6066\009\009\009term.setTextColor(colors.white)\
6067\009\009end\
6068\009\009usualText(time,xSize-#time,1)\
6069\009\009usualText(\"Settings\",2,3)\
6070\009\009term.setTextColor(colors.lightGray)\
6071\009\009usualText(string.char(31),11,3)\
6072\009\009usualText(l_login,xSize-#l_login,3)\
6073\009\009term.setTextColor(colors.white)\
6074\009\009paintutils.drawLine(0,ySize,xSize,ySize,style)\
6075\009\009usualText(\"^^\",xSize/2,ySize)\
6076\009\009if #noty ~= 0 then\
6077\009\009\009usualText(\"Clear\",xSize-4,ySize)\
6078\009\009end\
6079\009\009newObj(\"sett\",2,3,9,3)\
6080\009\009if set==true then\
6081\009\009\009for I=4,11 do\
6082\009\009\009\009paintutils.drawLine(1,I,11,I,colors.white)\
6083\009\009\009end\
6084\009\009\009term.setTextColor(colors.gray)\
6085\009\009\009usualText(\" \"..string.char(30),10,3)\
6086\009\009\009usualText(\"Apps\",2,5)\
6087\009\009\009usualText(\"Customize\",2,6)\
6088\009\009\009usualText(\"Security\",2,7)\
6089\009\009\009usualText(\"Storage\",2,8)\
6090\009\009\009usualText(\"Update\",2,9)\
6091\009\009\009usualText(\"About\",2,10)\
6092\009\009end\
6093\009else\
6094\009\009if noty ~= nil then\
6095\009\009\009for i=1,#noty do\
6096\009\009\009\009drawn(noty[i][\"app\"],noty[i][\"text\"],noty[i][\"button\"],ySize-4*i-notyPos-1)\
6097\009\009\009end\
6098\009\009end\
6099\009\009term.setTextColor(colors.lightGray)\
6100\009\009for i=0,2 do\
6101\009\009\009paintutils.drawLine(xSize-25,ySize-i,xSize,ySize-i,colors.gray)\
6102\009\009end\
6103\009\009term.setTextColor(colors.white)\
6104\009\009usualText(time,xSize-#time-1,ySize)\
6105\009\009usualText(\"Settings\",xSize-24,ySize-1)\
6106\009\009term.setTextColor(colors.lightGray)\
6107\009\009usualText(string.char(30),xSize-15,ySize-1)\
6108\009\009usualText(l_login,xSize-#l_login,ySize-1)\
6109\009\009newObj(\"sett\",xSize-24,ySize-1,xSize-17,ySize-1)\
6110\009\009if set==true then\
6111\009\009\009for I=2,9 do\
6112\009\009\009\009paintutils.drawLine(xSize-25,ySize-I,xSize-15,ySize-I,colors.white)\
6113\009\009\009end\
6114\009\009\009term.setTextColor(colors.gray)\
6115\009\009\009usualText(\" \"..string.char(31),xSize-16,ySize-1)\
6116\009\009\009usualText(\"Apps\",xSize-24,ySize-8)\
6117\009\009\009usualText(\"Customize\",xSize-24,ySize-7)\
6118\009\009\009usualText(\"Security\",xSize-24,ySize-6)\
6119\009\009\009usualText(\"Storage\",xSize-24,ySize-5)\
6120\009\009\009usualText(\"Update\",xSize-24,ySize-4)\
6121\009\009\009usualText(\"About\",xSize-24,ySize-3)\
6122\009\009end\
6123\009end\
6124end\
6125\
6126local sysBar = function()\
6127\009local time = textutils.formatTime(os.time(),true)\
6128\009while true do\
6129\009\009local noti = #noty\
6130\009\009time = textutils.formatTime(os.time(),true)\
6131\009\009if draw and topM == \"0\" then\
6132\009\009\009sysbar.draw(style,colors.white,noty,false,true,true)\
6133\009\009elseif topM == \"1\" then\
6134\009\009\009term.setTextColor(colors.white)\
6135\009\009\009term.setBackgroundColor(colors.gray)\
6136\009\009\009if comp == 0 then\
6137\009\009\009\009usualText(time,xSize-#time,1)\
6138\009\009\009else\
6139\009\009\009\009usualText(time,xSize-#time-1,ySize)\
6140\009\009\009end\
6141\009\009end\
6142\009\009sleep(1)\
6143\009\009if float and float == 1 and noti < #noty then\
6144\009\009\009local b = term.current()\
6145\009\009\009local n = window.create(term.current(),xSize-25,1+(ySize-6)*comp+comp,26,4)\
6146\009\009\009vedroid.takeScreenshot(screenBuffer,'/local/scr.png')\
6147\009\009\009term.redirect(n)\
6148\009\009\009clear(colors.lightGray)\
6149\009\009\009if noty[#noty][\"app\"] == 'Settings' or noty[#noty][\"app\"] == 'Store@' then\
6150\009\009\009\009image.draw(11,1,\"/.ds/sys/\"..noty[#noty][\"app\"]..\".apk/Resources/icon.png\",6,4)\
6151\009\009\009else\
6152\009\009\009\009image.draw(1,1,\"/.ds/\"..l_login..'/'..noty[#noty][\"app\"]..\".apk/Resources/icon.png\",6,4)\
6153\009\009\009end\
6154\009\009\009term.setBackgroundColor(colors.lightGray)\
6155\009\009\009term.setTextColor(colors.white)\
6156\009\009\009usualText(noty[#noty][\"text\"],8,2)\
6157\009\009\009newObj(noty[#noty][\"app\"],25,1,25,1)\
6158\009\009\009term.redirect(b)\
6159\009\009\009sleep(1)\
6160\009\009\009image.draw(1,1,'/local/scr.png')\
6161\009\009\009fs.delete('/local/scr.png')\
6162\009\009\009n = nil\
6163\009\009end\
6164\009end\
6165end\
6166\
6167local appHis = function()\
6168 clear(style)\
6169 sysBar()\
6170 if appHistory == {} then usualText(\"No recent apps\",xCenter-7,yCenter) end\
6171 usualText(\"App History\",1,1)\
6172 files = refreshFiles()\
6173 for i=1,#files do\
6174 newObj(files[i],-1,-1,-1,-1)\
6175 end\
6176 term.setTextColor(colors.black)\
6177 term.setBackgroundColor(colors.white)\
6178 for i=1,#appHistory do\
6179 if appHistory[i] == appHistory[i+1] then\
6180 for ii=i,#appHistory do\
6181 appHistory[ii] = appHistory[ii+1]\
6182 end\
6183 end\
6184 end\
6185 for i=1,#appHistory do\
6186 paintutils.drawLine(1,i*2+1,xSize,i*2+1,colors.white)\
6187 usualText(\"x\",xSize,i*2+1)\
6188 usualText(appHistory[i],1,i*2+1)\
6189 usualText(\" \",#appHistory[i]-3,i*2+1)\
6190 newObj(appHistory[i],1,i*2+1,#appHistory[i],i*2+1)\
6191 end\
6192end\
6193\
6194local function redraw()\
6195\009if l_login ~= '...' and (l_login == nil or l_login == '') then\
6196\009\009pastebin(\"AH3k8DMa\",\"ver\")\
6197\009\009os.run(env,'ver')\
6198\009end\
6199\009if colored == 1 then\
6200\009\009mainColor = style\
6201\009\009mainSwitchCol = style\
6202\009\009mainTextCol = colors.white\
6203\009else\
6204\009\009mainColor = colors.lightGray\
6205\009\009mainSwitchCol = colors.lightBlue\
6206\009\009mainTextCol = colors.gray\
6207\009end\
6208\009set=false\
6209\009clear(style)\
6210\009wallp = false\
6211\009local file = fs.list(\"/System\")\
6212\009for i=1,#file do\
6213\009\009if file[i] == wallpapers then\
6214\009\009\009wallp = true\
6215\009\009end\
6216\009end\
6217\
6218\009if wallp then\
6219\009\009image.draw(1,2-comp,\"/System/\"..wallpapers)\
6220\009end\
6221\
6222\009newObj(\"sett\",-2,-2,-2,-2)\
6223\
6224\009if appMenu then\
6225\
6226\009\009paintutils.drawLine(3,2-comp,xSize-2,2-comp,colors.white)\
6227\
6228\009\009for i=1,maxScreen do\
6229\009\009\009term.setTextColor(colors.lightGray)\
6230\009\009\009usualText(string.char(7),xSize+i-maxScreen-4,2-comp)\
6231\009\009\009term.setTextColor(style)\
6232\009\009\009usualText(string.char(7),xSize+screen-maxScreen-4,2-comp)\
6233\009\009end\
6234\009\009usualText(string.char(30),xSize-2,2-comp)\
6235\
6236\009\009drawBox(3,3-comp,xSize-2,math.floor(ySize/(6-comp))*6-comp,colors.white,style,string.char(127))\
6237\009\009if sear == nil then\
6238\009\009\009files = refreshFiles()\
6239\009\009end\
6240\009\009maxScreen = 1 + math.floor(#files/(math.floor(xSize/8)*math.floor((ySize)/(6-comp))))\
6241\009\009xp=3\
6242\009\009yp=4 - comp\
6243\009\009Napp = (screen-1)*(math.floor(xSize/8)*math.floor((ySize)/(6-comp)))+1\
6244\
6245\009\009for i=1,math.floor(ySize/(6-comp)) do\
6246\009\009\009for ii=1,math.floor(xSize/(8)) do\
6247\009\009\009\009if files[Napp] ~= nil then\
6248\009\009\009\009\009if fs.exists(\"/.ds/\"..files[Napp]..\"/Resources/icon.png\") then\
6249\009\009\009\009\009\009app(files[Napp],\"/.ds/\"..files[Napp]..\"/Resources/icon.png\",xp,yp)\
6250\009\009\009\009\009else\
6251\009\009\009\009\009\009app(files[Napp],\"/System/noico.png\",xp,yp)\
6252\009\009\009\009\009end\
6253\009\009\009\009\009if addMode == true then\
6254\009\009\009\009\009\009usualText('+',xp,yp)\
6255\009\009\009\009\009end\
6256\009\009\009\009\009Napp = Napp + 1\
6257\009\009\009\009\009xp = xp + 8\
6258\009\009\009\009else\
6259\009\009\009\009\009break\
6260\009\009\009\009end\
6261\009\009\009end\
6262\009\009\009yp = yp + 5\
6263\009\009\009xp = 3\
6264\009\009end\
6265\009else\
6266\009\009addMode = false\
6267\009\009adds = 0\
6268\009\009sear = nil\
6269\009\009if l_login~='$test' then\
6270\009\009\009refreshDesk()\
6271\009\009\009if desk[deskS] ~= nil then\
6272\009\009\009\009for i=1,#desk[deskS] do\
6273\009\009\009\009\009if desk[deskS][i] ~= nil then\
6274\009\009\009\009\009\009if fs.exists(\"/.ds/\"..desk[deskS][i]['name']..\"/Resources/icon.png\") then\
6275\009\009\009\009\009\009\009app(desk[deskS][i]['name'],\"/.ds/\"..desk[deskS][i]['name']..\"/Resources/icon.png\",desk[deskS][i]['x'],desk[deskS][i]['y'])\
6276\009\009\009\009\009\009else\
6277\009\009\009\009\009\009\009if fs.exists(\"/.ds/\"..desk[deskS][i]['name']) then\
6278\009\009\009\009\009\009\009\009app(desk[deskS][i]['name'],\"/System/noico.png\",desk[deskS][i]['x'],desk[deskS][i]['y'])\
6279\009\009\009\009\009\009\009else\
6280\009\009\009\009\009\009\009\009for ii=i,#desk[deskS]-1 do\
6281\009\009\009\009\009\009\009\009\009desk[deskS][ii]=desk[deskS][ii+1]\
6282\009\009\009\009\009\009\009\009end\
6283\009\009\009\009\009\009\009\009desk[deskS][#desk[deskS]] = nil\
6284\009\009\009\009\009\009\009\009saveDesk(desk)\
6285\009\009\009\009\009\009\009\009refreshDesk()\
6286\009\009\009\009\009\009\009\009redraw()\
6287\009\009\009\009\009\009\009\009break\
6288\009\009\009\009\009\009\009end\
6289\009\009\009\009\009\009end\
6290\009\009\009\009\009end\
6291\009\009\009\009end\
6292\009\009\009end\
6293\009\009end\
6294\009\009paintutils.drawLine(3,2-comp,xSize-2,2-comp,colors.white)\
6295\009\009term.setTextColor(colors.lightGray)\
6296\009\009usualText(string.char(31),xSize-2,2-comp)\
6297\009\009for i=1,maxDeskS do\
6298\009\009\009term.setTextColor(colors.lightGray)\
6299\009\009\009usualText(string.char(7),xSize+i-maxDeskS-4,2-comp)\
6300\009\009\009term.setTextColor(style)\
6301\009\009\009usualText(string.char(7),xSize+deskS-maxDeskS-4,2-comp)\
6302\009\009end\
6303\009end\
6304\009term.setTextColor(colors.lightGray)\
6305\009term.setBackgroundColor(colors.white)\
6306\009if editMode == false then\
6307\009\009draw = true\
6308\009\009if sear then\
6309\009\009\009usualText(sear,4,2-comp)\
6310\009\009else\
6311\009\009\009usualText('Search',4,2-comp)\
6312\009\009end\
6313\009else\
6314\009\009draw = false\
6315\009\009usualText('Apply',4,2-comp)\
6316\009\009usualText('+',xSize-2,2-comp)\
6317\009\009term.setTextColor(colors.red)\
6318\009\009if maxDeskS > 0 then\
6319\009\009\009usualText('x',xSize-maxDeskS-5,2-comp)\
6320\009\009end\
6321\009\009if deskS > 1 then\
6322\009\009\009drawBox(1,3-comp,1,ySize-2,style,colors.white,string.char(127))\
6323\009\009end\
6324\009\009drawBox(xSize,3-comp,xSize,ySize-2,style,colors.white,string.char(127))\
6325\009end\
6326\009if draw then\
6327\009\009sysbar.draw(style,colors.white,noty,false,true,true)\
6328\009end\
6329end\
6330\
6331function runApp(app,args)\
6332\009fadeX()\
6333\009--local stockDir = shell.dir()\
6334\009--shell.setDir('/'..string.sub(shell.getRunningProgram(),1,#shell.getRunningProgram()-#fs.getName(shell.getRunningProgram())-1))\
6335\009local error = os.run(env,app,args)\
6336\009term.redirect(term.native())\
6337\009--shell.setDir(stockDir)\
6338\009fadeX()\
6339\009if error ~= nil then\
6340\009\009redraw()\
6341\009\009windows.error(error)\
6342\009end\
6343end\
6344\
6345os.pullEvent = function()\
6346\009local event, side, x, y = os.pullEventRaw()\
6347\009if event ~= \"terminate\" then\
6348\009\009return event, side, x, y\
6349\009end\
6350end\
6351\
6352local running = function()\
6353 while run == true and osexit == false do\
6354 if home == true then\
6355 home = false\
6356 end\
6357\
6358 if l_login ~= '...' and (l_login == nil or l_login == '') then\
6359\009pastebin(\"AH3k8DMa\",\"ver\")\
6360\009os.run(env,'ver')\
6361 end\
6362\
6363 event, side, x, y = os.pullEvent()\
6364\
6365 if event == \"mouse_scroll\" then\
6366 if side == 1 then\
6367 if topM==\"0\" then\
6368 if appMenu == true then\
6369 screen = screen+1\
6370 if screen > maxScreen then\
6371 screen = maxScreen\
6372 else\
6373 clear(colors.lightBlue)\
6374 redraw()\
6375 end\
6376\009 else\
6377\009 deskS = deskS+1\
6378 if deskS > maxDeskS then\
6379 deskS = maxDeskS\
6380 else\
6381 clear(colors.lightBlue)\
6382 redraw()\
6383 end\
6384\009 end\
6385 elseif topM==\"1\" and #noty*4+4+notyPos-comp*2>ySize then\
6386 notyPos=notyPos-1\
6387 topMenu()\
6388 end\
6389 elseif side == -1 then\
6390 if topM==\"0\" then\
6391 if appMenu == true then\
6392 screen = screen-1\
6393 if screen < 1 then\
6394 screen = 1\
6395 else\
6396 clear(colors.lightBlue)\
6397 redraw()\
6398 end\
6399\009 else\
6400\009 deskS = deskS-1\
6401 if deskS < 1 then\
6402 deskS = 1\
6403 else\
6404 clear(colors.lightBlue)\
6405 redraw()\
6406 end\
6407\009 end\
6408 elseif topM==\"1\" and #noty*4+5>ySize and notyPos<1 then\
6409 notyPos=notyPos+1\
6410 topMenu()\
6411 end\
6412 end\
6413\
6414 elseif event == \"key\" then\
6415 if side == 205 and topM==\"0\" then\
6416 if appMenu == true then\
6417 screen = screen+1\
6418 if screen > maxScreen then\
6419 screen = maxScreen\
6420 else\
6421 clear(colors.lightBlue)\
6422 redraw()\
6423 end\
6424\009else\
6425\009 deskS = deskS+1\
6426 if deskS > maxDeskS then\
6427 deskS = maxDeskS\
6428 else\
6429 clear(colors.lightBlue)\
6430 redraw()\
6431 end\
6432\009end\
6433 elseif side == 203 and topM==\"0\" then\
6434 if appMenu == true then\
6435 screen = screen-1\
6436 if screen < 1 then\
6437 screen = 1\
6438 else\
6439 clear(colors.lightBlue)\
6440 redraw()\
6441 end\
6442\009else\
6443\009 deskS = deskS-1\
6444 if deskS < 1 then\
6445 deskS = 1\
6446 else\
6447 clear(colors.lightBlue)\
6448 redraw()\
6449 end\
6450\009end\
6451 end\
6452\
6453 elseif event == \"mouse_click\" then\
6454 draw = false\
6455 if sysbar.notifyCheck(x,y) and topM == \"0\" then\
6456 topM = \"1\"\
6457 topMenu()\
6458 elseif (sysbar.back(x,y) or (x>=3 and x <=9 and y == 2-comp)) and editMode and topM == '0' then\
6459\009editMode = false\
6460\009redraw()\
6461 elseif sysbar.back(x,y) and editMode == false and topM == '0' then\
6462 if sear then\
6463 sear = nil\
6464\009elseif addMode == true then\
6465\009 addMode = false\
6466\009elseif appMenu then\
6467\009 appMenu = false\
6468\009end\
6469\009redraw()\
6470 elseif x>=xSize-3 and x<=xSize-2 and editMode and y == 2-comp then\
6471 maxDeskS = maxDeskS + 1\
6472\009desk[maxDeskS] = {}\
6473\009deskS = maxDeskS\
6474\009saveDesk(desk)\
6475\009redraw()\
6476 elseif x==xSize-maxDeskS-5 and editMode and y == 2-comp then\
6477\009if deskS < maxDeskS then\
6478\009 for i=deskS,maxDeskS do\
6479\009 desk[i]=desk[i+1]\
6480\009 end\
6481\009end\
6482\009desk[maxDeskS] = nil\
6483\009maxDeskS = maxDeskS - 1\
6484\009if deskS>maxDeskS then\
6485\009 deskS = deskS-1\
6486\009end\
6487\009saveDesk(desk)\
6488\009redraw()\
6489 elseif sysbar.home(x,y) and topM == '0' then\
6490\009editMode = false\
6491\009deskS = 1\
6492\009appMenu = false\
6493\009sear = nil\
6494\009redraw()\
6495 elseif editMode == true then\
6496 local select = 0\
6497\009local bx = 0\
6498\009local by = 0\
6499 refreshDesk()\
6500\009if #desk > 0 then\
6501\009 for i=1,#desk[deskS] do\
6502\009 if x>=obj[desk[deskS][i]['name']][\"x1\"] and x<=obj[desk[deskS][i]['name']][\"x2\"] and y>=obj[desk[deskS][i]['name']][\"y1\"] and y<=obj[desk[deskS][i]['name']][\"y2\"] then\
6503\009 select = i\
6504\009 bx = desk[deskS][select]['x']\
6505\009 by = desk[deskS][select]['y']\
6506\009 end\
6507\009 end\
6508\009end\
6509\009if select ~= 0 then\
6510\009 while true do\
6511\009 local eve, si, xt, yt = os.pullEvent()\
6512\009 if eve == \"mouse_drag\" then\
6513\009 if yt>=3 and yt<=ySize-6+comp then\
6514\009 desk[deskS][select]['x']=xt\
6515\009 desk[deskS][select]['y']=yt\
6516\009\009if xt>=xSize-1 then\
6517\009 deskS = deskS+1\
6518 if deskS > maxDeskS then\
6519\009\009 maxDeskS = maxDeskS + 1\
6520 deskS = maxDeskS\
6521\009\009 desk[maxDeskS] = {}\
6522\009\009 desk[deskS-1][select]['x']=4\
6523\009\009 desk[deskS][#desk[deskS]+1] = desk[deskS-1][select]\
6524\009\009 desk[deskS-1][select] = nil\
6525\009\009 saveDesk(desk)\
6526\009\009 redraw()\
6527\009\009 break\
6528 else\
6529\009\009 desk[deskS-1][select]['x']=3\
6530\009\009 desk[deskS][#desk[deskS]+1] = desk[deskS-1][select]\
6531\009\009 desk[deskS-1][select] = nil\
6532 clear(colors.lightBlue)\
6533\009\009 select = #desk[deskS]\
6534\009\009 saveDesk(desk)\
6535\009\009 redraw()\
6536\009\009 break\
6537 end\
6538\009\009elseif xt<=2 then\
6539\009\009 deskS = deskS-1\
6540 if deskS < 1 then\
6541 deskS = 1\
6542 else\
6543\009\009 desk[deskS+1][select]['x']=math.floor((xSize/8)*8-8)\
6544\009\009 desk[deskS][#desk[deskS]+1] = desk[deskS+1][select]\
6545\009\009 desk[deskS+1][select] = nil\
6546 clear(colors.lightBlue)\
6547\009\009 select = #desk[deskS]\
6548\009\009 saveDesk(desk)\
6549\009\009 redraw()\
6550\009\009 break\
6551 end\
6552\009\009end\
6553\009\009saveDesk(desk)\
6554\009 redraw()\
6555\009 end\
6556\009 elseif eve == \"mouse_scroll\" then\
6557 if si == 1 then\
6558\009 deskS = deskS+1\
6559 if deskS > maxDeskS then\
6560 deskS = maxDeskS\
6561 else\
6562\009\009 desk[deskS][#desk[deskS]+1] = desk[deskS-1][select]\
6563\009\009 saveDesk(desk)\
6564\009\009 select = #desk[deskS]\
6565 clear(colors.lightBlue)\
6566 redraw()\
6567 end\
6568 elseif si == -1 then\
6569\009 deskS = deskS-1\
6570 if deskS < 1 then\
6571 deskS = 1\
6572 else\
6573\009\009 desk[deskS][#desk[deskS]+1] = desk[deskS+1][select]\
6574\009\009 saveDesk(desk)\
6575\009\009 select = #desk[deskS]\
6576 clear(colors.lightBlue)\
6577 redraw()\
6578 end\
6579\009 end\
6580\009 elseif eve == \"mouse_up\" then\
6581\009 for i=1,math.floor(xSize/8) do\
6582\009\009if (xt-(i*8-5) > 0 and xt-(i*8-5) < 7) or (xt-(i*8-5) < 0 and xt-(i*8-5) > -7) then\
6583\009\009 desk[deskS][select]['x']=i*8-5\
6584\009\009end\
6585\009 end\
6586\009 for i=1,math.floor(ySize/6) do\
6587\009\009if (yt-(i*5-(6-comp*4)) > 0 and yt-(i*5-(6-comp*4)) < 5) or (yt-(i*5-(6-comp*4)) < 0 and yt-(i*5-(6-comp*4)) > -5) then\
6588\009\009 desk[deskS][select]['y']=i*5-(6-comp*4)\
6589\009\009end\
6590\009 end\
6591\009 for i=1,#desk[deskS] do\
6592\009 if desk[deskS][select]['x']==desk[deskS][i]['x'] and desk[deskS][select]['y']==desk[deskS][i]['y'] and i~=select then\
6593\009\009 desk[deskS][i]['x'] = bx\
6594\009\009 desk[deskS][i]['y'] = by\
6595\009\009end\
6596\009 end\
6597\009 saveDesk(desk)\
6598\009 redraw()\
6599\009 select = 0\
6600\009 break\
6601\009 end\
6602\009 end\
6603\009end\
6604 elseif x==xSize and y==ySize and topM == '0' then\
6605 term.setBackgroundColor(colors.gray)\
6606 term.setTextColor(colors.lightGray)\
6607 usualText(\"|\",xSize,ySize)\
6608 term.setTextColor(colors.white)\
6609\009local budka = ''\
6610\009if appMenu == true then\
6611\009 local a = \"Add to desktop\"\
6612\009 if addMode then a = \"Apply\" end\
6613\009 budka = contexts.main(x,y-1,a,\"Shutdown\",\"Reboot\",\"Wallpapers\")\
6614\009else\
6615\009 budka = contexts.main(x,y-1,\"Edit desktop\",\"Shutdown\",\"Reboot\",\"Wallpapers\")\
6616\009end\
6617 if budka == \"Shutdown\" then\
6618\009 os.shutdown()\
6619\009elseif budka == \"Reboot\" then\
6620\009 os.reboot()\
6621\009elseif budka == \"Wallpapers\" then\
6622\009 redraw()\
6623\009 files = refreshFiles()\
6624\009 local find = false\
6625 for i=1,#files do if files[i]==l_login..\"/ImageViewer.apk\" then find = true end end\
6626\009 if find then\
6627\009 os.run(env,\"/.ds/\"..l_login..\"/ImageViewer.apk/main\")\
6628\009 else\
6629\009 local but = windows.select({\"ImageViewer not found\"},{\"Install it?\"},{\"Yes\",colors.lightBlue,colors.white},{\"No\",colors.gray,colors.white})\
6630\009 if but == 'Yes' then\
6631\009 os.run(env,\"/.ds/sys/Store@.apk/main\")\
6632\009 end\
6633\009 redraw()\
6634\009 end\
6635 redraw()\
6636 topM=\"0\"\
6637\009elseif budka == \"Add to desktop\" and l_login~='$test' then\
6638\009 addMode = true\
6639\009 redraw()\
6640\009elseif budka == \"Apply\" then\
6641\009 addMode = false\
6642\009 redraw()\
6643\009elseif budka == \"Edit desktop\" and l_login~='$test' then\
6644\009 editMode = true\
6645\009 redraw()\
6646\009elseif budka == nil then\
6647\009 redraw()\
6648\009end\
6649 elseif x>=obj[\"sett\"][\"x1\"] and x<=obj[\"sett\"][\"x2\"] and y>=obj[\"sett\"][\"y1\"] and y<=obj[\"sett\"][\"y2\"] and topM == \"1\" then\
6650 topM = \"0\"\
6651 os.run(env,\"/System/prog/settings\")\
6652 redraw()\
6653 elseif x>=xSize-#l_login and ((y==3 and comp == 0 ) or (y==ySize-1 and comp == 1))and topM==\"1\" then\
6654 log = false\
6655 l_login = \"...\"\
6656 os.run(env,\"/ver\")\
6657 topM=\"0\"\
6658\009files = refreshFiles()\
6659 redraw()\
6660 elseif (((x>=10 and x<=11 and y==3) and comp == 0) or ((x>=xSize-16 and x<=xSize-15 and y==ySize-1) and comp == 1)) and topM==\"1\" and set==false then\
6661 set=true\
6662 topMenu()\
6663 elseif topM==\"1\" and set==true then\
6664 if ((y==5 and comp == 0) or (y==ySize-8 and comp == 1)) and ((x<=11 and comp == 0) or (x<=xSize-15 and x>=xSize-25 and comp == 1)) then\
6665\009\009topM = '0'\
6666\009\009paintutils.drawLine(1,1,xSize,1,colors.lightGray)\
6667\009\009os.run(env,\"/System/prog/applications\")\
6668\009\009redraw()\
6669 elseif ((y==6 and comp == 0) or (y==ySize-7 and comp == 1)) and ((x<=11 and comp == 0) or (x<=xSize-15 and x>=xSize-25 and comp == 1)) then\
6670\009\009topM = '0'\
6671\009\009paintutils.drawLine(1,1,xSize,1,colors.lightGray)\
6672\009\009os.run(env,\"/System/prog/style\")\
6673\009\009redraw()\
6674 elseif ((y==7 and comp == 0) or (y==ySize-6 and comp == 1)) and ((x<=11 and comp == 0) or (x<=xSize-15 and x>=xSize-25 and comp == 1)) then\
6675\009\009topM = '0'\
6676\009\009paintutils.drawLine(1,1,xSize,1,colors.lightGray)\
6677\009\009os.run(env,\"/System/prog/security\")\
6678\009\009redraw()\
6679 elseif ((y==8 and comp == 0) or (y==ySize-5 and comp == 1)) and ((x<=11 and comp == 0) or (x<=xSize-15 and x>=xSize-25 and comp == 1)) then\
6680\009\009topM = '0'\
6681\009\009paintutils.drawLine(1,1,xSize,1,colors.lightGray)\
6682\009\009os.run(env,\"/System/prog/storage\")\
6683\009\009redraw()\
6684 elseif ((y==9 and comp == 0) or (y==ySize-4 and comp == 1)) and ((x<=11 and comp == 0) or (x<=xSize-15 and x>=xSize-25 and comp == 1)) then\
6685\009\009topM = '0'\
6686\009\009paintutils.drawLine(1,1,xSize,1,colors.lightGray)\
6687\009\009os.run(env,\"/System/prog/update\")\
6688\009\009redraw()\
6689 elseif ((y==10 and comp == 0) or (y==ySize-3 and comp == 1)) and ((x<=11 and comp == 0) or (x<=xSize-15 and x>=xSize-25 and comp == 1)) then\
6690\009\009topM = '0'\
6691\009\009paintutils.drawLine(1,1,xSize,1,colors.lightGray)\
6692\009\009os.run(env,\"/System/prog/about\")\
6693\009\009redraw()\
6694 else\
6695\009\009redraw()\
6696\009\009topM=\"1\"\
6697\009\009topMenu()\
6698 end\
6699 if ((y>=5 or y<=10) and comp == 0) or ((y>=ySize-2 or y<=ySize-10) and comp == 1) and x<=11 then\
6700 topM=\"0\"\
6701 redraw()\
6702 end\
6703 elseif x>=xSize-4 and x<=xSize and y==ySize and topM==\"1\" then\
6704 noty = {}\
6705 redraw()\
6706 topM=\"0\"\
6707 elseif x>=1 and x<=xSize and y==ySize and topM==\"1\" then\
6708 redraw()\
6709 topM = \"0\"\
6710 notyPos=1\
6711 elseif x>=3 and x<=xSize-4 and y==2-comp and topM==\"0\" then\
6712 if appMenu then\
6713\009\009screen = 1\
6714\009\009sear = nil\
6715\009\009sear = sysbar.search(\"*\",false,true)\
6716\009\009if sear then\
6717\009\009\009local file = refreshFiles()\
6718\009\009\009files = {}\
6719\009\009\009local ii=1\
6720\009\009\009for i=1,#file do\
6721\009\009\009\009if (string.find(file[i],sear) ~= nil) and (string.find(file[i],sear) < #file[i]-3) then\
6722\009\009\009\009\009files[ii]=file[i]\
6723\009\009\009\009\009ii=ii+1\
6724\009\009\009\009end\
6725\009\009\009end\
6726\009\009end\
6727\009else\
6728\009\009local op = sysbar.search(\"*\",true)\
6729\009\009if op~=nil and fs.isDir(op)==false then\
6730\009\009\009os.run(env,op)\
6731\009\009end\
6732\009end\
6733\009redraw()\
6734 elseif x==xSize-2 and y==2-comp then\
6735 if appMenu == true then\
6736\009 appMenu = false\
6737\009 redraw()\
6738\009else\
6739\009 appMenu = true\
6740\009 redraw()\
6741\009end\
6742 else\
6743 if side == 1 then\
6744\009 if appMenu then\
6745 for i=(screen-1)*(math.floor(xSize/8)*math.floor((ySize)/(6-comp)))+1,Napp-1 do\
6746 if x>=obj[files[i]][\"x1\"] and x<=obj[files[i]][\"x2\"] and y>=obj[files[i]][\"y1\"] and y<=obj[files[i]][\"y2\"] then\
6747 if appHistory ~= nil then\
6748 appHistory[#appHistory+1]=files[i]\
6749 else\
6750 appHistory[1]=files[i]\
6751 end\
6752 for ii=1,#files do\
6753 newObj(files[ii],-1,-1,-1,-1)\
6754 end\
6755\009\009if addMode == true then\
6756\009\009 if #desk < 1 then\
6757\009\009 desk[1] = {}\
6758\009\009 deskS = 1\
6759\009\009 end\
6760\009\009 desk[deskS][#desk[deskS]+1] = {}\
6761\009\009 desk[deskS][#desk[deskS]]['name']=files[i]\
6762\009\009 desk[deskS][#desk[deskS]]['x']=3+adds\
6763\009\009 desk[deskS][#desk[deskS]]['y']=ySize-6\
6764\009\009 adds = adds + 2\
6765\009\009 saveDesk(desk)\
6766\009\009 if math.floor(adds/2) > math.floor(xSize/8)-1 then\
6767\009\009 adds = 0\
6768\009\009 appMenu = false\
6769\009\009 addMode = false\
6770\009\009 end\
6771\009\009 redraw()\
6772\009\009else\
6773\009\009 topM=\"0\"\
6774\009\009 screen = 1\
6775\009\009 appMenu = false\
6776\009\009 clear(colors.black)\
6777 runApp(\"/.ds/\"..files[i]..\"/main\")\
6778\009\009 break\
6779\009\009end\
6780 end\
6781 end\
6782\009 redraw()\
6783\009 elseif appMenu == false and #desk > 0 and l_login~='$test' then\
6784\009 refreshDesk()\
6785\009 for i=1,#desk[deskS] do\
6786\009 if x>=obj[desk[deskS][i]['name']][\"x1\"] and x<=obj[desk[deskS][i]['name']][\"x2\"] and y>=obj[desk[deskS][i]['name']][\"y1\"] and y<=obj[desk[deskS][i]['name']][\"y2\"] then\
6787 clear(colors.black)\
6788 if appHistory ~= nil then\
6789 appHistory[#appHistory+1]=desk[deskS][i]['name']\
6790 else\
6791 appHistory[1]=desk[deskS][i]['name']\
6792 end\
6793 topM=\"0\"\
6794\009\009clear(colors.black)\
6795 runApp(\"/.ds/\"..desk[deskS][i]['name']..\"/main\")\
6796\009\009break\
6797 end\
6798\009 end\
6799\009 redraw()\
6800 end\
6801 for i=1,#noty do\
6802 if x>=xSize-#noty[i][\"button\"]+1 and x<=xSize-1 and ((y==4*i+notyPos+3 and comp == 0) or (y==ySize-(4*i+notyPos)+2 and comp == 1)) and topM == \"1\" then\
6803 clear(colors.black)\
6804\009 topM=\"0\"\
6805\009 if noty[i][\"app\"] == 'Settings' or noty[i][\"app\"] == 'Store@' or noty[i][\"app\"] == 'Clock' then\
6806\009 runApp(\"/.ds/sys/\"..noty[i][\"app\"]..\".apk/main\",noty[i][\"arg\"])\
6807\009 else\
6808 runApp(\"/.ds/\"..l_login..\"/\"..noty[i][\"app\"]..\".apk/main\",noty[i][\"arg\"])\
6809\009 end\
6810 if noty[i+1] ~= nil then\
6811 for i=i,#noty do\
6812 noty[i] = noty[i+1]\
6813 end\
6814 else\
6815 noty[i] = nil\
6816 end\
6817 redraw()\
6818 break\
6819 elseif x==xSize and ((y==4*i+notyPos and comp == 0) or (y==ySize-(4*i+notyPos+1) and comp == 1)) and topM == \"1\" then\
6820 if noty[i+1] ~= nil then\
6821 for i=i,#noty do\
6822 noty[i] = noty[i+1]\
6823 end\
6824 else\
6825 noty[i] = nil\
6826 end\
6827 if notyPos<-3 then\
6828 notyPos=notyPos+4\
6829 else\
6830 notyPos=1\
6831 redraw()\
6832 end\
6833 topMenu()\
6834 break\
6835 end\
6836 end\
6837 for i=1,#appHistory do\
6838 if x==xSize and y==i*2+1 and aph == \"1\" then\
6839 if appHistory[i+1] ~= nil then\
6840 for ii=i,#appHistory do\
6841 appHistory[ii] = appHistory[ii+1]\
6842 end\
6843 else\
6844 appHistory[i] = nil\
6845 end\
6846 appHis()\
6847 break\
6848 end\
6849 end\
6850 end\
6851 end\
6852 draw = true\
6853 end\
6854 --sysbar.draw(style,colors.white,noty,false,true)\
6855 if topM == \"1\" then\
6856 topMenu()\
6857 end\
6858 end\
6859end\
6860\
6861local start = function()\
6862\009 redraw()\
6863\009 running()\
6864end\
6865\
6866fadeX()\
6867clear(colors.white)\
6868term.setTextColor(colors.lightGray)\
6869usualText('Gapple',centerX-4,centerY-1)\
6870term.setTextColor(colors.lime)\
6871usualText('OS',centerX+3,centerY-1)\
6872usualText(osLogo,centerX-math.floor(#osLogo/2),centerY+6)\
6873usualText(\".\",centerX,ySize-1)\
6874local web = pastebin(\"k76zCe9r\",\"/System/ver.sec\")\
6875if not web then\
6876\009term.setBackgroundColor(colors.white)\
6877end\
6878sleep(0.1)\
6879usualText(\"..\",centerX,ySize-1)\
6880sleep(0.1)\
6881usualText(\"...\",centerX-1,ySize-1)\
6882sleep(0.1)\
6883os.run(os.getEnv(),\"/System/ver.sec\")\
6884if l_login == '...' then l_login = '$test' end\
6885local f = fs.list('/.ds')\
6886local find = false\
6887if #f ~= nil then\
6888\009for i=1, #f do\
6889\009\009if f[i] ~= nil and f[i] == l_login then find = true end\
6890\009end\
6891end\
6892if find == false and l_login ~= '...' then\
6893\009fs.makeDir('/.ds/'..l_login)\
6894else\
6895\009os.run(os.getEnv(),\"/System/accounts/\"..l_login)\
6896end\
6897find = false\
6898local f = fs.list('/System/desks')\
6899for i=1, #f do\
6900\009if f[i] == l_login then find = true end\
6901end\
6902if find == false then\
6903\009fs.makeDir('/System/desks')\
6904\009local desk = {}\
6905\009desk[1] = {}\
6906\009desk[1][1] = {}\
6907\009desk[1][1]['name']='sys/Store@.apk'\
6908\009desk[1][1]['x']=3\
6909\009desk[1][1]['y']=ySize-6\
6910\009local file = fs.open('/System/desks/'..l_login,\"w\")\
6911\009file.write(textutils.serialize(desk))\
6912\009file.close()\
6913end\
6914f = nil\
6915find = nil\
6916\
6917clear(colors.white)\
6918local workPath = \"/.ds/\"..l_login\
6919parallel.waitForAny(sysBar,start)\
6920fadeX()\
6921clear(colors.black)",
6922 path = "//launcher",
6923 },
6924 {
6925 text = "--term = window.create(term.current(),1,1,25,26)\
6926term.setBackgroundColor(colors.black)\
6927term.clear()\
6928local sleepTime = 0\
6929\
6930term.write('Loading API: ')\
6931os.loadAPI(\"/System/API/vedroid\")\
6932os.loadAPI(\"/System/API/windows\")\
6933os.loadAPI(\"/System/API/image\")\
6934term.setTextColor(colors.green)\
6935print('DONE')\
6936sleep(sleepTime)\
6937\
6938term.setTextColor(colors.white)\
6939term.write('Getting OS versions: ')\
6940local version = vedroid.getOSversion()\
6941local lastVer = vedroid.lastOSversion()\
6942local xSize, ySize = term.getSize()\
6943local noty = {}\
6944local access = 1\
6945local oldRun = shell\
6946term.setBackgroundColor(colors.black)\
6947term.setTextColor(colors.white)\
6948term.setCursorPos(22,3)\
6949term.write(version..' ')\
6950term.setTextColor(colors.green)\
6951print('DONE')\
6952sleep(sleepTime)\
6953\
6954os.getAccess = function()\
6955 return access\
6956end\
6957\
6958if lastVer ~= 'nil' and version < lastVer then\
6959 noty = {\
6960 {[\"app\"]=\"Settings\", [\"text\"]=\"You have an update\", [\"button\"]=\" Update \", ['arg']='update', ['ico']=string.char(24)}\
6961 }\
6962end\
6963\
6964oldOpen = fs.open\
6965oldDel = fs.delete\
6966oldCopy = fs.copy\
6967oldMove = fs.move\
6968oldMkdir = fs.makeDir\
6969\
6970term.setTextColor(colors.white)\
6971term.write('Setting up environment: ')\
6972local env = {\
6973 [\"mainColor\"] = colors.lightGray,\
6974 [\"mainTextCol\"] = colors.gray,\
6975 [\"mainSwitchCol\"] = colors.lightBlue,\
6976 [\"style\"] = style,\
6977 [\"colored\"] = colored,\
6978 [\"float\"] = float,\
6979 [\"autoPassEnter\"] = autoPassEnter,\
6980 [\"autoLogin\"] = autoLogin,\
6981 [\"password\"] = password,\
6982 [\"noty\"] = noty,\
6983 [\"wifi\"] = \"off\",\
6984 [\"log\"] = false,\
6985 [\"l_login\"] = l_login,\
6986 [\"version\"] = version,\
6987 [\"lastVer\"] = lastVer,\
6988 [\"home\"] = false,\
6989 [\"wallp\"] = false,\
6990 [\"osName\"] = 'Gapple mOS',\
6991 [\"osLogo\"] = '| '..string.char(7)..' ^ '..string.char(7)..' |',\
6992 --[\"access\"] = 1,\
6993 [\"shell\"] = oldRun,\
6994\009 ['screenBuffer'] = {},\
6995 [\"term\"] = term,\
6996}\
6997\
6998os.getEnv = function()\
6999 return env\
7000end\
7001\
7002function os.run( _tEnv, _sPath, ... )\
7003 local oldAccs = access\
7004 if string.find(_sPath,'/sys') or string.find(_sPath,'System') or _sPath == 'launcher' then\
7005 access = 1\
7006 else\
7007 access = 3\
7008 end\
7009 local tArgs = { ... }\
7010 local tEnv = _tEnv\
7011 setmetatable( tEnv, { __index = _G } )\
7012 local fnFile, err = loadfile( _sPath, tEnv )\
7013 if fnFile then\
7014 local ok, err = pcall( function()\
7015 fnFile( table.unpack( tArgs ) )\
7016 end )\
7017 if not ok then\
7018 if err and err ~= \"\" then\
7019 printError( err )\
7020 end\
7021 return err\
7022 end\
7023 return nil\
7024 end\
7025 if err and err ~= \"\" then\
7026 printError( err )\
7027 end\
7028 access = oldAccs\
7029 return err\
7030end\
7031\
7032--local env = envs\
7033--env[\"env\"] = envs\
7034\
7035wrt = term.write\
7036clr = term.clear\
7037\
7038Colors = {\
7039\009['1'] = \"0\",\
7040\009['2'] = \"1\",\
7041\009['4'] = \"2\",\
7042\009['8'] = \"3\",\
7043\009['16'] = \"4\",\
7044\009['32'] = \"5\",\
7045\009['64'] = \"6\",\
7046\009['128'] = \"7\",\
7047\009['256'] = \"8\",\
7048\009['512'] = \"9\",\
7049\009['1024'] = \"a\",\
7050\009['2048'] = \"b\",\
7051\009['4096'] = \"c\",\
7052\009['8192'] = \"d\",\
7053\009['16384'] = \"e\",\
7054\009['32768'] = \"f\",\
7055}\
7056term.setTextColor(colors.green)\
7057print('DONE')\
7058sleep(sleepTime)\
7059\
7060term.setTextColor(colors.white)\
7061term.write('Setting up term API: ')\
7062term.write = function(str)\
7063\009local x, y = term.getCursorPos()\
7064 str = tostring(str)\
7065\009for i=1,#str do\
7066\009\009if not env['screenBuffer'][y] then\
7067\009\009\009env['screenBuffer'][y] = {}\
7068\009\009end\
7069\009\009env['screenBuffer'][y][x+i-1]=string.sub(str,i,i)..Colors[tostring(term.getTextColor())]..Colors[tostring(term.getBackgroundColor())]\
7070\009end\
7071\009wrt(str)\
7072end\
7073\
7074term.clear = function()\
7075\009for i=1,ySize do\
7076\009\009for j=1,xSize do\
7077\009\009\009if not env['screenBuffer'][i] then\
7078\009\009\009env['screenBuffer'][i] = {}\
7079\009\009end\
7080\009\009env['screenBuffer'][i][j]=' '..Colors[tostring(term.getTextColor())]..Colors[tostring(term.getBackgroundColor())]\
7081\009\009end\
7082\009end\
7083\009clr()\
7084end\
7085term.setTextColor(colors.green)\
7086print('DONE')\
7087sleep(sleepTime)\
7088\
7089term.setTextColor(colors.white)\
7090term.write('Setting up fs API: ')\
7091\
7092local function checkAccess(path,mode)\
7093 term.setCursorBlink(false)\
7094 local trigger = false\
7095 local flog = false\
7096 local logins = fs.list('/System/accounts')\
7097 for i=1,#logins do\
7098 if logins[i] ~= env['l_login'] then\
7099 if string.find(path,logins[i]) or (string.find(path,'sys') and (mode == 'w' or mode == 'wb')) then\
7100 flog = true\
7101 break\
7102 end\
7103 end\
7104 end\
7105 if access > 1 and ((string.find(path,\"startup\") or string.find(path,\"launcher\")) or ((string.find(path,\"System\") and (mode == nil or mode == 'w' or mode == 'wb')) or flog)) then\
7106 vedroid.takeScreenshot(env['screenBuffer'],'/local/scr.png',oldOpen)\
7107 windows.error('Access denied! App is trying to access the system files')\
7108 image.draw(1,1,'/local/scr.png')\
7109 oldDel('/local/scr.png')\
7110 elseif access == 3 and (mode == nil or mode == 'w' or mode == 'wb') then\
7111 vedroid.takeScreenshot(env['screenBuffer'],'/local/scr.png',oldOpen)\
7112 local ans = windows.select({'This app is trying to access the filesystem'},{'Allow this?'},{\"Yes\",colors.orange,colors.white},{\"No\",colors.lightBlue,colors.white})\
7113 if ans == 'Yes' then\
7114 access = 2\
7115 image.draw(1,1,'/local/scr.png')\
7116 oldDel('/local/scr.png')\
7117 trigger = true\
7118 end\
7119 else\
7120 trigger = true\
7121 end\
7122 return trigger\
7123end\
7124\
7125fs.open = function(path,mode)\
7126 if checkAccess(path,mode) then\
7127 return oldOpen(path,mode)\
7128 end\
7129end\
7130\
7131fs.delete = function(path)\
7132 if checkAccess(path) then\
7133 oldDel(path)\
7134 return true\
7135 end\
7136end\
7137\
7138fs.copy = function(from,to)\
7139 if checkAccess(from) and checkAccess(to) then\
7140 oldCopy(from,to)\
7141 return true\
7142 end\
7143end\
7144\
7145fs.move = function(from,to)\
7146 if checkAccess(from) and checkAccess(to) then\
7147 oldMove(from,to)\
7148 return true\
7149 end\
7150end\
7151\
7152fs.makeDir = function(path)\
7153 if checkAccess(path) then\
7154 oldMkdir(path)\
7155 return true\
7156 end\
7157end\
7158\
7159term.setTextColor(colors.green)\
7160print('DONE')\
7161sleep(sleepTime)\
7162\
7163term.setTextColor(colors.white)\
7164term.write('Running launcher : ')\
7165os.run(env,\"launcher\")",
7166 path = "//startup",
7167 },
7168}