Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions Applications/EFI Flasher/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,31 @@ local dumpFileName = "Dump" .. math.random(1, 1000) .. ".efi"
---------------------------------------------
fs.makeDirectory(defaultPath)
-------------mainWindow--------------------
local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.filledWindow(1, 1, 88, 26, 0xF0F0F0))
local mainContainer, window = MineOSInterface.addWindow(GUI.filledWindow(1, 1, 88, 26, 0xF0F0F0))
local container = window:addChild(GUI.container(1, 1, window.width, window.height))
layout = container:addChild(GUI.layout(1, 1, window.width, window.height, 1, 1))
layout:setGridSize(3,1)
layout = container:addChild(GUI.layout(1, 1, window.width, window.height, 3, 1))
----------------------------------------------drawingInterface-----------------
local filesystemChooser = layout:addChild(GUI.filesystemChooser(2, 2, 25, 3, 0xE1E1E1, 0x888888, 0x3C3C3C, 0x888888, nil, "Open", "Cancel", "Choose", "/"))
filesystemChooser.onSubmit = function(path)
local file = io.open(path, "r")
flashFile = file:read("*a")
end
local button1 = layout:setCellPosition(2, 1, layout:addChild(GUI.button(2, 2, 25, 3, 0xFFFFFF, 0x555555, 0x880000, 0xFFFFFF, "Dump")))
local button1 = layout:setPosition(2, 1, layout:addChild(GUI.button(2, 2, 25, 3, 0xFFFFFF, 0x555555, 0x880000, 0xFFFFFF, "Dump")))
button1.onTouch = function()
local dumpFile = io.open(defaultPath .. dumpFileName, "w")
dumpFile:write(component.eeprom.get())
dumpFile:close()
dumpFileName = "Dump" .. math.random(1, 1000) .. ".efi"
GUI.error("Dumped File, filename is: " .. dumpFileName)
GUI.alert("Dumped File, filename is: " .. dumpFileName)
end
local button2 = layout:setCellPosition(3, 1, layout:addChild(GUI.button(2, 2, 25, 3, 0xFFFFFF, 0x555555, 0x880000, 0xFFFFFF, "Flash")))
local button2 = layout:setPosition(3, 1, layout:addChild(GUI.button(2, 2, 25, 3, 0xFFFFFF, 0x555555, 0x880000, 0xFFFFFF, "Flash")))
button2.onTouch = function()
component.eeprom.set(flashFile)
GUI.error("Flashed EEPROM")
GUI.alert("Flashed EEPROM")
end
layout:setCellFitting(3, 1, true, false, 1)
layout:setCellFitting(2, 1, true, false, 1)
layout:setCellFitting(1, 1, true, false, 1)
layout:setFitting(3, 1, true, false, 1)
layout:setFitting(2, 1, true, false, 1)
layout:setFitting(1, 1, true, false, 1)
---------------------------
window.onResize = function(width, height)
window.backgroundPanel.width = width
Expand All @@ -45,7 +44,6 @@ window.onResize = function(width, height)
layout.width = width
layout.height = height - 3
end
mainContainer:draw()
container:draw()
buffer.draw(true)
mainContainer:startEventHandling()

mainContainer:drawOnScreen()
mainContainer:startEventHandling()