Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local image = require("image")
- local GUI = require("GUI")
- local text1
- local text2
- local text11
- local text22
- local slovo
- local g
- function saveascii()
- file = io.open("ascii.txt", "a")
- file:write(g)
- file:close()
- end
- function openascii()
- file = io.open("ascii.txt", "r")
- buf = file:read()
- file:close()
- end
- function clearascii()
- file = io.open("ascii.txt", "wb")
- file:close()
- end
- function code()
- clearascii()
- for i = 1,string.len(text1.text) do
- g = string.byte(text1.text,i).. "/"
- saveascii()
- end
- openascii()
- text2.text = buf
- end
- local s
- local ss
- local sl
- local i
- function decode()
- clearascii()
- s = 1
- while true do
- if (s + 1) > string.len(text2.text) then break end
- ss = string.find(text2.text,"/",s)
- sl = string.sub(text2.text,s,ss-1)
- g = string.char(sl)
- saveascii()
- s = ss + 1
- end
- openascii()
- text1.text = buf
- end
- local application = GUI.application()
- application:addChild(GUI.panel(1, 1, application.width, application.height, 0x1E1E1E))
- local window = application:addChild(GUI.titledWindow(50, 22, 60, 25, "ASCII +", true))
- window.actionButtons.close.onTouch = function()
- window2:close()
- application:draw()
- end
- local layout = window:addChild(GUI.layout(1, 2, window.width, window.height - 1, 1, 1))
- layout:addChild(GUI.button(1, 1, 36, 3, 0xB4B4B4, 0xFFFFFF, 0x969696, 0xB4B4B4, "code")).onTouch = function()
- code()
- end
- layout:addChild(GUI.button(1, 1, 36, 3, 0xB4B4B4, 0xFFFFFF, 0x969696, 0xB4B4B4, "decode")).onTouch = function()
- decode()
- end
- text1 = layout:addChild(GUI.input(1, 1, 40, 3, 0xFFFFFF, 0x555555, 0x999999, 0xFFFFFF, 0x2D2D2D, "", "code"))--.onInputFinished = function()
- text2 = layout:addChild(GUI.input(2, 2, 40, 3, 0xFFFFFF, 0x555555, 0x999999, 0xFFFFFF, 0x2D2D2D, "", "decode"))
- layout:addChild(GUI.button(1, 1, 36, 3, 0xB4B4B4, 0xFFFFFF, 0x969696, 0xB4B4B4, "clear")).onTouch = function()
- text1.text = ""
- text2.text = ""
- end
- application:draw(true)
- application:start()
Advertisement
Add Comment
Please, Sign In to add comment