Commit ff484247 authored by Danny SMc's avatar Danny SMc

Initial

parent 12c5311a
......@@ -6,7 +6,7 @@
]]
-- Set Variables
eclipse = {}; eclipse.draw = {}; eclipse.core = {}; eclipse.create = {};
eclipse = {}; eclipse.draw = {}; eclipse.core = {}; eclipse.create = {}; eclipse.store = {};
tArgs = { ... }
os.getEvent = os.pullEvent
os.pullEvent = os.pullEventRaw
......@@ -82,6 +82,12 @@ discover = {
urls = {
user = "http://api.dannysmc.com/user.php";
projects = "http://api.dannysmc.com/projects.php";
store = "http://api.dannysmc.com/store.php";
};
store = {
Apps = {};
Versions = {};
Categories = {};
};
};
checkUpdate = function( self )
......@@ -202,6 +208,32 @@ discover = {
return false
end
end;
store_download = function( self )
local ret = http.post(self.data.urls.store, "cmd=list_apps")
ret = textutils.unserialize(ret.readAll())
if ret.status == true then
self.data.store.apps = ret.data
else
return false
end
local ret = http.post(self.data.urls.store, "cmd=list_categories")
ret = textutils.unserialize(ret.readAll())
if ret.status == true then
self.data.store.categories = ret.data
else
return false
end
local ret = http.post(self.data.urls.store, "cmd=list_versions")
ret = textutils.unserialize(ret.readAll())
if ret.status == true then
self.data.store.versions = ret.data
else
return false
end
return true
end;
}
-- Set Functions
......@@ -1129,7 +1161,28 @@ end
function eclipse.core.apps()
system.screen.colour("white")
eclipse.draw.bar("Apps List")
local scroll = 0
local function sidebar()
for i=3, 19 do
system.draw.box(38, 14, i, 1, " ", "lightGrey", "lightGrey")
end
local options = {"Reload", "View all"}
system.draw.box(39, 12, 4, 1, " ", "orange", "orange")
system.draw.texta(options[1], 40, 4, false, "white", "orange")
system.draw.box(39, 12, 6, 1, " ", "orange", "orange")
system.draw.texta(options[2], 40, 6, false, "white", "orange")
end
local function draw(scroll)
for i=1, 13 do
if i + scroll <= #internal.Apps then
system.draw.textl(" " .. tostring(internal.Apps[i+scroll].Name), i+3, false, "grey", "white")
end
end
end
sidebar(); draw(scroll);
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
......@@ -1137,6 +1190,30 @@ function eclipse.core.apps()
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
eclipse.draw.menu_input("Apps List", args[3], args[4])
elseif (args[3] >= 39 and args[3] <= 50) and (args[4] >= 3 and args[4] <= 19) then
if args[4] == 4 then
for i=3, 19 do system.draw.box(1, 37, i, 1, " ", "white", "white") end
system.draw.texta("Reloading Apps...", 8, 10, false, "red", "white")
local apps = fs.list("core/apps"); internal.Apps = {}
for _,v in ipairs(apps) do
local a = {}
local n = v:gsub(".lua", "")
local l = string.upper(n:sub(1,1))
a["Name"] = l .. "" .. n:sub(2);
a["Logo"] = "default";
a["Type"] = "apps";
a["Func"] = v:gsub(".lua", "");
a["Path"] = fs.combine("core/apps/", v);
table.insert(internal.Apps, a)
sleep(0.02)
end
system.draw.texta("Completed, " .. #internal.Apps .. " apps!", 8, 10, false, "red", "white")
sleep(1)
eclipse.core.apps()
elseif args[4] == 6 then
system.thread.create("Store", eclipse.store.view)
system.thread.switch("Store")
end
end
end
end
......@@ -1464,6 +1541,42 @@ function eclipse.core.shell()
system.thread.switch("Dash")
end
--// Store Data
function eclipse.store.view()
system.screen.colour("white")
eclipse.draw.bar("Store: View")
system.draw.textc("Downloading Listing, Please Wait", 10, false, "red", "white")
if discover:store_download() then
system.draw.box(1, 51, 10, 1, " ", "white", "white")
else
system.draw.textc("There was a problem, please try again later", 10, false, "red", "white")
sleep(2)
system.thread.remove("Store")
system.thread.switch("Dash")
end
local scroll = 0
local function draw(scroll)
for i=1, 14 do
if i + scroll <= #discover.data.store.apps then
system.draw.box(1, 51, i+3, 1, " ", "white", "white")
system.draw.textl(" " .. discover.data.store.apps[i+scroll].name, i+3, false, "grey", "white")
end
end
end
draw(scroll)
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
eclipse.draw.bar("Store: View")
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
eclipse.draw.menu_input("Dashboard", args[3], args[4])
end
end
end
end
-- Initialise Eclipse
if downloadapi then
......
shell.run("eclipse.lua")
\ No newline at end of file
shell.run("eclipse.lua")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment