浏览代码

refactoring

sanex3339 9 年之前
父节点
当前提交
627169a7dd
共有 2 个文件被更改,包括 7 次插入5 次删除
  1. 3 2
      dist/src/node-obfuscators/NodeObfuscator.js
  2. 4 3
      src/node-obfuscators/NodeObfuscator.ts

+ 3 - 2
dist/src/node-obfuscators/NodeObfuscator.js

@@ -30,10 +30,11 @@ class NodeObfuscator {
         return `${prefix}${Utils_1.Utils.decToHex(nodeValue)}`;
     }
     replaceLiteralStringByUnicodeArrayCall(nodeValue) {
-        let value = Utils_1.Utils.stringToUnicode(nodeValue), unicodeArray = this.nodes.get('unicodeArrayNode').getNodeData(), sameIndex = unicodeArray.indexOf(value), index, hexadecimalIndex;
+        let value = Utils_1.Utils.stringToUnicode(nodeValue);
+        let unicodeArray = this.nodes.get('unicodeArrayNode').getNodeData(), sameIndex = unicodeArray.indexOf(value), index, hexadecimalIndex;
         if (sameIndex < 0) {
             index = unicodeArray.length;
-            unicodeArray.push(Utils_1.Utils.stringToUnicode(nodeValue));
+            unicodeArray.push(value);
         }
         else {
             index = sameIndex;

+ 4 - 3
src/node-obfuscators/NodeObfuscator.ts

@@ -86,15 +86,16 @@ export abstract class NodeObfuscator implements INodeObfuscator {
      * @returns {string}
      */
     protected replaceLiteralStringByUnicodeArrayCall (nodeValue: string): string {
-        let value: string = Utils.stringToUnicode(nodeValue),
-            unicodeArray: string[] = this.nodes.get('unicodeArrayNode').getNodeData(),
+        let value: string = Utils.stringToUnicode(nodeValue);
+
+        let unicodeArray: string[] = this.nodes.get('unicodeArrayNode').getNodeData(),
             sameIndex: number = unicodeArray.indexOf(value),
             index: number,
             hexadecimalIndex: string;
 
         if (sameIndex < 0) {
             index = unicodeArray.length;
-            unicodeArray.push(Utils.stringToUnicode(nodeValue));
+            unicodeArray.push(value);
         } else {
             index = sameIndex;
         }