Now my code is ready to publish, because i must check if there is anything that i don't want to show so here it is:
1
st Program:
Spoiler
function run( _tEnv, _sPath, ... )
local tArgs = { ... }
local fnFile, err = loadfile( _sPath )
if fnFile then
local tEnv = _tEnv
--setmetatable( tEnv, { __index = function(t,k) return _G[k] end } )
setmetatable( tEnv, { __index = _G } )
setfenv( fnFile, tEnv )
local ok, err = pcall( function()
fnFile( unpack( tArgs ) )
end )
if not ok then
if err and err ~= "" then
os.run( {}, "ApfelOS/..colortheme.ac")
x = 0
CCver = os.version()
if fs.exists("ApfelOS/..Session/login") then
fs.delete("ApfelOS/..Session/login")
end
local loop = "on"
term.setBackgroundColor(error)
term.clear()
term.setTextColor(error)
term.setBackgroundColor(errortxt)
term.setCursorPos(22,4)
print(" Error ")
term.setBackgroundColor(error)
term.setTextColor(errortxt)
print(" ")
print(" An Error has occured and the OS has been ")
print(" shutdown. To power off your PC press CTRL + S for ")
print(" 1 second. ")
print(" ")
print(" ")
write("OStag: ")
print(OStag)
write("OS Version: ")
print(version)
write("OS Modding: ")
if modding == "true" then
print("Enabled")
elseif modding == "false" then
print("Disabled")
else
print("Can't indentify modding status")
end
write("OS Starts: ")
print(starts)
write("Shell Version: ")
print(CCver)
write("Error Code: ")
print( err )
while true do
local event, button, X, Y = os.pullEventRaw("mouse_click")
XY = X..","..Y
if x == 10 then
os.shutdown()
break
end
end
end
return false
end
return true
end
if err and err ~= "" then
bug = err
end
return false
end
2
nd Program:
Spoiler
-- All Colors
-- 1 - White
-- 2 - Orange
-- 4 - pink
-- 8 - light blue
-- 16 - Yellow
-- 32 - light green
-- 64 - rosa
-- 128 - grey
-- 256 - light grey
-- 512 - cyan
-- 1024 - violette
-- 2048 - blue
-- 4096 - braun
-- 8192 - green
-- 16384 - red
-- 32768 - black
function Loading()
sleep(0.2)
write(" ")
sleep(0.1)
write(" ")
sleep(0.1)
write(" ")
sleep(0.1)
write(" ")
sleep(0.1)
write(" ")
sleep(0.1)
write(" ")
sleep(0.1)
write(" ")
end
function menue(m)
n=1
k=#m
while true do
term.clear()
term.setCursorPos(1,1)
term.setTextColor(16)
print("ApfelBoot - Pro Bootloader")
term.setCursorPos(1,3)
for i=1, k, 1 do
if i==n then print(i, " ["..m[i].."]") else print(i, " "..m[i].." ") end
end
print("")
print("<Please select your Operating System>")
a, b= os.pullEventRaw()
if a == "key" then
if b==200 and n>1 then n=n-1 end
if b==208 and n<=k then n=n+1 end
if b==28 then break end
end
end
term.clear() term.setCursorPos(1,1)
return n
end
term.setBackgroundColor(32768)
term.clear()
term.setCursorPos(1,1)
if fs.exists("ApfelOS/..Session/login") then
fs.delete("ApfelOS/..Session/login")
end
if fs.exists("ApfelOS/newversion") then
fs.delete("ApfelOS/newversion")
end
term.clear()
term.setTextColor(16)
term.setCursorPos(1,1)
textutils.slowPrint("ApfelBoot - Pro Bootloader")
sleep(0,9)
term.clear()
sleep(0,1)
local options={
"ApfelOS",
"ApfelShell",
"Shutdown"
}
local n=menue(options)
print(n)
if n == 1 then
local file = fs.open("ApfelOS/..stcount.adf", "r")
local fileData = {}
local line = file.readLine()
repeat
table.insert(fileData,line)
line = file.readLine()
until line == nil
file.close()
starts = fileData[1]
term.clear()
term.setCursorPos(1,1)
term.setTextColor(16)
print(" ApfelOS 1.0 Pro ")
print(" ")
write(" ")
term.setBackgroundColor(2)
print(" ")
term.setBackgroundColor(32768)
write(" ")
term.setBackgroundColor(2)
print(" ")
term.setBackgroundColor(32768)
write(" ")
term.setBackgroundColor(2)
print(" ")
term.setBackgroundColor(32768)
print(" ")
Logo = paintutils.loadImage("ApfelOS/Logo.nfp")
Background = paintutils.loadImage("ApfelOS/background.nfp")
os.loadAPI("ApfelOS/API/aoBasic")
aoBasic.run( {}, "ApfelOS/API/apfelOS")
freeSpace = fs.getFreeSpace("/")
spacer = " "
format = "B "
CCver = os.version()
paintutils.drawImage(Logo,18,6)
term.setCursorPos(6,4)
term.setBackgroundColor(16)
textutils.slowPrint(" ")
sleep(0.3)
if starts == "0" then
starts = starts + 1
local file = fs.open("ApfelOS/..stcount.adf", "w")
file.write(starts)
file.close()
theme = "sky"
apfelOS.run("ApfelOS/..firststart.adf")
error = colors.blue
errortxt = colors.white
else
starts = starts + 1
local file = fs.open("ApfelOS/..stcount.adf", "w")
file.write(starts)
file.close()
shell.run("ApfelOS/..colortheme.ac")
aoBasic.run( {}, "ApfelOS/aLogin.adf")
end
os.shutdown()
elseif n == 2 then
term.clear()
print(" ApfelShell is loading ")
sleep(0.6)
shell.run("ApfelOS/shell.adf")
elseif n == 3 then
term.clear()
term.setCursorPos(1,1)
print("ApfelBoot - Pro Bootloader")
print(" ")
print("1 ApfelOS")
print("2 ApfelShell")
print("3 [Shutdown]")
print(" ")
print("<Please select your Operating System>")
sleep(0.4)
os.shutdown()
else
term.clear()
term.setCursorPos(1,1)
term.setTextColor(16)
print("Sorry, but this is a known Bug, so please don't")
print(" report it a second time.")
sleep(5)
os.reboot()
end
3
rd program:
Spoiler
shell.run("ApfelOS/..colortheme.ac")
term.setBackgroundColor(body)
term.clear()
term.setCursorPos(1,1)
term.setBackgroundColor(tbar)
term.setTextColor(tbartxt)
print(" ")
term.setCursorPos(1,1)
write("ApfelOS 1.0 Pro ")
print(version)
term.setCursorPos(46,1)
term.setTextColor(prog)
print("Login ")
term.setTextColor(mbartxt)
term.setBackgroundColor(mbar)
print("<No Message available> ")
term.setTextColor(wico)
term.setCursorPos(11,5)
term.setBackgroundColor(wicotxt)
print(" Login ")
term.setBackgroundColor(wico)
term.setTextColor(wicotxt)
term.setCursorPos(11,6)
print(" ")
term.setCursorPos(11,7)
print(" ")
term.setCursorPos(11,8)
print(" ")
term.setCursorPos(11,9)
print(" ")
term.setCursorPos(11,10)
print(" ")
term.setCursorPos(11,11)
print(" ")
term.setCursorPos(12,7)
write("Username: ")
term.setCursorPos(12,9)
print("Password: ")
term.setCursorPos(22,7)
UserName = read()
term.setCursorPos(22,9)
UserPass = read("*")
if UserPass == "" then
shell.run("ApfelOS/aLogin.adf")
elseif UserName == "" then
shell.run("ApfelOS/aLogin.adf")
elseif UserName == "Reboot" then
os.reboot()
elseif UserName == "Shutdown" then
os.shutdown()
else
if fs.exists("ApfelOS/..Benutzer/"..UserName.."/"..UserPass.."") then
if fs.exists("ApfelOS/..benutzer/"..UserName.."/"..UserPass.."/admin") then
admin = true
else
admin = false
end
fs.makeDir("ApfelOS/..Session/login")
term.setBackgroundColor(body)
term.clear()
term.setTextColor(tbartxt)
term.setCursorPos(1,1)
term.setBackgroundColor(tbar)
print(" ")
term.setCursorPos(1,1)
write("ApfelOS 1.0 Pro ")
print(version)
term.setBackgroundColor(mbar)
term.setTextColor(mbartxt)
print("<Please wait!> ")
term.setBackgroundColor(body)
term.setTextColor(bodytxt)
term.setCursorPos(21,7)
print("Welcome |")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome /")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome -")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome |")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome /")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome -")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome |")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome /")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome -")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome |")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome /")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome -")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome |")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome /")
sleep(0.1)
term.setCursorPos(21,7)
print("Welcome -")
sleep(0.1)
else
term.setCursorPos(12,10)
term.setTextColor(16384)
print("Wrong Username or Password")
term.setTextColor(1)
sleep(1)
term.setBackgroundColor(8)
term.clear()
term.setCursorPos(1,1)
shell.run("ApfelOS/aLogin.adf")
end
end
please note, that there are the original path's in this code. you have to change them to get it work