Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Apps_Details = {{"Account","os/System/Programs/UserAccount.lua","FXT5QKny"},{"Settings","os/System/Programs/SettingsMenu.lua","HiXY2vKq"},{"Ex install","os/System/Programs/ExInstall.lua","BkGvhc2g"},{"Help","os/System/Programs/InstructionManual.lua","f0vUBCJB"},{"TrainNet","os/System/Programs/TrainNet.lua","t9inpEHU"},{"ImperialExplorer","os/System/Programs/ImperialWebBrowser.lua","2NVqG6bt"}}
- local AppScores = {{50,"UserManagement,Gov", 1642687200},{20,"Audio,Speaker,Music", 1642514400},{10,"FileManagement,Downloader,DiskDrive", 1642860000},{30,"Os,FileManagement", 1642946400},{35,"Info,Os",1643464800},{3,"Net,Info,Gov", 1643637600},{2,"Net", 1643810400}}
- local SupportedApps = {"Account","Ex","Settings","Help","TrainNet","ImperialWebBrowser","exit"}
- local Apps_Disc = {"account","settings","ex install","manual","WIP allows easy access to information and tickets for the National Rail Network","Allows easy browsing of Ingame Web servers"}
- local Apps_Updates = {"1.0.0","1.0.0","1.0.0","1.0.0","1.0.0","1.0.0","1.0.0"}
- local Apps_Installed = {false,false,false,false,false,false,false}
- local AppData = {}
- local w, h = term.getSize()
- local SearchCat = "all"
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function FindApps()
- local Files = fs.list("os/System/Programs")
- for i = 1, #Apps_Details do
- if fs.exists(Apps_Details[i][2]) then Apps_Installed[i] = true end
- end
- end
- local function AppFiles()
- local Path = "os/System/Client/Files/AppStore"
- local Apps = fs.list(Path)
- for i = 1, #Apps do
- local It = fs.combine(Path,Apps[i])
- local file = fs.open(It,"r")
- AppData[i] = textutils.unserialize(file.readAll())
- file.close()
- end
- end
- local function SaveFile(I)
- local Path = "os/System/Client/Files/AppStore"
- local Apps = fs.list(Path)
- local file = fs.open(fs.combine(Path,App_Details[I][1]),"w")
- file.clear()
- file.setCursorPos(1,1)
- file.write(textutils.serialize(AppData[I]))
- file.close()
- end
- function CUI(m) --declare function
- n=1
- local l = #m
- while true do
- term.setCursorPos(1,5)
- for i=1, #m, 1 do --traverse the table of options
- if i==n then term.clearLine() print(i, ">",m[i]) else term.clearLine() print(i, "-", m[i]) end --print them
- end
- a, b= os.pullEvent("key") --wait for keypress
- if b==keys.w and n>1 then n=n-1 end
- if b==keys.s and n<l then n=n+1 end
- if b==keys.enter then break end
- end
- return n --return the value
- end
- function AppListTouch(m) --declare function
- n=0
- local l = #m
- while true do
- term.setCursorPos(1,4)
- for i = 1, #m do
- print("[ ",m[i]," ]")
- print("-")
- end
- a, b, c, d = os.pullEvent("mouse_click") --wait for keypress
- for i = 1, #m do
- if d == (i * 2) + 2 then n = i end
- end
- if c < 3 and d < 3 then n = 50 end
- if n > 0 then break end
- end
- return n --return the value
- end
- local function InstallApp(I)
- local Shortcut
- local Image = "n"
- Clear()
- print("create Desktop shortcut?")
- print("> yes")
- print("or")
- print("> no")
- local a, b, c, d
- repeat
- a, b, c, d = os.pullEvent("mouse_click")
- until d == 2 or d == 4
- if d == 2 then
- Shortcut = {true,"Desktop",Image}
- else
- Shortcut = {false,"n","n"}
- end
- print("downloading")
- local data = {{Apps_Details[I][1],Apps_Details[I][2],Apps_Details[I][3],Shortcut[1],Shortcut[2],Shortcut[3]}}
- local file = fs.open("os/External/Download","w")
- file.write(textutils.serialize(data))
- file.close()
- shell.run( "os/System/Programs/InstallHandler.lua","os/External/Download")
- Apps_Installed[I] = true
- os.sleep(2)
- end
- local function UpdateApp(I)
- fs.delete(Apps_Details[I][2])
- shell.run(settings.get("osPaster"),"get",Apps_Details[I][3],Apps_Details[I][2])
- AppData[I][3] = Apps_Updates[I]
- end
- function Page(I)
- local HasUpdate = false
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- Clear()
- print("[X]===",Apps_Details[I][1],"===")
- term.setCursorPos(1,4)
- if Apps_Installed[I] == true then
- if HasUpdate == true then print("[Update]") else print("[Installed]") end
- else
- print("[Download]")
- print("Recently Updated? ",Apps_Updates[I])
- end
- term.setCursorPos(1,6)
- print(Apps_Disc[I])
- local Action
- repeat
- local event, a, b, c = os.pullEvent("mouse_click")
- if b < 8 and c == 4 then Action = "Inter" end
- if b < 4 and c == 1 then Action = "exit" end
- until Action == "Inter" or Action == "exit"
- if Action == "Inter" then
- if Apps_Installed[I] == false then
- InstallApp(I)
- elseif HasUpdate == true then
- UpdateApp(I)
- end
- Page(I)
- elseif Action == "exit" then
- DisplayMenu()
- end
- end
- function Menu()
- term.setBackgroundColor(colors.green)
- term.setTextColor(colors.white)
- Clear()
- term.setCursorPos(1,8)
- print("Coming Soon!")
- print(">touch screen compatibility")
- print(">Search system")
- print(">Market System")
- print(">banking_public2 integration")
- local options = {"New","exit"}
- local n = CUI(options)
- if options[n] == "exit" then
- term.setTextColor(colors.white)
- elseif options[n] == "Net" then
- elseif options[n] == "New" then
- DisplayMenu(SetList("New"))
- elseif options[n] == "Trending" then
- elseif options[n] == "Owned" then
- DisplayMenu(SetList("Owned"))
- end
- end
- function SetList(Cat)
- local List = {}
- for i = 1, #Apps_Details do
- List[i] = Apps_Details[i][1]
- end
- return(List)
- end
- function DisplayMenu()
- term.setBackgroundColor(colors.green)
- term.setTextColor(colors.white)
- Clear()
- paintutils.drawBox(1,1,2,2,colors.red)
- term.setBackgroundColor(colors.green)
- term.setCursorPos(3,1)
- term.write("AppStore")
- local options = SetList()
- local n = AppListTouch(options)
- if n == 50 then
- Menu()
- else
- Page(n)
- end
- end
- FindApps()
- AppFiles()
- Menu()
Add Comment
Please, Sign In to add comment