有两种文件
1.Utf-8格式的文本内容
2.非Utf-8的任意内容
前者可以使用io.open来写入和读取
后者就需要针对性的去操作二进制与十六进制来实现
?
file = {
--判断文件是否存在
exist = (function(file) local sFlie,Err = io.open(file,"r+");if Err~=nil then return false end sFlie:close();return true end),
--读取文件内容
read = (function(file) local sFlie,Err = io.open(file,"r");if Err~=nil then return nil end local _tmp = sFlie:read("*all");sFlie:close();return _tmp end),
--读取文件内容并转化成 table
totable = (function(file) local _tmp = {};local sFlie,Err = io.open(file,"r");if Err~=nil then return {} end;for _line in sFlie:lines() do table.insert(_tmp, string.match(_line,"%C+")) end;sFlie:close();return _tmp; end),
--保存文件内容
save = (function(file,data,append) local sFlie,Err = io.open(file,(append and "a") or "w");sFlie:write(data..((append and "\n") or ""));sFlie:close() end),
--删除
delete = (function(file) os.remove(file) end)
}
function ReadHex(File) --16进制读取文件
local F,Err = io.open(File, "rb")
local HexStr=""
if Err==nil then
while true do
local bytes = F:read(1)
if not bytes then break end
HexStr = HexStr .. string.format("X", string.byte(bytes))
end
F:close();
return HexStr
else
return ""
end
end
function HexToRes(name,hexstr) --16进制写入文件
local bytesfile = io.open("/usr/bin/..name","wb")
if nil == bytesfile then
dialog("Can not open output file to write!\n",0)
return
end
for i = 1, string.len(hexstr) - 1, 2 do
local doublebytestr = string.sub(hexstr, i, i+1)
local n = tonumber(doublebytestr, 16)
if 0 == n then
bytesfile:write('\00')
else
bytesfile:write(string.format("%c", n))
end
end
bytesfile:close()
end
这里是执行部分代码 因为我主要是在PC端打包内容后写入脚本内即可
所以我这里写的都是在PC端实现(具体加载要用抓色器,抓色器已经内置了sz.so,然而@十五(田总)要跟他提要求了)
?
?
PS:注意这里很严重的一点 如果用
''..
''..
''
这种方式的换行连接
最多只能用200行
这个算是Lua蛋疼的地方(实际还有很多,你们慢慢体会把)
?
file.delete('E:\\11.txt')
str = ReadHex('E:\\lsqlite3.so')
print(string.len(str))
for l = 1, string.len(str),3000 do
?? ?print(l..'行')
?? ?file.save('E:\\11.txt',"'"..string.sub(str,l,l+2999).."' ..",true)
end
一下是我应用到的地方
仅供参考
没啥意义
?
--====换IP
XChangeIP = {"老款TP-Link","VPN","不换IP"}
function _ChangeIP(IPType,IP,User,Pass)
local Tmp = {}
Tmp.IP, Tmp.User, Tmp.Pass = IP, User, Pass
function Tmp.NowIP()
local GetIP="ht://ttaozi.com/taocloud/"
return Tmp.Get(GetIP)
end
function Tmp.Change()
local GetIP="ht://ttaozi.com/taocloud/"
local oldIP,nowIP,TP_Disconnect,TP_Connect = "","","/userRpm/StatusRpm.htm?Disconnect=%B6%CF%20%CF%DF&wan=1","/userRpm/StatusRpm.htm?Connect=%E8%BF%9E%20%E6%8E%A5&wan=1"
if IPType == "老款TP-Link" then
oldIP = Tmp.Get(GetIP)
Tmp.Get("ht://" .. Tmp.User .. ":" .. Tmp.Pass .. "@" .. Tmp.IP .. TP_Disconnect)
--dialogRet("更换前IP:\n"..oldIP.."\n断网等待20秒\n请勿中断\n以免无网出错","","","",20)
dialog("更换前IP:\n"..oldIP.."\n断网等待20秒\n点击确定跳过",20)
Tmp.Get("ht://" .. Tmp.User .. ":" .. Tmp.Pass .. "@" .. Tmp.IP .. TP_Connect)
while true do
mSleep(1000)
nowIP = Tmp.Get(GetIP)
if nowIP == oldIP then
Tmp.Get("ht://" .. Tmp.User .. ":" .. Tmp.Pass .. "@" .. Tmp.IP .. TP_Disconnect)
--dialogRet("IP:"..oldIP.."\n转至\nIP:"..nowIP.."\nIP重复或错误\n重新断网连接\n请检查错误\n并勿中断网络","","","",20)
dialog("IP:"..oldIP.."\n转至\nIP:"..nowIP.."\nIP重复或错误\n重新断网连接\n点击确定跳过",20)
Tmp.Get("ht://" .. Tmp.User .. ":" .. Tmp.Pass .. "@" .. Tmp.IP .. TP_Connect)
else
break
end
end
::Errr::
dialogRet("IP:"..oldIP.."\n转至\nIP:"..nowIP,"","","",2)
end
if IPType == "VPN" then
local BendiIP = ""
if runApp("libactivator")~=0 then
dialog("请安装activator",0);lua_exit()
end
mSleep(1000)
closeApp("libactivator")
mSleep(1000)
oldIP = Tmp.Get(GetIP)
os.execute("activator send switch-off.com.a3tweaks.switch.vpn")
BendiIP = Tmp.Get(GetIP)
dialogRet("本地IP:"..BendiIP.."\nIP:"..oldIP.."\nVPN换网中请等待","","","",5)
os.execute("activator send switch-on.com.a3tweaks.switch.vpn")
mSleep(5000)
while true do
mSleep(1000)
nowIP = Tmp.Get(GetIP)
if nowIP == oldIP then
os.execute("activator send switch-off.com.a3tweaks.switch.vpn")
BendiIP = Tmp.Get(GetIP)
dialogRet("本地IP:"..BendiIP.."\nIP:"..oldIP.."\nVPN换网中请等待,IP重复等原因","","","",5)
os.execute("activator send switch-on.com.a3tweaks.switch.vpn")
mSleep(5000)
else
break
end
end
dialogRet("IP:"..oldIP.."\n转至\nIP:"..nowIP,"","","",2)
end
if IPType == "不换IP" then
end
end
function Tmp.Get(Sever)
if F_Exist("/Applications/TouchSprite.app/libs/ht.so")==false then
dialog("缺少ht.so\n开始下载插件",1)
Saveht()
end
local ht = require("ht")
while true do
Status_resp, headers_resp, body_resp = ht.get(Sever,10)
if Status_resp ~= nil then
break
else
dialog("等待1秒重试\n\n" .. Sever,1)
mSleep(1000)
end
end
return body_resp
end
function Saveht()
local htHex = "CEFAEDFE0C0000000900000008000000110000003C0800008500000001000000140200005F5F544558540000000000000000000000000000002000000000000000200000050000000500000007000000000000005F5F7465787400000000000000000000" ..
"5F5F5445585400000000000000000000480A00008E100000480A00000200000000000000000000000004008000000000000000005F5F737475625F68656C7065720000005F5F5445585400000000000000000000D81A0000C0000000D81A000002000000" ..
"00000000000000000004008000000000000000005F5F63737472696E67000000000000005F5F5445585400000000000000000000981B000069000000981B00000000000000000000000000000200000000000000000000005F5F6F626A635F6D6574686E" ..
"616D65005F5F5445585400000000000000000000011C000075030000011C00000000000000000000000000000200000000000000000000005F5F6F626A635F636C6173736E616D655F5F5445585400000000000000000000761F000014000000761F0000" ..
"0000000000000000000000000200000000000000000000005F5F6F626A635F6D65746874797065005F5F54455854000000000000000000008A1F00003F0000008A1F00000000000000000000000000000200000000000000000000005F5F73796D626F6C" ..
"73747562310000005F5F5445585400000000000000000000CC1F000034000000CC1F000002000000000000000000000008040080000000000400000001000000240300005F5F444154410000000000000000000000200000001000000020000000100000" ..
"03000000030000000B000000000000005F5F6C617A795F73796D626F6C0000005F5F4441544100000000000000000000002000003400000000200000020000000000000000000000070000000D000000000000005F5F6E6C5F73796D626F6C5F70747200" ..
"5F5F4441544100000000000000000000342000000C00000034200000020000000000000000000000060000001A000000000000005F5F636F6E73740000000000000000005F5F444154410000000000000000000040200000580000004020000002000000" ..
"00000000000000000000000000000000000000005F5F6366737472696E670000000000005F5F44415441000000000000000000009820000070000000982000000200000000000000000000000000000000000000000000005F5F6F626A635F636C617373" ..
"6C6973745F5F44415441000000000000000000000821000004000000082100000200000000000000000000000000001000000000000000005F5F6F626A635F6361746C69737400005F5F44415441000000000000000000000C210000080000000C210000" ..
"0200000000000000000000000000001000000000000000005F5F6F626A635F696D616765696E666F5F5F44415441000000000000000000001421000008000000142100000200000000000000000000000000000000000000000000005F5F6F626A635F63" ..
"6F6E7374000000005F5F44415441000000000000000000001C210000EC0000001C2100000200000000000000000000000000000000000000000000005F5F6F626A635F73656C7265667300005F5F444154410000000000000000000008220000A4000000" ..
"082200000200000000000000000000000500001000000000000000005F5F6F626A635F636C617373726566735F5F4441544100000000000000000000AC22000028000000AC2200000200000000000000000000000000001000000000000000005F5F6F62" ..
"6A635F6461746100000000005F5F4441544100000000000000000000D422000028000000D422000002000000000000000000000000000000000000000000000001000000380000005F5F4C494E4B45444954000000000000003000000010000000300000" ..
"E80A00000100000001000000000000000000000022000080300000000030000028000000283000000C02000000000000000000003432000020010000543300005C0000000200000018000000D433000032000000A0360000480400000B00000050000000" ..
"00000000130000001300000003000000160000001C0000000000000000000000000000000000000000000000000000002C3600001D000000000000000000000000000000000000001B00000018000000C9D74DCE4A4F3ED7B46AD11BDDB7399F25000000" ..
"1000000000030400000108000C00000054000000180000000200000000000000000000002F4C6962726172792F4672616D65776F726B732F43796469615375627374726174652E6672616D65776F726B2F4379646961537562737472617465000C000000" ..
"5400000018000000020000000001750400002C012F53797374656D2F4C6962726172792F4672616D65776F726B732F466F756E646174696F6E2E6672616D65776F726B2F466F756E646174696F6E00000C0000004C00000018000000020000000E10F60C" ..
"000001002F53797374656D2F4C6962726172792F4672616D65776F726B732F55494B69742E6672616D65776F726B2F55494B6974000000000C0000003400000018000000020000000000BD04000001002F7573722F6C69622F6C696253797374656D2E42" ..
"2E64796C696200000C00000034000000180000000200000000000800000001002F7573722F6C69622F6C69626763635F732E312E64796C69620000000C0000005C0000001800000002000000000E7504000096002F53797374656D2F4C6962726172792F" ..
"4672616D65776F726B732F436F7265466F756E646174696F6E2E6672616D65776F726B2F436F7265466F756E646174696F6E00000C0000003400000018000000020000000000E400000001002F7573722F6C69622F6C69626F626A632E412E64796C6962" ..
"000000002600000010000000B0330000240000002900000010000000D43300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"0000000000000000000000000000000000000000000000000000000000000000F0B503AF2DE9000D86B0044641F2DC50C0F200007844D0F800A041F29A70C0F200007844DAF8001005910168204601F0C2EA054641F28470C0F2000078440168204601F0" ..
"B8EAE84601462846424601F0ACEA41F26270C0F2000041F2FC72C0F2000278447A4401681068282201F0A2EA054641F24A70C0F2000041F2C85B7844C0F2000BFB440024066818F80430284631465A4601F08EEA0134142CF5D10598DAF80010081A04D1" ..
"284606B0BDE8000DF0BD01F07CEA00BFF0B503AF2DE9000D85B0044641F22450C0F200007844D0F800A041F2E260C0F200007844DAF8001004910168204601F066EA054641F2CC60C0F2000078440168204601F05CEAE84601462846424601F04EEA41F2" ..
"AA60C0F2000041F24472C0F2000278447A4401681068202201F046EA054641F29260C0F2000041F2105B7844C0F2000BFB440024066818F80430284631465A4601F032EA0134102CF5D10498DAF80010081A04D1284605B0BDE8000DF0BD01F020EA00BF" ..
"80B541F24E610022C0F200016F467944096801F018EA80BD90B5044641F23460C0F2000041F2C662C0F2000278447A4401AF0168106801F006EA41F21E612246C0F2000100237944096801F0FCE990BDF0B503AF2DE9000DA8B041F21A401546C0F20000" ..
"98467844D0F800B041F2E450C0F2000041F27661C0F200017844DBF8002079442792046808680594214601F0DAE941F2CE51C0F200017944096801F0D2E941F24A61C0F2000141F2B852C0F2000279447A4416900E6828461168042201F0C0E9024641F2" ..
"A250C0F2000078440168304601F0B6E9054641F21C60C0F2000021467844006801F0ACE941F27A51BA68C0F20001CDF80080794401922A460123096801F09EE9064641F26250C0F20000D7F80CA0784405685046294601F092E941F24E51C0F2000141F2" ..
"B8327944C0F200027A440C68214601F084E9D7F8108010F0FF0F0DD0CDF820B041F22850C0F2000041F29E327844C0F200027A44016831E05046294601F06CE941F296322146C0F200027A4401F064E910F0FF0F00F03F81CDF820B041F2EC40C0F20000" ..
"41F282327844C0F200027A447C690168304601F050E941F2D4400422C0F2000078440168204601F046E9024641F2C440C0F200007844016830460C9601F03AE941F2AA400422C0F20000784401684046079101F030E9044641F26040C0F2000078440168" ..
"2046069101F024E9002800F0878041F278400423C0F2000041F2EE42C0F2000278447A440168106816AA0092224601F010E9054641F25840C0F2000041F2CE42C0F2000278447A440168106801F000E9024641F24640C0F2000078440168284601F0F6E8" ..
"10F0FF0F00F0CC8041F226400EACC0F20000C0EF500004F1100178440B9541F98F0A0168284644F98F0A01F0E0E80A9041F20A41C0F200011022794417AB009222460968099101F0D2E80446A4B341F2EC30C0F2000041F2E631C0F20001109A78447944" ..
"D0F800B0D1F800A0D2F8008000251098006840451CBF0A9801F0B4E80F98514650F825600B98324601F0AEE802460C985946334601F0A8E80135A542E7D31020099900900EAA0A9817AB01F09EE80446002CDBD141F286300021C0F2000041F2E832C0F2" ..
"000278447A440D9101680DAB10680DF1580A0C9ACDF800A001F084E8BC69804607990422204601F07EE8069901F07AE850B141F24E302246C0F20000012378440168404601F06EE841F23E31C0F200010D987944096801F066E8044641F23030C0F20000" ..
"784401680D9801F05CE8DDF820B00646002E2CD041F26E30C0F2000005997844006801F04EE8054641F2FC20C0F2000041F24632C0F2000278447A440123016810683246CDF800A001F03AE8024641F2E020C0F20000042378440168284601F030E8F969" ..
"0860386AC0F8008009E04FF0FF3406E04FF0FF34DDF820B001E04FF0FF342798DBF80010081A04D1204628B0BDE8000DF0BD01F010E800BFF0B503AF4DF8048D82B041F224201446C0F2000041F2BA22C0F2000278447A4498460168106800F0FEEF41F2" ..
"1621C0F200017944096800F0F6EF41F21E210422C0F20001019079442046096800F0EAEF0246002A4CD041F20620C0F2000041F27C23C0F2000378447B440168186801AB0093042300F0D6EF044641F2E610C0F2000041F25C21C0F20001784479440568" ..
"0868294600F0C6EF024641F2D210C0F20000784406682046314600F0BCEF10F0FF0F1DD041F2C2104246C0F2000078440168204600F0AEEF044641F21C20C0F2000029467844006800F0A4EF02462046314600F0A0EF10F0FF0F08BF002400E000242046" ..
"02B05DF8048BF0BDF0B503AF2DE9000DA3B040F650701446C0F2000078440168019141F21810C0F2000041F2AE12C0F20002096878447A4422910168106800F078EF41F20A11C0F200017944096800F070EF41F212110422C0F200011190794420460968" ..
"00F064EF0246002A00F0AA8041F2F800C0F2000041F26E13C0F2000378447B440168186811AB0093042300F050EF054641F2D800C0F2000041F24E12C0F2000278447A440168106800F040EF024641F2C600C0F2000078440168284600F036EF10F0FF0F" ..
"00F07E8041F2A60009ACC0F20000C0EF500004F11001784441F98F0A0168284644F98F0A00F020EF039041F28C01C0F200011022794412AB009222460968029100F012EF089000285CD0079541F28200C0F2000041F22801C0F200010B9A41F25A037844" ..
"C0F2000379447B44006806901868059040F6D066C0F20006D1F800807E44106804904FF0000A0B980499006888421CBF039800F0E6EE0A98059950F82AB007985A4600F0E0EE054658464146042200F0DAEE044628464146042200F0D4EE009030460699" ..
"40F68E62C0F2000223467A4400F0C8EE06460AF1010A08988245D2D310200299009009AA039812AB00F0BAEE08900028C5D108E0002606E0002604E040F64466C0F200067E44229801990968081A04D1304623B0BDE8000DF0BD00F09EEE00BF90B50446" ..
"00210A2201AF00F08AEE40F666512046C0F200010022794400F07EEE012090BDF0B503AF2DE9000D8CB083460121002200F06CEEF1EE040B06465846022153EC302B00F068EE09905846089140F6E602C0F2000203217A44002300F05AEE054640F6E860" ..
"C0F2000040F69674C0F2000478447C44D0F800802068414600F05EEE40F630713246C0F2000104237944D1F800A0514600F052EE07904146206800F04EEE51462A46042300F048EE09990DF12809089A0DF12C0C42EC301B40F61271C0F2000140F63C72" ..
"BDEEE00BC0F200027A447944126840F63A55C0F2000540F60C56C0F2000609687E447D44F8EEC00B54EC303B8DE8500002901046079A03950495CDF814C0CDF8189000F018EE05460020B5F1FF3F39D040F658610422C0F200010B987944096800F008EE" ..
"064640F60A60C0F20000DDF82880784404683046214600F0FCED82464046214600F0F6ED04465846294600F0E4ED40F6E650C0F20000784405683046294600F0E8ED02465846514600F0D6ED4046294600F0DEED02465846214600F0CEED03200CB0BDE8" ..
"000DF0BDF0B503AF2DE9000D8DB080460121002200F0B2EDF1EE040B06464046022153EC302B00F0AEED0A904046099140F27275C0F2000503217D4400232A4600F09EED0446404604212A46002300F098ED079040F66450C0F2000040F61265C0F20005" ..
"78447D44D0F800A02868514600F09CED40F6AC513246C0F2000104237944D1F800B0594600F090ED08905146286800F08CED59462246042300F086ED06462868514600F082ED079A5946042300F07CED0A990DF12C09099A0DF1300C42EC301B40F67A51" ..
"C0F2000140F6A452BDEEE00BC0F200027A447944126840F6A23EC0F2000E40F69435C0F2000509687D44FE44F8EEC00B54EC303B8DE8700003901046089ACDF810E0CDF814C0CDF8189000F04CED05460020B5F1FF3F39D040F6C0410422C0F200010C98" ..
"7944096800F03CED064640F67240C0F20000DDF82CA0784404683046214600F030ED83465046214600F02AED04464046294600F018ED40F64E40C0F20000784405683046294600F01CED02464046594600F00AED5046294600F012ED02464046214600F0" ..
"02ED03200DB0BDE8000DF0BDB0B502AF81B00446002000906A462046012100F0E6EC054640F60440C0F2000040F6B242C0F2000278447A440168106800F0EEEC40F650412A46C0F2000104237944096800F0E4EC40F6FE310422C0F200017944096800F0" ..
"DCEC40F65241C0F200017944096800F0D4EC40F62E41C0F200017944096800F0CCEC0146204600F0BEEC012001B0B0BDB0B502AF81B00446002000906A462046012100F0A2EC054640F67C30C0F2000040F62A42C0F2000278447A440168106800F0AAEC" ..
"40F6C8312A46C0F2000104237944096800F0A0EC40F676310422C0F200017944096800F098EC40F6C631C0F200017944096800F090EC40F6A631C0F200017944096800F088EC0146204600F07AEC012001B0B0BDF0B503AF81B00446002000906A462046" ..
"012100F05EEC024640F67030C0F2000040F68633C0F2000378447B4401681868009B00F066EC40F65E31C0F200017944096800F05EEC40F6F0210422C0F200017944096800F054EC054640F6A620C0F2000078440168284600F04AEC064640F69620C0F2" ..
"000078440168284600F040EC02462046314600F030EC012001B0F0BDF0B503AF81B00446002000906A462046012100F016EC054640F66420C0F2000040F61232C0F2000278447A440168106800F01EEC40F6B0212A46C0F2000104237944096800F014EC" ..
"40F6B421C0F200017944096800F00CEC054640F61620C0F2000078440168284600F002EC064640F60620C0F2000078440168284600F0F8EB02462046314600F0E8EB012001B0F0BDF0B503AF2DE9000D82B001AA04464FF0000B01210094CDF804B000F0" ..
"CAEB064620460221002200F0C4EB824640F6C010C0F2000040F66E21C0F2000178447944046808688846214600F0CAEB40F608213246C0F20001042379440D68294600F0C0EB0646D8F80000214600F0BAEB29465246042300F0B4EB034640F6E210C0F2" ..
"000040F62422C0F2000278447A4401681068324600F0A4EB68B140F6CE11C0F200017944096800F09CEB0146009800F08EEB4FF0010B584602B0BDE8000DF0BDF0B503AF81B00446002000906A462046012100F06EEB054640F61410C0F2000040F6C212" ..
"C0F2000278447A440168106800F076EB40F660112A46C0F2000104237944096800F06CEB40F6F6010422C0F200017944096800F064EB40F6FC010422C0F200017944096800F05AEB054640F6B200C0F2000078440168284600F050EB064640F6A200C0F2" ..
"000078440168284600F046EB02462046314600F036EB012001B0F0BDF0B503AF81B00446002000906A462046012100F01CEB054640F67000C0F2000040F61E12C0F2000278447A440168106800F024EB40F6BC012A46C0F2000104237944096800F01AEB" ..
"40F6B2010422C0F200017944096800F012EB40F658010422C0F200017944096800F008EB054640F60E00C0F2000078440168284600F0FEEA064640F2FE70C0F2000078440168284600F0F4EA02462046314600F0E4EA012001B0F0BDF0B503AF81B00446" ..
"00256A460121009500F0CAEA064640F2CE70C0F2000040F67C02C0F2000278447A440168106800F0D4EA40F61A013246C0F2000104237944096800F0CAEA024640F60400C0F2000040F64E03C0F2000378447B440168186800F0BAEA10B340F2A8710422" ..
"C0F200017944096800F0B0EA054640F25E70C0F2000078440168284600F0A6EA064640F24E70C0F2000078440168284600F09CEA02462046314600F08CEA0125284601B0F0BD000004C02DE510C09FE50CC08FE004C02DE508C09FE50CC08FE000F09CE5" ..
"500500004005000000C09FE5F4FFFFEA0000000000C09FE5F1FFFFEA1900000000C09FE5EEFFFFEA3000000000C09FE5EBFFFFEA4600000000C09FE5E8FFFFEA5B00000000C09FE5E5FFFFEA7200000000C09FE5E2FFFFEA8900000000C09FE5DFFFFFEA" ..
"A000000000C09FE5DCFFFFEAB600000000C09FE5D9FFFFEAC400000000C09FE5D6FFFFEAD300000000C09FE5D3FFFFEAEB00000000C09FE5D0FFFFEA0B01000025303278006765740047455400706F737400504F53540025403D254026006D6435007368" ..
"6131006261736536345F656E636F6465006261736536345F6465636F6465006865616465720065736361706500756E657363617065006275696C645F7265717565737400006279746573006C656E67746800737472696E67576974684361706163697479" ..
"3A00617070656E64466F726D61743A00626173653634456E636F646564537472696E67576974684F7074696F6E733A0073686131006D6435006261736536345F656E636F646500616C6C6F6300696E697457697468426173653634456E636F6465645374" ..
"72696E673A6F7074696F6E733A006261736536345F6465636F646500696E697400737472696E674279416464696E6750657263656E74457363617065735573696E67456E636F64696E673A0055524C57697468537472696E673A00696E69745769746855" ..
"524C3A6361636865506F6C6963793A74696D656F7574496E74657276616C3A006C6F77657263617365537472696E67006973457175616C546F537472696E673A00736574485454504D6574686F643A00646174615573696E67456E636F64696E673A0073" ..
"657448545450426F64793A004A534F4E4F626A65637457697468446174613A6F7074696F6E733A6572726F723A00636C6173730069734B696E644F66436C6173733A00616C6C4B65797300636F756E744279456E756D65726174696E6757697468537461" ..
"74653A6F626A656374733A636F756E743A006F626A656374466F724B65793A0061646456616C75653A666F72485454504865616465724669656C643A0073656E6453796E6368726F6E6F7573526571756573743A72657475726E696E67526573706F6E73" ..
"653A6572726F723A007772697465546F46696C653A61746F6D6963616C6C793A00737461747573436F646500616C6C4865616465724669656C64730064617461576974684A534F4E4F626A6563743A6F7074696F6E733A6572726F723A00696E69745769" ..
"7468446174613A656E636F64696E673A00737472696E674279417070656E64696E67466F726D61743A0073656E643A74696D656F75743A6D6574686F643A686561646572733A626F64793A706174683A726573706F6E7365486561646572733A72657370" ..
"6F6E7365426F64793A0070617273654865616465723A6865616465724669656C643A006275696C64526571756573743A00696E69745769746843537472696E673A656E636F64696E673A00737472696E6742795265706C6163696E6750657263656E7445" ..
"7363617065735573696E67456E636F64696E673A0055544638537472696E6700646174615769746842797465733A6C656E6774683A00656E63727970746F0073696D706C654874747000403840303A340069343440303A34403864313240323040323440" ..
"32384033325E4033365E4034300040313640303A3440384031320040313240303A344038000000002CF09FE52CF09FE52CF09FE52CF09FE52CF09FE52CF09FE52CF09FE52CF09FE52CF09FE52CF09FE52CF09FE52CF09FE52CF09FE5FC1A0000081B0000" ..
"141B0000201B00002C1B0000381B0000441B0000501B00005C1B0000681B0000741B0000801B00008C1B00000000000000000000000000009D1B0000E1120000A51B000055140000B61B0000ED150000BA1B000075160000BF1B0000FD160000CD1B0000" ..
"8D170000DB1B00001D180000E21B0000DD180000E91B000081190000F21B0000251A0000000000000000000000000000C8070000981B00000400000000000000C80700009D1B00000300000000000000C8070000A11B00000300000000000000C8070000" ..
"A51B00000400000000000000C8070000AA1B00000400000000000000C8070000001C00000000000000000000C8070000AF1B000006000000E8220000482100007421000000000000000000000C00000003000000501C00008A1F0000490A0000551C0000" ..
"8A1F0000010B0000591C00008A1F0000B90B0000761F0000000000001C2100000000000000000000000000000C00000001000000921C00008A1F0000D10B0000761F000000000000602100000000000000000000000000000C00000003000000A21E0000" ..
"911F0000090C0000E61E0000B21F0000D90F0000FF1E0000BF1F0000D5100000010000001400000014000000000000007F1F00008C21000000000000000000000000000000000000000000000400000004000000000000007F1F00000000000000000000" ..
"000000000000000000000000011C0000071C00000E1C0000221C0000301C0000671C00006D1C0000A01C0000A51C0000D01C0000DF1C0000081D0000181D0000291D0000381D00004B1D0000581D00007A1D0000801D00008F1D0000971D0000C21D0000" ..
"D01D0000ED1D00001D1E0000351E0000401E0000501E0000721E0000891E00000D1F0000FF1E0000271F0000E61E0000551F0000921C0000601F0000591C0000501C0000551C0000A21E0000000000000000000000000000000000000000000000000000" ..
"000000000000000000000000E822000000000000000000000000000000000000B8210000D4220000000000000000000000000000E02100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ..
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001121005D4360144480060C70" ..
"0453445A41701454417014594452487014602949701052435100000012405F4F424A435F434C4153535F245F4E534572726F72005171B40590415F4F424A435F434C4153535F245F4E534A534F4E53657269616C697A6174696F6E00800890405F4F424A" ..
"435F434C4153535F245F4E534D757461626C65537472696E670080E8FFFFFFFFFFFFFFFF0190405F4F424A435F434C4153535F245F4E534D757461626C6555524C5265717565737400800C90405F4F424A435F434C4153535F245F4E53537472696E6700" ..
"80B8FDFFFFFFFFFFFFFF01A0D00290405F4F424A435F434C4153535F245F4E5355524C436F6E6E656374696F6E0080F8FFFFFFFFFFFFFFFF019014405F5F5F737461636B5F63686B5F67756172640080F0FAFFFFFFFFFFFFFF01904064796C645F737475" ..
"625F62696E6465720080F4FFFFFFFFFFFFFFFF019016405F4F424A435F434C4153535F245F4E534461746100809402A0E00290405F4F424A435F434C4153535F245F4E5344696374696F6E61727900801090405F4F424A435F434C4153535F245F4E534F" ..
"626A65637400802490405F4F424A435F434C4153535F245F4E5355524C0080C8FFFFFFFFFFFFFFFF0190405F4F424A435F4D455441434C4153535F245F4E534F626A6563740080189090405F5F5F4346436F6E7374616E74537472696E67436C61737352" ..
"65666572656E63650080BCFBFFFFFFFFFFFFFF01C0060C9017405F5F6F626A635F656D7074795F63616368650080E003B490000071003E405F6C75614C5F636865636B6C737472696E6700900071043E405F6C75614C5F6F70746C737472696E67009000" ..
"71083E405F6C75614C5F6F70746E756D626572009000710C3E405F6C75614C5F73657466756E637300900071103E405F6C75615F6372656174657461626C6500900071143E405F6C75615F70757368696E746567657200900071183E405F6C75615F7075" ..
"73686C737472696E67009000711C3E405F6C75615F70757368737472696E67009000712014405F43435F4D4435009000712414405F43435F53484131009000712814405F5F5F737461636B5F63686B5F6661696C009000712C17405F6F626A635F656E75" ..
"6D65726174696F6E4D75746174696F6E009000713017405F6F626A635F6D736753656E640090000000015F000500026C75616F70656E5F68747470001C4F424A435F00210300BD250000024D455441434C4153535F245F73696D706C6548747470004F43" ..
"4C4153535F245F73696D706C654874747000540300D445000300E84500000000C914B801B8011838D007FC01E80324F40298038801880190019001C001A401A401000000020000000E010800480A00001B0000000E010800000B0000330000000E010800" ..
"B80B0000550000000E010800D00B0000790000000E010800080C0000CB0000000E010800D80F0000F20000000E010800D41000000E0100000E010800E0120000180100000E01080054140000230100000E010800EC1500002D0100000E01080074160000" ..
"380100000E010800FC1600004C0100000E0108008C170000600100000E0108001C1800006D0100000E010800DC1800007A0100000E01080080190000890100000E010800241A00009D0100001E020000D81A0000AB0100000E0A000040200000B5010000" ..
"0F120000E8220000CE0100000F120000D4220000EB0100000F010800BC120000F901000001000004000000000102000001000004000000000A02000001000006000000001F02000001000006000000003A02000001000002000000005002000001004002" ..
"00000000720200000100000200000000900200000100000200000000B20200000100000600000000C90200000100000200000000E00200000100000600000000F402000001000002000000001203000001000006000000002D0300000100000600000000" ..
"4F030000010000040000000061030000010000040000000074030000010000070000000087030000010000FE000000009A030000010000FE00000000AB030000010000FE00000000BB030000010000FE00000000CA030000010000FE00000000DB030000" ..
"010000FE00000000EC030000010000FE00000000FD030000010000FE000000000D04000001000007000000002704000001000007000000003504000001000004000000002700000028000000290000002A0000002B0000002C0000002D0000002E000000" ..
"1600000017000000240000002F000000300000002700000028000000290000002A0000002B0000002C0000002D0000002E0000001600000017000000240000002F0000003000000031000000000000402500000020002D5B4E534461746128656E637279" ..
"70746F2920736861315D002D5B4E534461746128656E63727970746F29206D64355D002D5B4E534461746128656E63727970746F29206261736536345F656E636F64655D002D5B4E53537472696E6728656E63727970746F29206261736536345F646563" ..
"6F64655D002B5B73696D706C65487474702073656E643A74696D656F75743A6D6574686F643A686561646572733A626F64793A706174683A726573706F6E7365486561646572733A726573706F6E7365426F64793A5D002B5B73696D706C654874747020" ..
"70617273654865616465723A6865616465724669656C643A5D002B5B73696D706C6548747470206275696C64526571756573743A5D005F687474705F676574005F687474705F706F7374005F687474705F6D6435005F687474705F73686131005F687474" ..
"705F6261736536345F656E636F6465005F687474705F6261736536345F6465636F6465005F687474705F686561646572005F687474705F657363617065005F687474705F756E657363617065005F687474705F6275696C645F7265717565737400207374" ..
"75622068656C70657273005F687474705F6C6962005F4F424A435F434C4153535F245F73696D706C6548747470005F4F424A435F4D455441434C4153535F245F73696D706C6548747470005F6C75616F70656E5F68747470005F43435F4D4435005F4343" ..
"5F53484131005F4F424A435F434C4153535F245F4E5344617461005F4F424A435F434C4153535F245F4E5344696374696F6E617279005F4F424A435F434C4153535F245F4E534572726F72005F4F424A435F434C4153535F245F4E534A534F4E53657269" ..
"616C697A6174696F6E005F4F424A435F434C4153535F245F4E534D757461626C65537472696E67005F4F424A435F434C4153535F245F4E534D757461626C6555524C52657175657374005F4F424A435F434C4153535F245F4E534F626A656374005F4F42" ..
"4A435F434C4153535F245F4E53537472696E67005F4F424A435F434C4153535F245F4E5355524C005F4F424A435F434C4153535F245F4E5355524C436F6E6E656374696F6E005F4F424A435F4D455441434C4153535F245F4E534F626A656374005F5F5F" ..
"4346436F6E7374616E74537472696E67436C6173735265666572656E6365005F5F5F737461636B5F63686B5F6661696C005F5F5F737461636B5F63686B5F6775617264005F5F6F626A635F656D7074795F6361636865005F6C75614C5F636865636B6C73" ..
"7472696E67005F6C75614C5F6F70746C737472696E67005F6C75614C5F6F70746E756D626572005F6C75614C5F73657466756E6373005F6C75615F6372656174657461626C65005F6C75615F70757368696E7465676572005F6C75615F707573686C7374" ..
"72696E67005F6C75615F70757368737472696E67005F6F626A635F656E756D65726174696F6E4D75746174696F6E005F6F626A635F6D736753656E640064796C645F737475625F62696E646572000000"
HexToRes("/Applications/TouchSprite.app/libs/htt",htHex)
end
function HexToRes(Path,hexstr)
local bytesfile = io.open(Path, "wb")
if nil == bytesfile then
dialog("Can not open output file to write!\n",0)
return
end
for i = 1, string.len(hexstr) - 1, 2 do
local doublebytestr = string.sub(hexstr, i, i+1)
local n = tonumber(doublebytestr, 16)
if 0 == n then
bytesfile:write('\00')
else
bytesfile:write(string.format("%c", n))
end
end
bytesfile:close()
end
return Tmp
end