Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------ВСЯКИЕ ПОЛЕЗНОСТИ----------------------
- local Args = {...}
- os.loadAPI("System/API/context")
- os.loadAPI("System/API/image")
- os.loadAPI("System/API/windows")
- os.loadAPI("System/API/config")
- os.loadAPI("System/API/zip")
- ----------------------ПОДКЛЮЧЕНИЕ МОНИТОРА-----------------------
- local function findPeripheral(whatToFind)
- local PeriList = peripheral.getNames()
- for i=1,#PeriList do
- if peripheral.getType(PeriList[i]) == whatToFind then
- return PeriList[i]
- end
- end
- end
- --ПОИСК ПЕРИФЕРИИ
- local m = findPeripheral("monitor")
- if Args[1] == "m" then
- if m ~= nil then
- m = peripheral.wrap(m)
- if Args[2] ~= nil then
- m.setTextScale(tonumber(Args[2]))
- end
- term.redirect(m)
- end
- end
- if not term.isColor() then error("This program will work only on advanced computer.") end
- --[[ПОДМЕНА ФУНКЦИИ ЕРРОР
- local standartErrorFunction = error
- error = windows.error]]
- ----------------------ОБЪЯВЛЕНИЕ ПЕРЕМЕННЫХ----------------------
- local xSize, ySize = term.getSize()
- local centerX = math.floor(xSize/2)
- local centerY = math.floor(ySize/2)
- local appWidth = 10
- local appHeight = 6
- local countOfAppsByX = math.floor((xSize-2)/(appWidth+2))
- local countOfAppsByY = math.floor((ySize-5)/(appHeight+1))
- local countOfAppsOnDesktop = countOfAppsByX*countOfAppsByY
- local countOfDesktops = nil
- local startDisplayAllAppsFromX = centerX - math.floor((countOfAppsByX*(appWidth+2)-2)/2) + 1
- local startDisplayAllAppsFromY = centerY - math.floor((countOfAppsByY*(appHeight+1)-1)/2) + 1
- local currentDesktop = 1
- local currentBackground = colors.lightBlue
- local topBarColor = colors.gray
- --МАССИВЫ ОБЪЕКТОВ
- local Obj = {}
- local ObjBottom = {}
- local ObjApp = {}
- local clipboardName = nil
- local workPath = ""
- local workPathHistory = {}
- ----------------------ОБЪЯВЛЕНИЕ ФУНКЦИЙ----------------------
- --СОЗДАНИЕ ОБЪЕКТОВ ПРИЛОЖЕНИЙ
- local function newObjApp(name,x1,y1,width,height,id)
- ObjApp[name]={}
- ObjApp[name]["x1"]=x1
- ObjApp[name]["y1"]=y1
- ObjApp[name]["x2"]=x1+width-1
- ObjApp[name]["y2"]=y1+height-1
- ObjApp[name]["id"] = id
- end
- --СОЗДАНИЕ ДРУГИХ ОБЪЕКТОВ
- local function newObj(name,x1,y1,width,height)
- Obj[name]={}
- Obj[name]["x1"]=x1
- Obj[name]["y1"]=y1
- Obj[name]["x2"]=x1+width-1
- Obj[name]["y2"]=y1+height-1
- end
- --ОБЪЕКТОВ НИЖНИХ КНОПОК
- local function newObjBottom(name,x1,y1,width,height)
- ObjBottom[name]={}
- ObjBottom[name]["x1"]=x1
- ObjBottom[name]["y1"]=y1
- ObjBottom[name]["x2"]=x1+width-1
- ObjBottom[name]["y2"]=y1+height-1
- end
- --ЗАГРУЗКА ФАЙЛОВ С ПАСТЕБИНА
- local function pastebin(mode,paste,filename)
- if mode == "get" then
- local file = http.get("http://pastebin.com/raw.php?i="..paste)
- if file then
- file = file.readAll()
- h=fs.open(filename,"w")
- h.write(file)
- h.close()
- else
- windows.error("Failed to connect to pastebin.com")
- end
- elseif mode == "put" then
- -- Read in the file
- local file = fs.open(filename,"r")
- local sName = fs.getName( filename )
- local sText = file.readAll()
- file.close()
- -- POST the contents to pastebin
- --write( "Connecting to pastebin.com... " )
- local key = "0ec2eb25b6166c0c27a394ae118ad829"
- local response = http.post(
- "http://pastebin.com/api/api_post.php",
- "api_option=paste&"..
- "api_dev_key="..key.."&"..
- "api_paste_format=lua&"..
- "api_paste_name="..textutils.urlEncode(sName).."&"..
- "api_paste_code="..textutils.urlEncode(sText)
- )
- if response then
- local sResponse = response.readAll()
- response.close()
- local sCode = string.match( sResponse, "[^/]+$" )
- windows.attention({"Upload complete!"},{"Pastebin code is "..sCode.."\""})
- else
- windows.error("Failed to connect to pastebin.com")
- end
- elseif mode == "run" then
- local file = http.get("http://pastebin.com/raw.php?i="..paste)
- if file then
- file = file.readAll()
- local func, err = loadstring(file)
- if not func then
- windows.error(err)
- return
- end
- setfenv(func, getfenv())
- local success, msg = pcall(func)
- if not success then
- windows.error(msg)
- end
- else
- windows.error("Failed to connect to pastebin.com")
- end
- end
- end
- --ОГРАНИЧЕНИЕ ДЛИНЫ СТРОКИ
- local function stringLimit(text,size)
- if string.len(text)<=size then return text end
- return string.sub(text,1,size-3).."..."
- end
- --ОГРАНИЧЕНИЕ ДЛИНЫ СТРОКИ
- local function stringLimitFromStart(text,size)
- if string.len(text)<=size then return text end
- return "..."..string.sub(text,string.len(text)-size+4,string.len(text))
- end
- --ПРОСТОЕ ОТОБРАЖЕНИЕ ТЕКСТА ПО КООРДИНАТАМ
- local function usualText(x,y,text)
- term.setCursorPos(x,y)
- term.write(text)
- end
- --РИСОВАНИЕ КВАДРАТА С ЗАЛИВКОЙ
- local function square(x1,y1,width,height,color)
- local string = string.rep(" ",width)
- term.setBackgroundColor(color)
- for y=y1,(y1+height-1) do
- usualText(x1,y,string)
- end
- end
- --ЗАЛИВКА ЭКРАНА ЦВЕТОМ
- local function clearScreen(color)
- term.setBackgroundColor(color)
- term.clear()
- end
- --ОЧИСТКА ЭКРАНА И УСТАНОВКА КУРСОРА НА 1, 1
- local function prepareToExit()
- clearScreen(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(1,1)
- end
- --ПЛАВНОЕ ВКЛЮЧЕНИЕ ЭКРАНА
- local function fadeIn(time)
- clearScreen(colors.gray)
- sleep(time)
- clearScreen(colors.lightGray)
- sleep(time)
- clearScreen(colors.white)
- sleep(time)
- end
- --ПЛАВНОЕ ЗАТУХАНИЕ ЭКРАНА
- local function fadeOut(time)
- clearScreen(colors.lightGray)
- sleep(time)
- clearScreen(colors.gray)
- sleep(time)
- clearScreen(colors.black)
- sleep(time)
- term.setCursorPos(1,1)
- term.setTextColor(colors.white)
- end
- --КОПИРОВАНИЕ ОБОЕВ РАБОЧЕГО СТОЛА В СИСТЕМНУЮ ПАПКУ
- local function setWallpaper(path)
- fs.delete("System/wallpaper.png")
- fs.copy(path,"System/wallpaper.png")
- end
- --ФУНКЦИИ ДЛЯ РАБОТЫ С ФАЙЛАМИ И БУФЕРОМ ОБМЕНА
- local function copy(whatToCopy)
- fs.delete("System/clipboard.temp")
- fs.copy(whatToCopy,"System/clipboard.temp")
- end
- local function paste(path,name)
- name = windows.correctNameForClipboard(path,name,"Copy-")
- fs.copy("System/clipboard.temp",path.."/"..name)
- end
- local function cut(path)
- fs.delete("System/clipboard.temp")
- fs.copy(path,"System/clipboard.temp")
- fs.delete(path)
- end
- --ФУНКЦИЯ, ВЫЗЫВАЕМАЯ ПОСЛЕ ОКОНЧАНИЯ ЗАПУСКА ПРИЛОЖЕНИЯ
- local function programFinished()
- local xCusor,yCursor = term.getCursorPos()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- usualText(1,yCursor+1,"Press any key to quit.")
- while true do
- local event = os.pullEvent()
- if event == "monitor_touch" or event == "mouse_click" or event == "key" then break end
- end
- end
- --ВЕРХНЯЯ ПОЕБОНЬКА С ЧАСИКАМИ
- local function topBar(topBarColor)
- local time = textutils.formatTime(os.time(),false)
- local pathToDisplay = stringLimitFromStart("C:/"..workPath,xSize-6-#time)
- local string = " OS "..string.rep(" ",xSize-5-#time)..time.." "
- term.setBackgroundColor(topBarColor)
- term.setTextColor(colors.white)
- usualText(1,1,string)
- --[[term.setTextColor(colors.lightGray)
- usualText(5,1,pathToDisplay)]]
- end
- newObj("OS",1,1,4,1)
- --ФУНКЦИЯ ДЛЯ РЕОРГАНИЗАЦИИ ЭЛЕМЕНТОВ МАССИВА, ЧТОБ ПАПКИ В НАЧАЛЕ БЫЛИ, А ФАЙЛЫ В КОНЦЕ
- local function reorganizeFilesAndFolders(workPath,massivSudaPihay)
- local reorganizedMassiv = {}
- for i=1,#massivSudaPihay do
- if fs.isDir(workPath.."/"..massivSudaPihay[i]) then
- reorganizedMassiv[#reorganizedMassiv+1] = massivSudaPihay[i]
- end
- end
- for i=1,#massivSudaPihay do
- if not fs.isDir(workPath.."/"..massivSudaPihay[i]) then
- reorganizedMassiv[#reorganizedMassiv+1] = massivSudaPihay[i]
- end
- end
- return reorganizedMassiv
- end
- --ФУНКЦИЯ ОТРИСОВКИ КОНКРЕТНО ВЫБРАННОГО ПРИЛОЖЕНИЯ ПО ИМЕНИ
- local function drawKonkretnoApp(x,y,name,background,id)
- --РИСОВАНИЕ ИКОНКИ
- windows.drawOSIcon(x+2,y,workPath,name)
- --СОЗДАНИЕ ОБЪЕКТА ПРИЛОЖЕНИЯ
- newObjApp(name,x,y,appWidth,appHeight,id)
- --ОТРИСОВКА ИМЕНИ ПРИЛОЖЕНИЯ
- name = stringLimit(name,10)
- term.setBackgroundColor(background)
- if fs.isReadOnly(workPath.."/"..name) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- usualText(math.floor(x+5-#name/2),y+5,name)
- end
- --ФУНКЦИЯ ОТРИСОВКИ ВООБЩЕ ВСЕХ ПРИЛОЖЕНИЙ НА РАБОЧЕМ СТОЛЕ
- local function displayApps(workPath,currentDesktop,background)
- --ОБНУЛЕНИЕ МАССИВОВ
- ObjApp = {}
- ObjBottom = {}
- --ОТРИСОВКА ОБОЕВ
- clearScreen(background)
- if fs.exists("System/wallpaper.png") then
- image.draw(1,2,"System/wallpaper.png")
- end
- --ОТРИСОВКА ВЕРХНЕЙ ШНЯГИ
- topBar(topBarColor)
- --ПОЛУЧИТЬ МАССИВ СО ВСЕМИ ФАЙЛАМИ/ПАПКАМИ
- local files = fs.list(workPath)
- --РЕОРГАНИЗОВАТЬ МАССИВ, ЧТОБ ПАПКИ БЫЛИ В НАЧАЛЕ
- files = reorganizeFilesAndFolders(workPath,files)
- local countOfFiles = #files
- countOfDesktops = math.ceil(countOfFiles/(countOfAppsByY*countOfAppsByX))
- --ОТРИСОВКА НИЖНЕГО ГОВНА
- local bottomButtonsStartX = nil
- if #workPathHistory == 0 then
- bottomButtonsStartX = centerX - math.floor((countOfDesktops*2+1)/2)
- else
- bottomButtonsStartX = centerX - math.floor((countOfDesktops*2-1)/2)
- end
- local bottomY = ySize-1
- for i=1,countOfDesktops do
- local bottomX = bottomButtonsStartX + i * 2
- if currentDesktop == i then
- paintutils.drawPixel(bottomX,bottomY,colors.white)
- else
- paintutils.drawPixel(bottomX,bottomY,colors.lightGray)
- end
- newObjBottom(i,bottomX,bottomY,1,1)
- end
- if #workPathHistory>0 then
- paintutils.drawPixel(bottomButtonsStartX,bottomY,colors.white)
- term.setTextColor(colors.black)
- usualText(bottomButtonsStartX,bottomY,"<")
- newObj("<",bottomButtonsStartX,bottomY,1,1)
- end
- --ОТРИСОВКА САМИХ ПРИЛОЖЕНИЙ
- local appCounter = 1 + currentDesktop * countOfAppsByY * countOfAppsByX - countOfAppsByY * countOfAppsByX
- for y = 1,countOfAppsByY do
- for x = 1,countOfAppsByX do
- if files[appCounter] ~= nil then
- drawKonkretnoApp(startDisplayAllAppsFromX+x*(appWidth+2)-(appWidth+2),startDisplayAllAppsFromY+y*(appHeight+1)-(appHeight+1),files[appCounter],background,appCounter)
- appCounter = appCounter + 1
- end
- end
- end
- end
- local function askForMakingOSAsStartup()
- local action = windows.select({"Hello!"},{"Do you want to load OS","when computer starts?"},{"No",colors.lightGray,colors.black},{"Yes",colors.lightBlue,colors.black})
- if action == "Yes" then
- fs.copy("OS","startup")
- config.write("System/OS/startup.cfg","load when computer starts","true")
- else
- config.write("System/OS/startup.cfg","load when computer starts","false")
- end
- end
- ----------------------------------СТАРТ ПРОГРАММЫ----------------------------------------
- --РИСУЕМ ВООБЩЕ ВСЕ ПРИЛОЖЕНИЯ
- displayApps(workPath,currentDesktop,currentBackground)
- if not fs.exists("startup") then
- if not fs.exists("System/OS/startup.cfg") then
- askForMakingOSAsStartup()
- displayApps(workPath,currentDesktop,currentBackground)
- else
- local govno = config.read("System/OS/startup.cfg","load when computer starts")
- if govno ~= nil and govno ~= "false" then
- askForMakingOSAsStartup()
- displayApps(workPath,currentDesktop,currentBackground)
- end
- end
- end
- --НАЧАЛО ЕБЛИ МОЗГА
- local exitFromProgram = false
- while true do
- if exitFromProgram then break end
- --СЧЕТЧИК ПРИЛОЖЕНИЙ, НАЧИНАЯ С 1 НА ТЕКУЩЕМ РАБОЧЕМ СТОЛЕ
- local appCounter = 1 + currentDesktop * countOfAppsByY * countOfAppsByX - countOfAppsByY * countOfAppsByX
- local event,side,x,y = os.pullEvent()
- --ХУЙНЮШКА ДЛЯ МОНИТОРА, А ТО ХЕР ЕГО ЗНАЕТ, КАКИЕ ИВЕНТЫ ОНО ШЛЕТ
- if event == "monitor_touch" then side = 1 end
- if event == "mouse_click" or event == "monitor_touch" then
- if side == 1 then
- --ПЕРЕМЕННАЯ ВЫХОДА ИЗ ВСЕХ ЦИКЛОВ, ПАТАММУШТА ЛУА ГОВНО И НЕ ПОДДЕРЖИВАЕТ МНОЖЕСТВЕННЫЙ BREAK
- local exit1 = false
- --ХУЙНЮШЕЧКА ДЛЯ КЛИКА "НАЗАД"
- if #workPathHistory > 0 then
- if x==Obj["<"]["x1"] and y==Obj["<"]["y1"] and #workPathHistory > 0 then
- --ТЫК
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.white)
- usualText(Obj["<"]["x1"],Obj["<"]["y1"],"<")
- sleep(0.2)
- --НЕ ТЫК
- workPath = workPathHistory[#workPathHistory]
- workPathHistory[#workPathHistory] = nil
- currentDesktop = 1
- displayApps(workPath,currentDesktop,currentBackground)
- exit1 = true
- end
- end
- --А ЭТО, КОРОЧ, ПЕРЕБОР ВСЕХ НИЖНИХ КНОПОЧЕК ДЛЯ ПЕРЕЛИСТЫВАНИЯ РАБОЧИХ СТОЛОВ
- for i=1,#ObjBottom do
- if exit1 then break end
- if x==ObjBottom[i]["x1"] and y==ObjBottom[i]["y1"] then
- currentDesktop = i
- displayApps(workPath,currentDesktop,currentBackground)
- exit1=true
- end
- end
- --А ЭТО ВООБЩЕ У-У-У-У-У
- --ЗАБЕЙ, КОРОЧ
- --ПРОСТО ЗАБЕЙ
- --В ОБЩЕМ
- --ЭТО ТАКАЯ ХУЙНЯ, КОТОРАЯ ПЕРЕБИРАЕТ МАССИВЧИК С ОБЪЕКТАМИ ПРИЛОЖЕНИЙ
- --КОРОЧ, ЗАБЫЛ УЖЕ, ЧТО ЭТО
- for key,val in pairs(ObjApp) do
- if exit1 then break end
- for i=appCounter,(appCounter+countOfAppsOnDesktop-1) do
- if exit1 then break end
- if ObjApp[key]["id"] == i then
- if x>=ObjApp[key]["x1"] and x<=ObjApp[key]["x2"] and y>=ObjApp[key]["y1"] and y<=ObjApp[key]["y2"] then
- square(ObjApp[key]["x1"],ObjApp[key]["y1"],appWidth,appHeight,colors.blue)
- drawKonkretnoApp(ObjApp[key]["x1"],ObjApp[key]["y1"],key,colors.blue,ObjApp[key]["id"])
- sleep(0.2)
- if not fs.isDir(workPath.."/"..key) then
- local fileFormat = windows.getFileFormat(key)
- if key ~= "OS" and key ~= "os" and fileFormat == nil then
- local success,err = loadfile(workPath.."/"..key)
- if success ~= nil then
- fadeOut(0)
- prepareToExit()
- shell.run(workPath.."/"..key)
- programFinished()
- fadeIn(0)
- else
- windows.error(err)
- end
- elseif fileFormat == ".png" then
- fadeOut(0)
- shell.run("Photoshop "..workPath.."/"..key)
- fadeIn(0)
- elseif fileFormat == ".zip" then
- windows.progressBar("auto","auto",20," ","Unarchiving",5)
- zip.unarchive(workPath.."/"..key,workPath)
- elseif key == "OS" or key == "os" then
- windows.attention({"Can't open OS"},{"Cause it's already","running."})
- end
- exit1 = true
- displayApps(workPath,currentDesktop,currentBackground)
- else
- workPathHistory[#workPathHistory+1] = workPath
- workPath = workPath.."/"..key
- appCounter = 1
- currentDesktop = 1
- exit1 = true
- displayApps(workPath,1,currentBackground)
- end
- end
- end
- end
- end
- if x>=Obj["OS"]["x1"] and x<=Obj["OS"]["x2"] and y>=Obj["OS"]["y1"] and y<=Obj["OS"]["y2"] then
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.white)
- usualText(1,1," OS ")
- local contextAction = context.menu(Obj["OS"]["x1"]+1,Obj["OS"]["y1"]+1,{"About"},{"Update"},"-",{"Reboot"},{"Shutdown"},"-",{"Use Craft OS"},{"Made by ECS",true})
- if contextAction == "About" then
- fadeOut(0)
- shell.run("Applications/About")
- fadeIn(0)
- displayApps(workPath,currentDesktop,currentBackground)
- elseif contextAction == "Update" then
- --shell.run("pastebin run rjkm903f")
- pastebin("run","rjkm903f","cyka")
- fadeOut(0)
- os.reboot()
- elseif contextAction == "Reboot" then
- fadeOut(0)
- os.reboot()
- elseif contextAction == "Shutdown" then
- windows.tv(0)
- os.shutdown()
- elseif contextAction == "Use Craft OS" then
- exitFromProgram = true
- --prepareToExit()
- elseif contextAction == nil then
- displayApps(workPath,currentDesktop,currentBackground)
- end
- end
- else
- local appSelected = false
- local exit1 = false
- for key,val in pairs(ObjApp) do
- if exit1 then break end
- for i=appCounter,(appCounter+countOfAppsOnDesktop-1) do
- if exit1 then break end
- if ObjApp[key]["id"] == i then
- if x>=ObjApp[key]["x1"] and x<=ObjApp[key]["x2"] and y>=ObjApp[key]["y1"] and y<=ObjApp[key]["y2"] then
- square(ObjApp[key]["x1"],ObjApp[key]["y1"],appWidth,appHeight,colors.blue)
- drawKonkretnoApp(ObjApp[key]["x1"],ObjApp[key]["y1"],key,colors.blue,ObjApp[key]["id"])
- local fileFormat = windows.getFileFormat(key)
- local thisIsDir = fs.isDir(workPath.."/"..key)
- local thisIsReadOnly = fs.isReadOnly(workPath.."/"..key)
- local thisIsArchive = false; if fileFormat == ".zip" then thisIsArchive = true end
- local contextAction = nil
- if fileFormat == ".png" then
- contextAction = context.menu(x,y,{"Edit",thisIsDir},{"Set as wallpaper"},"-",{"Cut"},{"Copy"},{"Delete"},{"Rename"},"-",{"Upload to pastebin",thisIsDir},{"Add to archive"},"-",{"Properties"})
- else
- contextAction = context.menu(x,y,{"Edit",thisIsDir},{"Run with arguments",thisIsDir},"-",{"Cut",thisIsReadOnly},{"Copy"},{"Delete",thisIsReadOnly},{"Rename",thisIsReadOnly},"-",{"Upload to pastebin",thisIsDir},{"Add to archive",thisIsArchive},"-",{"Properties"})
- end
- if contextAction == "Edit" then
- exit = true
- fadeOut(0)
- prepareToExit()
- shell.run("edit "..workPath.."/"..key)
- fadeIn(0)
- elseif contextAction == "Cut" then
- cut(workPath.."/"..key)
- clipboardName = key
- elseif contextAction == "Copy" then
- copy(workPath.."/"..key)
- clipboardName = key
- elseif contextAction == "Delete" then
- fs.delete(workPath.."/"..key)
- elseif contextAction == "Rename" then
- local filePath = windows.input(math.floor(xSize/2-12),math.floor(ySize/2-3),"New name",15,{"Name",""})
- if workPath.."/"..key == workPath.."/"..filePath[1] then
- windows.attention({"Oops!"},{"What is the meaning of renaming","into the same name?"})
- else
- fs.move(workPath.."/"..key,workPath.."/"..filePath[1])
- end
- elseif contextAction == "Set as wallpaper" then
- setWallpaper(workPath.."/"..key)
- elseif contextAction == "Run with arguments" then
- local arguments = windows.input(math.floor(xSize/2-12),math.floor(ySize/2-3),"Run",15,{"Arguments",""})
- exit = true
- fadeOut(0)
- prepareToExit()
- shell.run(workPath.."/"..key.." "..arguments[1])
- programFinished()
- fadeIn(0)
- elseif contextAction == "Upload to pastebin" then
- windows.progressBar("auto","auto",5," ","Uploading to pastebin",10)
- pastebin("put","cyka",workPath.."/"..key)
- elseif contextAction == "Add to archive" then
- windows.progressBar("auto","auto",20," ","Archiving",10)
- zip.archive(workPath.."/"..key,workPath.."/"..key)
- elseif contextAction == "Properties" then
- displayApps(workPath,currentDesktop,currentBackground)
- windows.aboutFile(x,y,26,workPath.."/"..key,key)
- end
- exit1 = true
- appSelected = true
- displayApps(workPath,currentDesktop,currentBackground)
- end
- end
- end
- end
- if y>=2 and appSelected == false then
- local thisIsReadOnly = fs.isReadOnly(workPath)
- local isClipboardEmpty = true
- if clipboardName ~= nil then isClipboardEmpty = false end
- if isClipboardEmpty == false then isClipboardEmpty = thisIsReadOnly end
- local contextAction = context.menu(x,y,{"New file",thisIsReadOnly},{"New folder",thisIsReadOnly},{"Paste",isClipboardEmpty},"-",{"Run from pastebin"},{"Get from pastebin",thisIsReadOnly})
- if contextAction == "New file" then
- local filePath = windows.input(math.floor(xSize/2-12),math.floor(ySize/2-3),"New file",15,{"Name",""})
- fadeOut(0)
- prepareToExit()
- shell.run("edit "..workPath.."/"..filePath[1])
- fadeIn(0)
- elseif contextAction == "New folder" then
- local filePath = windows.input(math.floor(xSize/2-12),math.floor(ySize/2-3),"New folder",15,{"Name",""})
- fs.makeDir(workPath.."/"..filePath[1])
- elseif contextAction == "Paste" then
- if clipboardName ~= nil and fs.exists("System/clipboard.temp") then
- paste(workPath,clipboardName)
- end
- elseif contextAction == "Run from pastebin" then
- local paste = windows.input(math.floor(xSize/2-16),math.floor(ySize/2-3),"Run from pastebin",15,{"Paste name",""})
- pastebin("run",paste[1],"cyka")
- elseif contextAction == "Get from pastebin" then
- local paste = windows.input(math.floor(xSize/2-16),math.floor(ySize/2-4),"Get from pastebin",15,{"Paste name",""},{"File name",""})
- pastebin("get",paste[1],paste[2])
- end
- displayApps(workPath,currentDesktop,currentBackground)
- end
- end
- --ОТРИСУЕМ ВЕРХНЮЮ ПАНЕЛЬКУ С ЧАСИКАМИ ПОСЛЕ НАЖАТИЯ НА ЭКРАН
- topBar(topBarColor)
- --НА ВСЯКИЙ ПОЖАРНЫЙ ВЫРУБАЕМ МИГАНИЕ КУРСОРА, А ТО БЫЛА УЖЕ ОДНА ХУЙНЯ
- term.setCursorBlink(false)
- --ПОДДЕРЖКА КОЛЕСА МЫШИ, ПРОКРУЧИВАЮЩЕГО РАБОЧИЕ СТОЛЫ
- elseif event == "mouse_scroll" then
- if side == -1 then
- currentDesktop = currentDesktop + 1
- if currentDesktop > countOfDesktops then
- currentDesktop = countOfDesktops
- else
- displayApps(workPath,currentDesktop,currentBackground)
- end
- elseif side == 1 then
- currentDesktop = currentDesktop - 1
- if currentDesktop < 1 then
- currentDesktop = 1
- else
- displayApps(workPath,currentDesktop,currentBackground)
- end
- end
- end
- end
- --fadeOut(0)
- --prepareToExit()
- windows.tv(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement