Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[local function Decompile(CompiledTbl)
- local Str = ''
- for k, v in pairs(CompiledTbl) do
- Str = Str .. string.char(v)
- end
- return Str
- end
- local function Compile(Str)
- local Compiled = {string.byte(Str,1,#tostring(Str))}
- return Compiled, table.concat(Compiled, ',')
- end
- local Compiled, Concat = Compile('{HelloWorld = "mikkel809h"}')
- print(Concat)
- local Decompiled = Decompile(Compiled)
- print(Decompiled)
- --]]
- local Path = '/'
- local Contents = {}
- local function GetDir(Path)
- if Path:find('rom/') then
- else
- local List = fs.list(Path or '/')
- for k, v in pairs(List) do
- local CurrentPath = Path..fs.getName(
- fs.combine(
- Path,
- v
- )
- )
- if fs.isDir(CurrentPath) then
- CurrentPath = CurrentPath .. '/'
- end
- print(tostring(CurrentPath))
- if fs.isDir(CurrentPath) then
- GetDir(CurrentPath)
- else
- local File = fs.open(CurrentPath, 'r')
- if File then
- local Data = File.readAll()
- -- Compile data --
- --Data = --{string.byte(Data,1,#tostring(Data))}
- --print(table.concat(Data, ', '))
- --os.pullEvent()
- File.close()
- Contents[CurrentPath] = Data
- os.queueEvent('Ping')
- os.pullEvent('Ping')
- end
- end
- end
- end
- end
- --GetDir(Path)
- --print('Waiting for input...')
- --os.pullEvent('key')
- --term.clear()
- --term.setCursorPos(1,1)
- Compiled = fs.open('Compiled', 'r')
- Decompiled = textutils.serialize(Compiled.readAll())
- Compiled.close()
- local Decompiled = {}
- for k, v in pairs(Contents) do
- Decompiled[k] = ''
- for i, j in pairs(v) do
- print(i .. ' -> ' .. tostring(string.char(j)))
- Decompiled[k] = Decompiled[k]..string.char(j)
- end
- end
- for k, v in pairs(Decompiled) do
- Decompiled = fs.open(k, 'w')
- Decompiled.write(v)
- Decompiled.close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement