Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----- RUX_OS(v0.1) --- TripleHeartGaming -----
- --Local_Variables--
- local osVer = "v0.1"
- local osLabel = "----- RUX_OS(" .. osVer ..") --- TripleHeartGaming -----"
- local closeOS = false
- local firstRun = true
- local userDatabase = "/disk/Rux_OS/Data/users/"
- local users = {}
- local curUser = nil
- local apiFileDir = "/disk/Rux_OS/APIs/"
- local apiFileSearch = "/disk/Rux_OS/APIs/*"
- local apiList = fs.find(apiFileSearch)
- local loggedIn = false
- local defaultUser = "user"
- local defaultPass = "Pass123"
- --End_Local_Variables--
- --OS_Functions--
- ---Local_Functions---
- local function LoadAPIs()
- local startTime = os.clock()
- local apiCount = #apiList
- local failCount = 0
- local failList = {}
- term.clear()
- term.setCursorPos(1,1)
- print("Loading Rux_OS APIs ...")
- for i=1,#apiList,1 do
- local tmpAPI = string.sub(apiList[i], #apiFileDir)
- print("Loading - " , tmpAPI)
- if os.loadAPI(apiList[i]) then
- print ("API : ", tmpAPI, " has been loaded!")
- else
- --TODO:: Log error here
- print ("API : ", tmpAPI, " has failed to load!")
- failCount = failCount + 1
- failList[failCount].name = tmpAPI
- failList[failCount].path = apiList[i]
- end
- end
- local endTime = os.clock()
- local loadTime = endTime - startTime
- print("------APIs loaded in - ", loadTime, " seconds!------")
- term.setTextColor(colors.green)
- print("--APIs Loaded : ", apiCount - failCount)
- if failCount > 0 then
- term.setTextColor(colors.red)
- print("--APIs Failed : ", failCount)
- for i=1,failCount,1 do
- --TODO:: LOG ERROR TO FILE
- write("--", failList[i].name)
- end
- write("\r\n")
- else
- term.setTextColor(colors.green)
- print("--All APIs have loaded succesfully!")
- end
- end
- local function LoginMenu()
- Monitor.ResetTerm()
- setTextColor(colors.green)
- local buttonList = {}
- print("Welcome to Rux_OS" .. osVer .. "!")
- buttonList[1] = Input.CreateButton("Login")
- print(login.text)
- buttonList[2] = Input.CreateButton("Create Account")
- print(createAccount.text)
- buttonList[3] = Input.CreateButton("Exit")
- print(ExitB.text)
- local complete = false
- while not complete do
- local event, param1, param2 = Input.GetInput(false, buttonList)
- if event == Input.iType.keydown and param1 == CKeys.end then
- elseif event == Input.iType.mousedown and param1 then
- if param2 == 1 then
- Login()
- elseif param2 == 2 then
- CreateUser()
- elseif param2 == 3 then
- if ConfirmOSClose() then
- closeOS = true
- return
- end
- end
- end
- end
- end
- function ConfirmOSClose()
- print("Are you sure you want to close Rux_OS?[y/n]")
- local input = read()
- if input = "y" then
- return true
- else
- return false
- end
- end
- --ENTRYPOINT--
- while not closeOS do
- print(osLabel)
- LoadAPIs()
- LoadUsers()
- LoginMenu()
- if closeOS then
- return
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement