|\w\\\w|urn\:|<\?xml|<\!|h\d|\.!\.).*$/g;
-//filter string ending with following words
-var filter3=/^.+(001|\/value|\*!\*|=)$/g;
-//filter from Kildor
-var filter4=/^((d\s\w)|\[\/?(\w|url|img|size|quote|color)(=\w*)?\]?|(\\\w)|(%\w+%)|(([\w-]+\.)*\.(\w{2,4}|travel|museum|xn--\w+))|\W|\s|\d)+$/gi;
-//filter from Kildor for remove filenames and paths.
-//var filter5=/^[\w_:%.\\\/*-]+\.\w+$/g;
-
-//apply filters to our string
-test1=filter1.test(string);
-test2=filter2.test(string);
-test3=filter3.test(string);
-test4=filter4.test(string);
-//test5=filter5.test(string);
-
-//if match (test1) first filter and NOT match other tests, thus string are good, return this string back.
-//if (test1 && !test2 && !test3 && !test4 && !test5) {
-//if (!test1 && !test2 && !test3 && !test4 && !test5) {
-if (!test1 && !test2 && !test3 && !test4) {
- return string;
+ //filter for exact matched strings
+ var filter1 = /^(&?[Oo][Kk]|AOL|APOP|BBS|Bing|CTCP|DCC|Foodnetwork|Google|GPG|Hotmail|ICQ|ICQ Corp|ID|IP|ISDN|iTunes|Jabber|JID|Miranda|MirandaG15|Miranda NG|mRadio|MSN|NickServ|OSD|OTR|PCS|PGP|SMS|SSL|SteamID|Steam Guard|Tox|Twitter|Yahoo|Winamp \(\*\)|Windows|X400)$/g;
+ //filter string starting from following words
+ var filter2 = /^(SOFTWARE\\|SYSTEM\\|http|ftp|UTF-|utf-|TEXT|EXE|exe|txt|css|html|dat[^a]|txt|MS\x20|CLVM|TM_|CLCB|CLSID|CLUI|HKEY_|MButton|BUTTON|WindowClass|MHeader|RichEdit|RICHEDIT|STATIC|EDIT|CList|listbox|LISTBOX|combobox|COMBOBOX|TitleB|std\w|iso-|windows-|
|\w\\\w|urn\:|<\?xml|<\!|h\d|\.!\.).*$/g;
+ //filter string ending with following words
+ var filter3 = /^.+(001|\/value|\*!\*|=)$/g;
+ //filter from Kildor
+ var filter4 = /^((d\s\w)|\[\/?(\w|url|img|size|quote|color)(=\w*)?\]?|(\\\w)|(%\w+%)|(([\w-]+\.)*\.(\w{2,4}|travel|museum|xn--\w+))|\W|\s|\d)+$/gi;
+ //filter from Kildor for remove filenames and paths.
+ //var filter5=/^[\w_:%.\\\/*-]+\.\w+$/g;
+
+ //apply filters to our string
+ test1 = filter1.test(string);
+ test2 = filter2.test(string);
+ test3 = filter3.test(string);
+ test4 = filter4.test(string);
+ //test5=filter5.test(string);
+
+ //if match (test1) first filter and NOT match other tests, thus string are good, return this string back.
+ //if (test1 && !test2 && !test3 && !test4 && !test5) {
+ //if (!test1 && !test2 && !test3 && !test4 && !test5) {
+ if (!test1 && !test2 && !test3 && !test4) {
+ return string;
} else {
//in other case, string is a garbage, put into crap array.
crap.push(string);
return;
- }
-};
+ }
+}
function ReadWholeFile(path, codepage) {
- if (codepage === undefined) codepage = "UTF-8";
+ if (codepage === undefined) codepage = "utf-8";
var bs = WScript.CreateObject("ADODB.Stream");
bs.Type = 2; //FileReadTypes.adTypeText;
bs.CharSet = codepage;
@@ -504,98 +552,128 @@ function ReadWholeFile(path, codepage) {
var what = bs.ReadText;
//remove all comments. The text starting with \\ (but not with ":\\" it's a links like https://miranda-ng.org/ and ")//" -there is one comment right after needed string)
//and remove multi-line comments, started with /* and ended with */
- what = what.replace(/(?:[^\):])(\/{2}.+?(?=$))|(\s\/\*[\S\s]+?\*\/)/mg,".");
+ what = what.replace(/(?:[^\):])(\/{2}.+?(?=$))|(\s\/\*[\S\s]+?\*\/)/mg, ".");
bs.Close();
return what;
}
//Parse Version.h file to get one translated string from "Description" and make a plugin template header.
-function ParseVersion_h (pluginfolder,array) {
-//cleanup var
-var VersionFile;
-//Let's try default locations of version.h file;
-//Check pluginfolder root.
-if (FSO.FileExists(FSO.BuildPath(pluginfolder,"version.h"))) VersionFile=FSO.BuildPath(pluginfolder,"version.h");
-//Check src\include subfolder of plugin root folder
-if (FSO.FileExists(FSO.BuildPath(pluginfolder,"src\\include\\version.h"))) VersionFile=FSO.BuildPath(pluginfolder,"src\\include\\version.h");
-//Check .\src subfolder
-if (FSO.FileExists(FSO.BuildPath(pluginfolder,"src\\version.h"))) VersionFile=FSO.BuildPath(pluginfolder,"src\\version.h");
-//If we still not found version.h, return
-if (!VersionFile) return;
-//read file fully into var allstrings
-allstrings=ReadWholeFile(VersionFile);
-//define RegExp for defines.
-var filename=/(?:#define\s+_*?FILENAME\s+")(.+)(?=")/m;
-var pluginname=/(?:#define\s+_*?PLUG(?:IN)?_?NAME\s+")(.+)(?=")/i;
-var author=/(?:#define\s+_*?(?:PLUGIN_?)?AUTHORS?\s+")(.+)(?=")/i;
-var MAJOR_VERSION=/(?:#define\s+_*?(?:MAJOR_VERSION|VER_MAJOR)\s+)(\d+)/i;
-var MINOR_VERSION=/(?:#define\s+_*?(?:MINOR_VERSION|VER_MINOR)\s+)(\d+)/i;
-var RELEASE_NUM=/(?:#define\s+_*?(?:RELEASE_NUM|VER_REVISION|VER_RELEASE)\s+)(\d+)/i;
-var BUILD_NUM=/(?:#define\s+_*?(?:BUILD_NUM|VER_BUILD)\s+)(\d+)/i;
-var VERSION_STRING=/(?:#define\s+_*?VERSION_STRING\s+")([\d\.]+)\"/i;
-var description=/(?:#define\s+_*?(?:PLUGIN_|MTEXT_)?DESC(?:RIPTION|_STRING)?\s+")(.+)(?=")/i;
-//exec RegExps
-filename=filename.exec(allstrings);
-pluginname=pluginname.exec(allstrings);
-MAJOR_VERSION=MAJOR_VERSION.exec(allstrings);
-MINOR_VERSION=MINOR_VERSION.exec(allstrings);
-RELEASE_NUM=RELEASE_NUM.exec(allstrings);
-BUILD_NUM=BUILD_NUM.exec(allstrings);
-VERSION_STRING=VERSION_STRING.exec(allstrings);
-author=author.exec(allstrings);
-description=description.exec(allstrings);
-
-//add a header start mark
-array.push(";============================================================");
-//push results of regexp vars into array
-if (filename) array.push("; File: "+filename[1]); else array.push("; File: "+plugin+".dll");
-if (pluginname) array.push("; Plugin: "+pluginname[1]); else array.push("; Plugin: "+plugin);
-if (VERSION_STRING) array.push("; Version: "+VERSION_STRING[1]);
-if (MAJOR_VERSION && !VERSION_STRING) array.push("; Version: "+MAJOR_VERSION[1]+"."+MINOR_VERSION[1]+"."+RELEASE_NUM[1]+"."+BUILD_NUM[1]);
-if (!MAJOR_VERSION && !VERSION_STRING) array.push("; Version: x.x.x.x");
-if (author) array.push("; Authors: "+fixHexa(author[1])); else array.push("; Authors: ");
-//add a header end mark
-array.push(";============================================================");
-if (description) array.push("["+description[1]+"]");
+function ParseVersion_h(pluginfolder, array) {
+ //cleanup var
+ var VersionFile;
+ //Let's try default locations of version.h file;
+ //Check pluginfolder root.
+ if (FSO.FileExists(FSO.BuildPath(pluginfolder, "version.h"))) {
+ VersionFile = FSO.BuildPath(pluginfolder, "version.h");
+ }
+ //Check src\include subfolder of plugin root folder
+ if (FSO.FileExists(FSO.BuildPath(pluginfolder, "src\\include\\version.h"))) {
+ VersionFile = FSO.BuildPath(pluginfolder, "src\\include\\version.h");
+ }
+ //Check .\src subfolder
+ if (FSO.FileExists(FSO.BuildPath(pluginfolder, "src\\version.h"))) {
+ VersionFile = FSO.BuildPath(pluginfolder, "src\\version.h");
+ }
+ //If we still not found version.h, return
+ if (!VersionFile) return;
+ //read file fully into var allstrings
+ allstrings = ReadWholeFile(VersionFile);
+ //define RegExp for defines.
+ var filename = /(?:#define\s+_*?FILENAME\s+")(.+)(?=")/m;
+ var pluginname = /(?:#define\s+_*?PLUG(?:IN)?_?NAME\s+")(.+)(?=")/i;
+ var author = /(?:#define\s+_*?(?:PLUGIN_?)?AUTHORS?\s+")(.+)(?=")/i;
+ var MAJOR_VERSION = /(?:#define\s+_*?(?:MAJOR_VERSION|VER_MAJOR)\s+)(\d+)/i;
+ var MINOR_VERSION = /(?:#define\s+_*?(?:MINOR_VERSION|VER_MINOR)\s+)(\d+)/i;
+ var RELEASE_NUM = /(?:#define\s+_*?(?:RELEASE_NUM|VER_REVISION|VER_RELEASE)\s+)(\d+)/i;
+ var BUILD_NUM = /(?:#define\s+_*?(?:BUILD_NUM|VER_BUILD)\s+)(\d+)/i;
+ var VERSION_STRING = /(?:#define\s+_*?VERSION_STRING\s+")([\d\.]+)\"/i;
+ var description = /(?:#define\s+_*?(?:PLUGIN_|MTEXT_)?DESC(?:RIPTION|_STRING)?\s+")(.+)(?=")/i;
+ //exec RegExps
+ filename = filename.exec(allstrings);
+ pluginname = pluginname.exec(allstrings);
+ MAJOR_VERSION = MAJOR_VERSION.exec(allstrings);
+ MINOR_VERSION = MINOR_VERSION.exec(allstrings);
+ RELEASE_NUM = RELEASE_NUM.exec(allstrings);
+ BUILD_NUM = BUILD_NUM.exec(allstrings);
+ VERSION_STRING = VERSION_STRING.exec(allstrings);
+ author = author.exec(allstrings);
+ description = description.exec(allstrings);
+
+ //add a header start mark
+ array.push(";============================================================");
+ //push results of regexp vars into array
+ if (filename) {
+ array.push("; File: " + filename[1]);
+ } else {
+ array.push("; File: " + plugin + ".dll");
+ }
+ if (pluginname) {
+ array.push("; Plugin: " + pluginname[1]);
+ } else {
+ array.push("; Plugin: " + plugin);
+ }
+ if (VERSION_STRING) {
+ array.push("; Version: " + VERSION_STRING[1]);
+ }
+ if (MAJOR_VERSION && !VERSION_STRING) {
+ array.push("; Version: " + MAJOR_VERSION[1] + "." + MINOR_VERSION[1] + "." + RELEASE_NUM[1] + "." + BUILD_NUM[1]);
+ }
+ if (!MAJOR_VERSION && !VERSION_STRING) {
+ array.push("; Version: x.x.x.x");
+ }
+ if (author) {
+ array.push("; Authors: " + fixHexa(author[1]));
+ } else {
+ array.push("; Authors: ");
+ }
+ //add a header end mark
+ array.push(";============================================================");
+ if (description) {
+ array.push("[" + description[1] + "]");
+ }
}
//Replaces \x?? hex codes with their char representation
function fixHexa(string) {
- return string.replace(/\\x([a-fA-F0-9]{2})" "/g,function() {
- return String.fromCharCode(parseInt(arguments[1],16));
- });
+ return string.replace(/\\x([a-fA-F0-9]{2})" "/g, function () {
+ return String.fromCharCode(parseInt(arguments[1], 16));
+ });
}
//Removes duplicates, not mine, found at http://dreaminginjavascript.wordpress.com/2008/08/22/eliminating-duplicates/
function eliminateDuplicates(arr) {
- var i,
- len=arr.length,
- out=[],
- obj={};
-
- for (i=0;i