Ну-ка

This commit is contained in:
Igor Timofeev 2017-09-25 23:51:59 +03:00
parent 296fea8bad
commit 8709d846f5
70 changed files with 136 additions and 335 deletions

View File

@ -1,218 +1,218 @@
{ {
{ {
path="/OS.lua", path="/OS.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/OS.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/OS.lua",
about="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/About/", about="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/About/",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=3.88, version=3.89,
}, },
{ {
path="/MineOS/Pictures/MoonTouch.pic", path="/MineOS/Pictures/MoonTouch.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/MoonTouch.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/MoonTouch.pic",
type="Wallpaper", type="Wallpaper",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/Pictures/Raspberry.pic", path="/MineOS/Pictures/Raspberry.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Raspberry.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Raspberry.pic",
type="Wallpaper", type="Wallpaper",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/Pictures/Catniss.pic", path="/MineOS/Pictures/Catniss.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Catniss.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Catniss.pic",
type="Wallpaper", type="Wallpaper",
version=1.01, version=1.01,
}, },
{ {
path="/MineOS/Pictures/Ciri.pic", path="/MineOS/Pictures/Ciri.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Ciri.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Ciri.pic",
type="Wallpaper", type="Wallpaper",
version=1.01, version=1.01,
}, },
{ {
path="/MineOS/Pictures/Girl.pic", path="/MineOS/Pictures/Girl.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Girl.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Girl.pic",
type="Wallpaper", type="Wallpaper",
version=1.01, version=1.01,
}, },
{ {
path="/MineOS/Pictures/Space.pic", path="/MineOS/Pictures/Space.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Space.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Space.pic",
type="Wallpaper", type="Wallpaper",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/Pictures/Block.pic", path="/MineOS/Pictures/Block.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Block.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Block.pic",
type="Wallpaper", type="Wallpaper",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/Pictures/Road.pic", path="/MineOS/Pictures/Road.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Wallpapers/Road.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Wallpapers/Road.pic",
type="Wallpaper", type="Wallpaper",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Localization/Russian.lang", path="/MineOS/System/Localization/Russian.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Localization/Russian.lang", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Localization/Russian.lang",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=1.32, version=1.32,
}, },
{ {
path="/MineOS/System/Localization/English.lang", path="/MineOS/System/Localization/English.lang",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Localization/English.lang", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Localization/English.lang",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=1.32, version=1.32,
}, },
----------------------------------------------------- Ассоциация говна -------------------------------------------------------------------------- ----------------------------------------------------- Ассоциация говна --------------------------------------------------------------------------
{ {
path="/MineOS/System/ExtensionAssociations/Lua/ContextMenu.lua", path="/MineOS/System/Extensions/Lua/ContextMenu.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/ExtensionAssociations/Lua/ContextMenu.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Lua/ContextMenu.lua",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=1.02, version=1.03,
}, },
{ {
path="/MineOS/System/ExtensionAssociations/Lua/Launcher.lua", path="/MineOS/System/Extensions/Lua/Launcher.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/ExtensionAssociations/Lua/Launcher.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Lua/Launcher.lua",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=1.02, version=1.03,
}, },
-- --
{ {
path="/MineOS/System/ExtensionAssociations/Pic/ContextMenu.lua", path="/MineOS/System/Extensions/Pic/ContextMenu.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/ExtensionAssociations/Pic/ContextMenu.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Pic/ContextMenu.lua",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=1.02, version=1.03,
}, },
-- --
{ {
path="/MineOS/System/ExtensionAssociations/Pkg/Launcher.lua", path="/MineOS/System/Extensions/Pkg/Launcher.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/ExtensionAssociations/Pkg/Launcher.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Extensions/Pkg/Launcher.lua",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=1.02, version=1.03,
}, },
----------------------------------------------------- Системные иконки -------------------------------------------------------------------------- ----------------------------------------------------- Системные иконки --------------------------------------------------------------------------
{ {
path="/MineOS/System/Icons/Application.pic", path="/MineOS/System/Icons/Application.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Application.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Application.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/3DModel.pic", path="/MineOS/System/Icons/3DModel.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/3DModel.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/3DModel.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Computer.pic", path="/MineOS/System/Icons/Computer.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Computer.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Computer.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Robot.pic", path="/MineOS/System/Icons/Robot.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Robot.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Robot.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Tablet.pic", path="/MineOS/System/Icons/Tablet.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Tablet.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Tablet.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Pastebin.pic", path="/MineOS/System/Icons/Pastebin.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Pastebin.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Pastebin.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/HDD.pic", path="/MineOS/System/Icons/HDD.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/HDD.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/HDD.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Floppy.pic", path="/MineOS/System/Icons/Floppy.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Floppy.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Floppy.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Steve.pic", path="/MineOS/System/Icons/Steve.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Steve.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Steve.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Folder.pic", path="/MineOS/System/Icons/Folder.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Folder.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Folder.pic",
type="Icon", type="Icon",
version=1.01, version=1.01,
}, },
{ {
path="/MineOS/System/Icons/FileNotExists.pic", path="/MineOS/System/Icons/FileNotExists.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/FileNotExists.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/FileNotExists.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Script.pic", path="/MineOS/System/Icons/Script.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Script.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Script.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Text.pic", path="/MineOS/System/Icons/Text.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Text.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Text.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Config.pic", path="/MineOS/System/Icons/Config.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Config.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Config.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Image.pic", path="/MineOS/System/Icons/Image.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Image.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Image.pic",
type="Icon", type="Icon",
version=1.01, version=1.01,
}, },
{ {
path="/MineOS/System/Icons/Lua.pic", path="/MineOS/System/Icons/Lua.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Lua.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Lua.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/SampleIcon.pic", path="/MineOS/System/Icons/SampleIcon.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/SampleIcon.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/SampleIcon.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Archive.pic", path="/MineOS/System/Icons/Archive.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Archive.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Archive.pic",
type="Icon", type="Icon",
version=1.0, version=1.0,
}, },
{ {
path="/MineOS/System/Icons/Trash.pic", path="/MineOS/System/Icons/Trash.pic",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Icons/Trash.pic", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Icons/Trash.pic",
type="Icon", type="Icon",
version=1.01, version=1.01,
}, },
@ -223,25 +223,27 @@
path="/lib/MineOSCore.lua", path="/lib/MineOSCore.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSCore.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSCore.lua",
type="Library", type="Library",
version=1.88, preloadFile=true,
version=1.89,
}, },
{ {
path="/lib/MineOSNetwork.lua", path="/lib/MineOSNetwork.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSNetwork.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSNetwork.lua",
type="Library", type="Library",
version=1.03, version=1.04,
}, },
{ {
path="/lib/MineOSInterface.lua", path="/lib/MineOSInterface.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSInterface.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSInterface.lua",
type="Library", type="Library",
version=1.01, version=1.02,
}, },
{ {
path="/lib/MineOSPaths.lua", path="/lib/MineOSPaths.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSPaths.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/MineOSPaths.lua",
type="Library", type="Library",
version=1.00, preloadFile=true,
version=1.01,
}, },
{ {
path="/lib/advancedLua.lua", path="/lib/advancedLua.lua",
@ -421,28 +423,28 @@
----------------------------------------------------- Screensavers -------------------------------------------------------------------------- ----------------------------------------------------- Screensavers --------------------------------------------------------------------------
{ {
path="/MineOS/System/Screensavers/Matrix.lua", path="/MineOS/System/Screensavers/Matrix.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Screensavers/Matrix.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Matrix.lua",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=1.02, version=1.02,
}, },
{ {
path="/MineOS/System/Screensavers/Mandala.lua", path="/MineOS/System/Screensavers/Mandala.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Screensavers/Mandala.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Mandala.lua",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=1.00, version=1.00,
}, },
{ {
path="/MineOS/System/Screensavers/Clock.lua", path="/MineOS/System/Screensavers/Clock.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Screensavers/Clock.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Clock.lua",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=1.00, version=1.00,
}, },
{ {
path="/MineOS/System/Screensavers/Lines.lua", path="/MineOS/System/Screensavers/Lines.lua",
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/Screensavers/Lines.lua", url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Screensavers/Lines.lua",
type="Script", type="Script",
forceDownload=true, forceDownload=true,
version=1.00, version=1.00,

View File

@ -12,6 +12,19 @@ local args, options = shell.parse(...)
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
local paths = {
applicationList = "/MineOS/System/Applications.cfg",
}
local URLs = {
applicationList = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications.cfg",
installer = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Installer/",
EFI = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/EFI.lua",
license = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/License/",
}
------------------------------------------------------------------------------------------------------------------------------------
local reasons = {} local reasons = {}
if not _G._OSVERSION or tonumber(_G._OSVERSION:sub(8, 10)) < 1.5 then if not _G._OSVERSION or tonumber(_G._OSVERSION:sub(8, 10)) < 1.5 then
@ -46,19 +59,6 @@ end
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
local paths = {
applicationList = "/MineOS/System/Applications.cfg",
OSSettings = "/MineOS/System/Properties.cfg",
}
local urls = {
applicationList = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications.cfg",
installer = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Installer/",
EFI = "https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/EFI.lua",
}
------------------------------------------------------------------------------------------------------------------------------------
local function unserializeFile(path) local function unserializeFile(path)
local file = io.open(path, "r") local file = io.open(path, "r")
local data = serialization.unserialize(file:read("*a")) local data = serialization.unserialize(file:read("*a"))
@ -68,11 +68,11 @@ end
local function wget(url, path) local function wget(url, path)
fs.makeDirectory(fs.path(path)) fs.makeDirectory(fs.path(path))
shell.execute("wget " ..url .. " " .. path .. " -fq") shell.execute("wget " .. url .. " " .. path .. " -fq")
end end
print("Downloading MineOS file list...") print("Downloading MineOS file list...")
wget(urls.applicationList, paths.applicationList) wget(URLs.applicationList, paths.applicationList)
applicationList = unserializeFile(paths.applicationList) applicationList = unserializeFile(paths.applicationList)
print(" ") print(" ")
@ -107,6 +107,8 @@ end
local web = require("web") local web = require("web")
local buffer = require("doubleBuffering") local buffer = require("doubleBuffering")
local GUI = require("GUI") local GUI = require("GUI")
local MineOSPaths = require("MineOSPaths")
local MineOSCore = require("MineOSCore")
buffer.setResolution(gpu.maxResolution()) buffer.setResolution(gpu.maxResolution())
local mainContainer = GUI.fullScreenContainer() local mainContainer = GUI.fullScreenContainer()
@ -117,7 +119,6 @@ stageContainer:addChild(GUI.panel(1, 1, stageContainer.width, stageContainer.hei
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
local OSSettings = {}
local stages = {current = 1} local stages = {current = 1}
local localization local localization
@ -167,8 +168,8 @@ end
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
local function loadLocalization(language) local function loadLocalization(language)
OSSettings.language = language MineOSCore.properties.language = language
localization = serialization.unserialize(web.request(urls.installer .. OSSettings.language .. ".lang")) localization = serialization.unserialize(web.request(URLs.installer .. MineOSCore.properties.language .. ".lang"))
end end
stages[1] = function() stages[1] = function()
@ -212,7 +213,7 @@ end
stages[3] = function() stages[3] = function()
addButtonsToStage() addButtonsToStage()
local data = web.request("https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/MineOS/License/" .. OSSettings.language .. ".lang") local data = web.request(URLs.license .. MineOSCore.properties.language .. ".lang")
local lines = {} local lines = {}
for line in data:gmatch("[^\n]+") do for line in data:gmatch("[^\n]+") do
table.insert(lines, line) table.insert(lines, line)
@ -243,7 +244,7 @@ stages[4] = function()
local thingsToDownload = {} local thingsToDownload = {}
for i = 1, #applicationList do for i = 1, #applicationList do
if if
not applicationList[i].preLoadFile and not applicationList[i].preloadFile and
( (
(applicationList[i].type == "Library" or applicationList[i].type == "Icon") (applicationList[i].type == "Library" or applicationList[i].type == "Icon")
or or
@ -269,7 +270,7 @@ stages[4] = function()
mainContainer:draw() mainContainer:draw()
buffer.draw() buffer.draw()
web.downloadMineOSApplication(thingsToDownload[i], OSSettings.language) web.downloadMineOSApplication(thingsToDownload[i], MineOSCore.properties.language)
end end
stageContainer:deleteChildren(2) stageContainer:deleteChildren(2)
@ -278,7 +279,7 @@ stages[4] = function()
mainContainer:draw() mainContainer:draw()
buffer.draw() buffer.draw()
component.eeprom.set(web.request(urls.EFI)) component.eeprom.set(web.request(URLs.EFI))
stages.load(5) stages.load(5)
end end
@ -291,31 +292,9 @@ stages[5] = function()
stageContainer:addChild(GUI.label(1, 22, stageContainer.width, 1, 0x666666, localization.needToReboot)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top) stageContainer:addChild(GUI.label(1, 22, stageContainer.width, 1, 0x666666, localization.needToReboot)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
stageContainer:addChild(GUI.adaptiveRoundedButton(math.floor(stageContainer.width / 2 - (unicode.len(localization.reboot) + 4) / 2), stageContainer.height - 4, 2, 1, 0xAAAAAA, 0xDDDDDD, 0x777777, 0xDDDDDD, localization.reboot)).onTouch = function() stageContainer:addChild(GUI.adaptiveRoundedButton(math.floor(stageContainer.width / 2 - (unicode.len(localization.reboot) + 4) / 2), stageContainer.height - 4, 2, 1, 0xAAAAAA, 0xDDDDDD, 0x777777, 0xDDDDDD, localization.reboot)).onTouch = function()
fs.makeDirectory("/MineOS/Pictures/") MineOSCore.properties.wallpaper = stageContainer.downloadWallpapersSwitch.state and MineOSPaths.pictures .. "Road.pic" or nil
fs.makeDirectory("/MineOS/Application data/") MineOSCore.properties.showHelpOnApplicationStart = stageContainer.showApplicationsHelpSwitch.state
fs.makeDirectory("/MineOS/Trash/") MineOSCore.saveProperties()
OSSettings.wallpaper = stageContainer.downloadWallpapersSwitch.state and "/MineOS/Pictures/Road.pic" or nil
OSSettings.wallpaperEnabled = true
OSSettings.transparencyEnabled = true
OSSettings.showApplicationIcons = true
OSSettings.screensaver = "Matrix"
OSSettings.screensaverDelay = 20
OSSettings.showHelpOnApplicationStart = stageContainer.showApplicationsHelpSwitch.state
OSSettings.dockShortcuts = {
"/MineOS/Applications/AppMarket.app/",
"/MineOS/Applications/MineCode IDE.app/",
"/MineOS/Applications/Finder.app/",
"/MineOS/Applications/Photoshop.app/",
}
OSSettings.backgroundColor = 0x1E1E1E
OSSettings.network = {
users = {},
enabled = true,
signalStrength = 512,
}
table.toFile(paths.OSSettings, OSSettings)
local file = io.open("/autorun.lua", "w") local file = io.open("/autorun.lua", "w")
file:write("dofile(\"/OS.lua\")") file:write("dofile(\"/OS.lua\")")

View File

@ -1,200 +0,0 @@
local background, foreground, logoColor = 0xDDDDDD, 0x999999, 0x444444
do
_G._OSVERSION = "OpenOS 1.6"
local component = component
local computer = computer
local unicode = unicode
-- Runlevel information.
local runlevel, shutdown = "S", computer.shutdown
computer.runlevel = function() return runlevel end
computer.shutdown = function(reboot)
runlevel = reboot and 6 or 0
if os.sleep then
computer.pushSignal("shutdown")
os.sleep(0.1) -- Allow shutdown processing.
end
shutdown(reboot)
end
-- Low level dofile implementation to read filesystem libraries.
local rom = {}
function rom.invoke(method, ...)
return component.invoke(computer.getBootAddress(), method, ...)
end
function rom.open(file) return rom.invoke("open", file) end
function rom.read(handle) return rom.invoke("read", handle, math.huge) end
function rom.close(handle) return rom.invoke("close", handle) end
function rom.inits() return ipairs(rom.invoke("list", "boot")) end
function rom.isDirectory(path) return rom.invoke("isDirectory", path) end
local screen = component.list('screen', true)()
for address in component.list('screen', true) do
if #component.invoke(address, 'getKeyboards') > 0 then
screen = address
end
end
-- Report boot progress if possible.
local gpu = component.list("gpu", true)()
local w, h
if gpu and screen then
component.invoke(gpu, "bind", screen)
w, h = component.invoke(gpu, "maxResolution")
component.invoke(gpu, "setResolution", w, h)
component.invoke(gpu, "setBackground", background)
component.invoke(gpu, "setForeground", foreground)
component.invoke(gpu, "fill", 1, 1, w, h, " ")
end
local function centerText(y, text, color)
if gpu and screen then
local msgWidth = unicode.len(text)
local x = math.floor(w / 2 - msgWidth / 2)
component.invoke(gpu, "fill", 1, y, w, 1, " ")
component.invoke(gpu, "setForeground", color)
component.invoke(gpu, "set", x, y, text)
end
end
local y = math.floor(h / 2 - 1)
local function status(text)
centerText(y, "MineOS", logoColor)
centerText(y + 1, text, foreground)
end
status("Booting " .. _OSVERSION .. "...")
-- Custom low-level loadfile/dofile implementation reading from our ROM.
local function loadfile(file)
status("Loading " .. file)
local handle, reason = rom.open(file)
if not handle then
error(reason)
end
local buffer = ""
repeat
local data, reason = rom.read(handle)
if not data and reason then
error(reason)
end
buffer = buffer .. (data or "")
until not data
rom.close(handle)
return load(buffer, "=" .. file)
end
local function dofile(file)
local program, reason = loadfile(file)
if program then
local result = table.pack(pcall(program))
if result[1] then
return table.unpack(result, 2, result.n)
else
error(result[2])
end
else
error(reason)
end
end
status("Initializing package management")
-- Load file system related libraries we need to load other stuff moree
-- comfortably. This is basically wrapper stuff for the file streams
-- provided by the filesystem components.
local package = dofile("/lib/package.lua")
do
-- Unclutter global namespace now that we have the package module.
_G.component = nil
_G.computer = nil
_G.process = nil
_G.unicode = nil
-- Initialize the package module with some of our own APIs.
package.loaded.component = component
package.loaded.computer = computer
package.loaded.unicode = unicode
package.preload["buffer"] = loadfile("/lib/buffer.lua")
package.preload["filesystem"] = loadfile("/lib/filesystem.lua")
-- Inject the package and io modules into the global namespace, as in Lua.
_G.package = package
_G.io = loadfile("/lib/io.lua")()
--mark modules for delay loaded api
-- package.delayed["text"] = true
-- package.delayed["sh"] = true
-- package.delayed["transforms"] = true
-- package.delayed["term"] = true
end
status("Initializing file system")
-- Mount the ROM and temporary file systems to allow working on the file
-- system module from this point on.
require("filesystem").mount(computer.getBootAddress(), "/")
package.preload={}
status("Running boot scripts")
-- Run library startup scripts. These mostly initialize event handlers.
local scripts = {}
for _, file in rom.inits() do
local path = "boot/" .. file
if not rom.isDirectory(path) then
table.insert(scripts, path)
end
end
table.sort(scripts)
for i = 1, #scripts do
dofile(scripts[i])
end
status("Initializing components")
local primaries = {}
for c, t in component.list() do
local s = component.slot(c)
if not primaries[t] or (s >= 0 and s < primaries[t].slot) then
primaries[t] = {address=c, slot=s}
end
computer.pushSignal("component_added", c, t)
end
for t, c in pairs(primaries) do
component.setPrimary(t, c.address)
end
end
-- MineOS Init data
do
-- Загружаем необходимые библиотеки, дабы избежать потерь памяти
local shell = require("shell"); shell.setWorkingDirectory("")
local ecs = require("ECSAPI")
local component = require("component")
-- Загружаем параметры ОС (через инит-метод идет загрузка OSSettings)
require("MineOSCore")
-- Выставляем адекватный масштаб монитора
ecs.fadeOut(background, 0x1b1b1b, 0.05)
ecs.setScale(1)
-- Завершаем работу с инициализацией
os.sleep(0.1) -- Allow signal processing by libraries.
require("computer").pushSignal("init")
os.sleep(0.1) -- Allow init processing by libraries.
runlevel = 1
end
while true do
local result, reason = pcall(loadfile("bin/sh.lua"))
if not result then
io.stderr:write((reason ~= nil and tostring(reason) or "unknown error") .. "\n")
io.write("Press any key to continue.\n")
os.sleep(0.5)
require("event").pull("key")
end
end

View File

@ -849,6 +849,8 @@ end
---------------------------------------------- Сама ОС ------------------------------------------------------------------------ ---------------------------------------------- Сама ОС ------------------------------------------------------------------------
MineOSCore.localization = table.fromFile(MineOSPaths.localizationFiles .. MineOSCore.properties.language .. ".lang")
createOSWindow() createOSWindow()
changeResolution() changeResolution()
changeWallpaper() changeWallpaper()

View File

@ -2,8 +2,7 @@
require("advancedLua") require("advancedLua")
local component = require("component") local component = require("component")
local buffer = require("doubleBuffering") local buffer = require("doubleBuffering")
local GUI = require("GUI") local filesystem = require("filesystem")
local fs = require("filesystem")
local unicode = require("unicode") local unicode = require("unicode")
local MineOSPaths = require("MineOSPaths") local MineOSPaths = require("MineOSPaths")
@ -15,7 +14,7 @@ MineOSCore.localization = {}
---------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------
function MineOSCore.getCurrentScriptDirectory() function MineOSCore.getCurrentScriptDirectory()
return fs.path(getCurrentScript()) return filesystem.path(getCurrentScript())
end end
function MineOSCore.getCurrentApplicationResourcesDirectory() function MineOSCore.getCurrentApplicationResourcesDirectory()
@ -24,7 +23,7 @@ end
function MineOSCore.getLocalization(pathToLocalizationFolder) function MineOSCore.getLocalization(pathToLocalizationFolder)
local localizationFileName = pathToLocalizationFolder .. MineOSCore.properties.language .. ".lang" local localizationFileName = pathToLocalizationFolder .. MineOSCore.properties.language .. ".lang"
if fs.exists(localizationFileName) then if filesystem.exists(localizationFileName) then
return table.fromFile(localizationFileName) return table.fromFile(localizationFileName)
else else
error("Localization file \"" .. localizationFileName .. "\" doesn't exists") error("Localization file \"" .. localizationFileName .. "\" doesn't exists")
@ -38,7 +37,7 @@ end
----------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------
function MineOSCore.createShortcut(where, forWhat) function MineOSCore.createShortcut(where, forWhat)
fs.makeDirectory(fs.path(where)) filesystem.makeDirectory(filesystem.path(where))
local file = io.open(where, "w") local file = io.open(where, "w")
file:write(forWhat) file:write(forWhat)
file:close() file:close()
@ -59,7 +58,42 @@ function MineOSCore.saveProperties()
end end
function MineOSCore.loadPropeties() function MineOSCore.loadPropeties()
MineOSCore.properties = table.fromFile(MineOSPaths.properties) if filesystem.exists(MineOSPaths.properties) then
MineOSCore.properties = table.fromFile(MineOSPaths.properties)
else
MineOSCore.properties = {
language = "Russian",
transparencyEnabled = true,
showApplicationIcons = true,
screensaver = "Matrix",
screensaverDelay = 20,
showHelpOnApplicationStart = true,
dockShortcuts = {
MineOSPaths.applications .. "AppMarket.app/",
MineOSPaths.applications .. "MineCode IDE.app/",
MineOSPaths.applications .. "Finder.app/",
MineOSPaths.applications .. "Photoshop.app/",
},
backgroundColor = 0x1E1E1E,
network = {
users = {},
enabled = true,
signalStrength = 512,
},
extensionAssociations = {},
}
MineOSCore.associateExtension(".pic", MineOSPaths.applications .. "/Photoshop.app/Main.lua", MineOSPaths.icons .. "/Image.pic", MineOSPaths.extensionAssociations .. "Pic/ContextMenu.lua")
MineOSCore.associateExtension(".txt", MineOSPaths.editor, MineOSPaths.icons .. "/Text.pic")
MineOSCore.associateExtension(".cfg", MineOSPaths.editor, MineOSPaths.icons .. "/Config.pic")
MineOSCore.associateExtension(".3dm", MineOSPaths.applications .. "/3DPrint.app/Main.lua", MineOSPaths.icons .. "/3DModel.pic")
MineOSCore.associateExtension("script", MineOSPaths.extensionAssociations .. "Lua/Launcher.lua", MineOSPaths.icons .. "/Script.pic", MineOSPaths.extensionAssociations .. "Lua/ContextMenu.lua")
MineOSCore.associateExtension(".lua", MineOSPaths.extensionAssociations .. "Lua/Launcher.lua", MineOSPaths.icons .. "/Lua.pic", MineOSPaths.extensionAssociations .. "Lua/ContextMenu.lua")
MineOSCore.associateExtension(".pkg", MineOSPaths.extensionAssociations .. "Pkg/Launcher.lua", MineOSPaths.icons .. "/Archive.pic")
MineOSCore.saveProperties()
end
end end
----------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------
@ -87,15 +121,15 @@ end
function MineOSCore.associationsExtensionAutomatically() function MineOSCore.associationsExtensionAutomatically()
local path, extension = MineOSPaths.extensionAssociations local path, extension = MineOSPaths.extensionAssociations
for file in fs.list(path) do for file in filesystem.list(path) do
if fs.isDirectory(path .. file) then if filesystem.isDirectory(path .. file) then
extension = "." .. unicode.sub(file, 1, -2) extension = "." .. unicode.sub(file, 1, -2)
if fs.exists(path .. file .. "ContextMenu.lua") then if filesystem.exists(path .. file .. "ContextMenu.lua") then
MineOSCore.associateExtensionContextMenu(extension, path .. file .. "Context menu.lua") MineOSCore.associateExtensionContextMenu(extension, path .. file .. "Context menu.lua")
end end
if fs.exists(path .. file .. "Launcher.lua") then if filesystem.exists(path .. file .. "Launcher.lua") then
MineOSCore.associateExtensionLauncher(extension, path .. file .. "Launcher.lua") MineOSCore.associateExtensionLauncher(extension, path .. file .. "Launcher.lua")
end end
end end
@ -174,7 +208,7 @@ function MineOSCore.safeLaunch(path, ...)
local oldResolutionWidth, oldResolutionHeight = buffer.width, buffer.height local oldResolutionWidth, oldResolutionHeight = buffer.width, buffer.height
local finalSuccess, finalPath, finalLine, finalTraceback = true local finalSuccess, finalPath, finalLine, finalTraceback = true
if fs.exists(path) then if filesystem.exists(path) then
local loadSuccess, loadReason = loadfile("/" .. path) local loadSuccess, loadReason = loadfile("/" .. path)
if loadSuccess then if loadSuccess then
local success, path, line, traceback = MineOSCore.call(loadSuccess, ...) local success, path, line, traceback = MineOSCore.call(loadSuccess, ...)
@ -186,7 +220,7 @@ function MineOSCore.safeLaunch(path, ...)
finalSuccess, finalPath, finalLine, finalTraceback = false, path, tonumber(match) or 1, loadReason finalSuccess, finalPath, finalLine, finalTraceback = false, path, tonumber(match) or 1, loadReason
end end
else else
GUI.error("Failed to safely launch file that doesn't exists: \"" .. path .. "\"") require("GUI").error("Failed to safely launch file that doesn't exists: \"" .. path .. "\"")
end end
component.screen.setPrecise(false) component.screen.setPrecise(false)
@ -198,29 +232,6 @@ end
----------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------
MineOSCore.loadPropeties() MineOSCore.loadPropeties()
MineOSCore.localization = table.fromFile(MineOSPaths.localizationFiles .. MineOSCore.properties.language .. ".lang")
fs.makeDirectory(MineOSPaths.trash)
MineOSCore.properties.extensionAssociations = MineOSCore.properties.extensionAssociations or {}
MineOSCore.associateExtension(".pic", MineOSPaths.applications .. "/Photoshop.app/Main.lua", MineOSPaths.icons .. "/Image.pic", MineOSPaths.extensionAssociations .. "Pic/ContextMenu.lua")
MineOSCore.associateExtension(".txt", MineOSPaths.editor, MineOSPaths.icons .. "/Text.pic")
MineOSCore.associateExtension(".cfg", MineOSPaths.editor, MineOSPaths.icons .. "/Config.pic")
MineOSCore.associateExtension(".3dm", MineOSPaths.applications .. "/3DPrint.app/Main.lua", MineOSPaths.icons .. "/3DModel.pic")
MineOSCore.associateExtension("script", MineOSPaths.extensionAssociations .. "Lua/Launcher.lua", MineOSPaths.icons .. "/Script.pic", MineOSPaths.extensionAssociations .. "Lua/ContextMenu.lua")
MineOSCore.associateExtension(".lua", MineOSPaths.extensionAssociations .. "Lua/Launcher.lua", MineOSPaths.icons .. "/Lua.pic", MineOSPaths.extensionAssociations .. "Lua/ContextMenu.lua")
MineOSCore.associateExtension(".pkg", MineOSPaths.extensionAssociations .. "Pkg/Launcher.lua", MineOSPaths.icons .. "/Archive.pic")
MineOSCore.saveProperties()
-- buffer.clear(0x0)
-- buffer.draw(true)
-- local cykaContainer = GUI.fullScreenContainer()
-- cykaContainer:addChild(GUI.panel(1, 1, cykaContainer.width, cykaContainer.height, 0xFF0000))
-- GUICopy(cykaContainer, "/MineOS/papka/", "/MineOS/mamka/", true)
----------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------

View File

@ -1,4 +1,5 @@
local filesystem = require("filesystem")
local MineOSPaths = {} local MineOSPaths = {}
---------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------
@ -7,7 +8,7 @@ MineOSPaths.OS = "/MineOS/"
MineOSPaths.downloads = MineOSPaths.OS .. "Downloads/" MineOSPaths.downloads = MineOSPaths.OS .. "Downloads/"
MineOSPaths.system = MineOSPaths.OS .. "System/" MineOSPaths.system = MineOSPaths.OS .. "System/"
MineOSPaths.applicationData = MineOSPaths.system .. "Application data/" MineOSPaths.applicationData = MineOSPaths.system .. "Application data/"
MineOSPaths.extensionAssociations = MineOSPaths.system .. "ExtensionAssociations/" MineOSPaths.extensionAssociations = MineOSPaths.system .. "Extensions/"
MineOSPaths.localizationFiles = MineOSPaths.system .. "Localization/" MineOSPaths.localizationFiles = MineOSPaths.system .. "Localization/"
MineOSPaths.icons = MineOSPaths.system .. "Icons/" MineOSPaths.icons = MineOSPaths.system .. "Icons/"
MineOSPaths.applications = MineOSPaths.OS .. "Applications/" MineOSPaths.applications = MineOSPaths.OS .. "Applications/"
@ -21,4 +22,10 @@ MineOSPaths.explorer = MineOSPaths.applications .. "/Finder.app/Main.lua"
---------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------
filesystem.makeDirectory(MineOSPaths.pictures)
filesystem.makeDirectory(MineOSPaths.applicationData)
filesystem.makeDirectory(MineOSPaths.trash)
----------------------------------------------------------------------------------------------------------------
return MineOSPaths return MineOSPaths