This commit is contained in:
Peter Ferrie 2021-10-17 19:53:08 -07:00
parent e476891ee3
commit 8ed18022b2

View File

@ -2,46 +2,62 @@ a = new ActiveXObject("scripting.filesystemobject")
if (!a.fileexists(WScript.Arguments(1)) || a.getfile(WScript.Arguments(1)).datelastmodified < a.getFile(WScript.Arguments(0)).datelastmodified) if (!a.fileexists(WScript.Arguments(1)) || a.getfile(WScript.Arguments(1)).datelastmodified < a.getFile(WScript.Arguments(0)).datelastmodified)
{ {
b = a.opentextfile(WScript.Arguments(0)).readall().replace(/\r\n/g, "\n") z = a.opentextfile(WScript.Arguments(0))
c = b.search(/\[eof\]/) d = a.createtextfile(WScript.Arguments(1))
if (c > -1)
{
b = b.substr(0, c) + String.fromCharCode(0)
}
String.prototype.replaceWith = function(q) String.prototype.replaceWith = function(q)
{ {
return this.substr(0, c) + String.fromCharCode(q) + this.substr(c + 1) return this.substr(0, c) + String.fromCharCode(q) + this.substr(c + 1)
} }
for (c = 0; c < b.length; c++) while (!z.atendofstream)
{ {
if (b.charAt(c) == '*') b = z.readline()
c = b.search(/\[eof\]/)
if (c > -1)
{ {
b = b.replaceWith(16) break
} }
else if (b.charAt(c) == '~')
c = b.search(/\r\n/)
if (c > -1)
{ {
b = b.replaceWith(17) b = b.substr(0, c)
} }
else if (b.charAt(c) == '<')
for (c = 0; c < b.length; c++)
{ {
b = b.replaceWith(8) if (b.charAt(c) == '*')
} {
else if (b.charAt(c) == '>') b = b.replaceWith(16)
{ }
b = b.replaceWith(21) else if (b.charAt(c) == '~')
} {
else if (b.charAt(c) == '$') b = b.replaceWith(17)
{ }
b = b.replaceWith(14) else if (b.charAt(c) == '<')
} {
else if (b.charAt(c) == '%') b = b.replaceWith(8)
{ }
b = b.replaceWith(15) else if (b.charAt(c) == '>')
{
b = b.replaceWith(21)
}
else if (b.charAt(c) == '$')
{
b = b.replaceWith(14)
}
else if (b.charAt(c) == '%')
{
b = b.replaceWith(15)
}
} }
d.write(String.fromCharCode(b.length) + b)
} }
a.createtextfile(WScript.Arguments(1)).write(b) d.write(String.fromCharCode(255))
} }