فهرست منبع

finished inversify integration

sanex3339 8 سال پیش
والد
کامیت
0eff9390af

+ 46 - 37
dist/index.js

@@ -127,7 +127,8 @@ exports.ServiceIdentifiers = {
     ISourceMapCorrector: Symbol('ISourceMapCorrector'),
     IStackTraceAnalyzer: Symbol('IStackTraceAnalyzer'),
     'IStorage<ICustomNode>': Symbol('IStorage<ICustomNode>'),
-    'IStorage<ICustomNodeGroup>': Symbol('IStorage<ICustomNodeGroup>')
+    'IStorage<ICustomNodeGroup>': Symbol('IStorage<ICustomNodeGroup>'),
+    'IStorage<string>': Symbol('IStorage<string>')
 };
 
 /***/ },
@@ -1425,11 +1426,6 @@ var StringArrayNode = function (_AbstractCustomNode_) {
                 stringArray: this.stringArray.toString()
             });
         }
-    }, {
-        key: "getNodeData",
-        value: function getNodeData() {
-            return this.stringArray;
-        }
     }, {
         key: "getNode",
         value: function getNode() {
@@ -1441,10 +1437,10 @@ var StringArrayNode = function (_AbstractCustomNode_) {
     return StringArrayNode;
 }(AbstractCustomNode_1.AbstractCustomNode);
 StringArrayNode.ARRAY_RANDOM_LENGTH = 4;
-__decorate([Initializable_1.initializable(), __metadata('design:type', Object)], StringArrayNode.prototype, "stringArray", void 0);
-__decorate([Initializable_1.initializable(), __metadata('design:type', String)], StringArrayNode.prototype, "stringArrayName", void 0);
-__decorate([Initializable_1.initializable(), __metadata('design:type', Number)], StringArrayNode.prototype, "stringArrayRotateValue", void 0);
-StringArrayNode = __decorate([inversify_1.injectable(), __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), __metadata('design:paramtypes', [Object])], StringArrayNode);
+__decorate([Initializable_1.initializable(), __metadata("design:type", Object)], StringArrayNode.prototype, "stringArray", void 0);
+__decorate([Initializable_1.initializable(), __metadata("design:type", String)], StringArrayNode.prototype, "stringArrayName", void 0);
+__decorate([Initializable_1.initializable(), __metadata("design:type", Number)], StringArrayNode.prototype, "stringArrayRotateValue", void 0);
+StringArrayNode = __decorate([inversify_1.injectable(), __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), __metadata("design:paramtypes", [Object])], StringArrayNode);
 exports.StringArrayNode = StringArrayNode;
 
 /***/ },
@@ -2534,9 +2530,11 @@ var inversify_1 = __webpack_require__(0);
 var ServiceIdentifiers_1 = __webpack_require__(1);
 var ControlFlowStorage_1 = __webpack_require__(91);
 var CustomNodeGroupStorage_1 = __webpack_require__(92);
+var StringArrayStorage_1 = __webpack_require__(93);
 exports.storagesModule = new inversify_1.ContainerModule(function (bind) {
     bind(ServiceIdentifiers_1.ServiceIdentifiers['IStorage<ICustomNodeGroup>']).to(CustomNodeGroupStorage_1.CustomNodeGroupStorage).inSingletonScope();
     bind(ServiceIdentifiers_1.ServiceIdentifiers['IStorage<ICustomNode>']).to(ControlFlowStorage_1.ControlFlowStorage);
+    bind(ServiceIdentifiers_1.ServiceIdentifiers['IStorage<string>']).to(StringArrayStorage_1.StringArrayStorage).inSingletonScope();
     bind(ServiceIdentifiers_1.ServiceIdentifiers['Factory<IStorage<ICustomNode>>']).toFactory(function (context) {
         return function () {
             return context.container.get(ServiceIdentifiers_1.ServiceIdentifiers['IStorage<ICustomNode>']);
@@ -3937,11 +3935,10 @@ var StringArrayNode_1 = __webpack_require__(26);
 var AbstractCustomNodeGroup_1 = __webpack_require__(18);
 var NodeAppender_1 = __webpack_require__(16);
 var RandomGeneratorUtils_1 = __webpack_require__(2);
-var StringArrayStorage_1 = __webpack_require__(93);
 var StringArrayCustomNodeGroup = function (_AbstractCustomNodeGr) {
     _inherits(StringArrayCustomNodeGroup, _AbstractCustomNodeGr);
 
-    function StringArrayCustomNodeGroup(customNodeFactory, obfuscationEventEmitter, options) {
+    function StringArrayCustomNodeGroup(customNodeFactory, obfuscationEventEmitter, stringArrayStorage, options) {
         _classCallCheck(this, StringArrayCustomNodeGroup);
 
         var _this = _possibleConstructorReturn(this, (StringArrayCustomNodeGroup.__proto__ || Object.getPrototypeOf(StringArrayCustomNodeGroup)).call(this, options));
@@ -3949,13 +3946,14 @@ var StringArrayCustomNodeGroup = function (_AbstractCustomNodeGr) {
         _this.appendEvent = ObfuscationEvents_1.ObfuscationEvents.AfterObfuscation;
         _this.customNodeFactory = customNodeFactory;
         _this.obfuscationEventEmitter = obfuscationEventEmitter;
+        _this.stringArrayStorage = stringArrayStorage;
         return _this;
     }
 
     _createClass(StringArrayCustomNodeGroup, [{
         key: "appendCustomNodes",
         value: function appendCustomNodes(blockScopeNode, stackTraceData) {
-            if (!this.stringArray.getLength()) {
+            if (!this.stringArrayStorage.getLength()) {
                 return;
             }
             this.appendCustomNodeIfExist(CustomNodes_1.CustomNodes.StringArrayNode, function (customNode) {
@@ -3972,7 +3970,6 @@ var StringArrayCustomNodeGroup = function (_AbstractCustomNodeGr) {
         key: "initialize",
         value: function initialize() {
             this.customNodes = new Map();
-            this.stringArray = new StringArrayStorage_1.StringArrayStorage();
             if (!this.options.stringArray) {
                 return;
             }
@@ -3987,9 +3984,9 @@ var StringArrayCustomNodeGroup = function (_AbstractCustomNodeGr) {
             } else {
                 stringArrayRotateValue = 0;
             }
-            stringArrayNode.initialize(this.stringArray, stringArrayName, stringArrayRotateValue);
-            stringArrayCallsWrapper.initialize(this.stringArray, stringArrayName, stringArrayCallsWrapperName);
-            stringArrayRotateFunctionNode.initialize(this.stringArray, stringArrayName, stringArrayRotateValue);
+            stringArrayNode.initialize(this.stringArrayStorage, stringArrayName, stringArrayRotateValue);
+            stringArrayCallsWrapper.initialize(this.stringArrayStorage, stringArrayName, stringArrayCallsWrapperName);
+            stringArrayRotateFunctionNode.initialize(this.stringArrayStorage, stringArrayName, stringArrayRotateValue);
             this.customNodes.set(CustomNodes_1.CustomNodes.StringArrayNode, stringArrayNode);
             this.customNodes.set(CustomNodes_1.CustomNodes.StringArrayCallsWrapper, stringArrayCallsWrapper);
             if (this.options.rotateStringArray) {
@@ -4000,9 +3997,9 @@ var StringArrayCustomNodeGroup = function (_AbstractCustomNodeGr) {
 
     return StringArrayCustomNodeGroup;
 }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
-__decorate([Initializable_1.initializable(), __metadata('design:type', Map)], StringArrayCustomNodeGroup.prototype, "customNodes", void 0);
-__decorate([Initializable_1.initializable(), __metadata('design:type', Object)], StringArrayCustomNodeGroup.prototype, "stringArray", void 0);
-StringArrayCustomNodeGroup = __decorate([inversify_1.injectable(), __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers['Factory<ICustomNode>'])), __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)), __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), __metadata('design:paramtypes', [Function, Object, Object])], StringArrayCustomNodeGroup);
+__decorate([Initializable_1.initializable(), __metadata("design:type", Map)], StringArrayCustomNodeGroup.prototype, "customNodes", void 0);
+__decorate([Initializable_1.initializable(), __metadata("design:type", Object)], StringArrayCustomNodeGroup.prototype, "stringArrayStorage", void 0);
+StringArrayCustomNodeGroup = __decorate([inversify_1.injectable(), __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers['Factory<ICustomNode>'])), __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)), __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers['IStorage<string>'])), __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), __metadata("design:paramtypes", [Function, Object, Object, Object])], StringArrayCustomNodeGroup);
 exports.StringArrayCustomNodeGroup = StringArrayCustomNodeGroup;
 
 /***/ },
@@ -5394,15 +5391,16 @@ var CustomNodes_1 = __webpack_require__(12);
 var CustomNodeGroups_1 = __webpack_require__(23);
 var RandomGeneratorUtils_1 = __webpack_require__(2);
 var Utils_1 = __webpack_require__(4);
-var StringLiteralReplacer_1 = function (_AbstractReplacer_1$A) {
+var StringLiteralReplacer = StringLiteralReplacer_1 = function (_AbstractReplacer_1$A) {
     _inherits(StringLiteralReplacer, _AbstractReplacer_1$A);
 
-    function StringLiteralReplacer(customNodeGroupStorage, options) {
+    function StringLiteralReplacer(customNodeGroupStorage, stringArrayStorage, options) {
         _classCallCheck(this, StringLiteralReplacer);
 
         var _this = _possibleConstructorReturn(this, (StringLiteralReplacer.__proto__ || Object.getPrototypeOf(StringLiteralReplacer)).call(this, options));
 
         _this.customNodeGroupStorage = customNodeGroupStorage;
+        _this.stringArrayStorage = stringArrayStorage;
         return _this;
     }
 
@@ -5419,7 +5417,6 @@ var StringLiteralReplacer_1 = function (_AbstractReplacer_1$A) {
         key: "replaceStringLiteralWithStringArrayCall",
         value: function replaceStringLiteralWithStringArrayCall(value) {
             var stringArrayCustomNodeGroupNodes = this.customNodeGroupStorage.get(CustomNodeGroups_1.CustomNodeGroups.StringArrayCustomNodeGroup).getCustomNodes();
-            var stringArrayNode = stringArrayCustomNodeGroupNodes.get(CustomNodes_1.CustomNodes.StringArrayNode);
             var rc4Key = '';
             switch (this.options.stringArrayEncoding) {
                 case StringArrayEncoding_1.StringArrayEncoding.base64:
@@ -5433,14 +5430,13 @@ var StringLiteralReplacer_1 = function (_AbstractReplacer_1$A) {
             if (this.options.unicodeEscapeSequence) {
                 value = Utils_1.Utils.stringToUnicodeEscapeSequence(value);
             }
-            var stringArray = stringArrayNode.getNodeData();
-            var indexOfExistingValue = stringArray.getKeyOf(value);
+            var indexOfExistingValue = this.stringArrayStorage.getKeyOf(value);
             var indexOfValue = void 0;
             if (indexOfExistingValue >= 0) {
                 indexOfValue = indexOfExistingValue;
             } else {
-                indexOfValue = stringArray.getLength();
-                stringArray.set(null, value);
+                indexOfValue = this.stringArrayStorage.getLength();
+                this.stringArrayStorage.set(null, value);
             }
             var stringArrayCallsWrapper = stringArrayCustomNodeGroupNodes.get(CustomNodes_1.CustomNodes.StringArrayCallsWrapper);
             var hexadecimalIndex = "" + Utils_1.Utils.hexadecimalPrefix + Utils_1.Utils.decToHex(indexOfValue);
@@ -5453,13 +5449,13 @@ var StringLiteralReplacer_1 = function (_AbstractReplacer_1$A) {
 
     return StringLiteralReplacer;
 }(AbstractReplacer_1.AbstractReplacer);
-var StringLiteralReplacer = StringLiteralReplacer_1;
 StringLiteralReplacer.minimumLengthForStringArray = 3;
 StringLiteralReplacer.rc4Keys = RandomGeneratorUtils_1.RandomGeneratorUtils.getRandomGenerator().n(function () {
     return RandomGeneratorUtils_1.RandomGeneratorUtils.getRandomGenerator().string({ length: 4 });
 }, 50);
-StringLiteralReplacer = StringLiteralReplacer_1 = __decorate([inversify_1.injectable(), __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers['IStorage<ICustomNodeGroup>'])), __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), __metadata('design:paramtypes', [Object, Object])], StringLiteralReplacer);
+StringLiteralReplacer = StringLiteralReplacer_1 = __decorate([inversify_1.injectable(), __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers['IStorage<ICustomNodeGroup>'])), __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers['IStorage<string>'])), __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), __metadata("design:paramtypes", [Object, Object, Object])], StringLiteralReplacer);
 exports.StringLiteralReplacer = StringLiteralReplacer;
+var StringLiteralReplacer_1;
 
 /***/ },
 /* 83 */
@@ -6232,8 +6228,8 @@ var __decorate = undefined && undefined.__decorate || function (decorators, targ
 var __metadata = undefined && undefined.__metadata || function (k, v) {
     if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 };
+var inversify_1 = __webpack_require__(0);
 var Initializable_1 = __webpack_require__(3);
-
 var ArrayStorage = function () {
     function ArrayStorage() {
         _classCallCheck(this, ArrayStorage);
@@ -6277,8 +6273,8 @@ var ArrayStorage = function () {
 
     return ArrayStorage;
 }();
-
-__decorate([Initializable_1.initializable(), __metadata('design:type', Array)], ArrayStorage.prototype, "storage", void 0);
+__decorate([Initializable_1.initializable(), __metadata("design:type", Array)], ArrayStorage.prototype, "storage", void 0);
+ArrayStorage = __decorate([inversify_1.injectable(), __metadata("design:paramtypes", [])], ArrayStorage);
 exports.ArrayStorage = ArrayStorage;
 
 /***/ },
@@ -6414,15 +6410,28 @@ exports.CustomNodeGroupStorage = CustomNodeGroupStorage;
 
 var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
 
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
+
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
 
 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
 
+var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
+    var c = arguments.length,
+        r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
+        d;
+    if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
+        if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+    }return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+var __metadata = undefined && undefined.__metadata || function (k, v) {
+    if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
+};
+var inversify_1 = __webpack_require__(0);
 var ArrayStorage_1 = __webpack_require__(90);
 var Utils_1 = __webpack_require__(4);
-
 var StringArrayStorage = function (_ArrayStorage_1$Array) {
     _inherits(StringArrayStorage, _ArrayStorage_1$Array);
 
@@ -6436,22 +6445,22 @@ var StringArrayStorage = function (_ArrayStorage_1$Array) {
     }
 
     _createClass(StringArrayStorage, [{
-        key: 'rotateArray',
+        key: "rotateArray",
         value: function rotateArray(rotationValue) {
             this.storage = Utils_1.Utils.arrayRotate(this.storage, rotationValue);
         }
     }, {
-        key: 'toString',
+        key: "toString",
         value: function toString() {
             return this.storage.map(function (value) {
-                return '\'' + value + '\'';
+                return "'" + value + "'";
             }).toString();
         }
     }]);
 
     return StringArrayStorage;
 }(ArrayStorage_1.ArrayStorage);
-
+StringArrayStorage = __decorate([inversify_1.injectable(), __metadata("design:paramtypes", [])], StringArrayStorage);
 exports.StringArrayStorage = StringArrayStorage;
 
 /***/ },

+ 1 - 1
package.json

@@ -48,7 +48,7 @@
     "@types/node": "6.0.51",
     "@types/sinon": "1.16.32",
     "@types/string-template": "^1.0.2",
-    "awesome-typescript-loader": "^3.0.0-beta.10",
+    "awesome-typescript-loader": "^3.0.0-beta.11",
     "babel-cli": "6.18.0",
     "babel-loader": "6.2.9",
     "babel-preset-es2015": "6.18.0",

+ 2 - 1
src/container/ServiceIdentifiers.ts

@@ -21,5 +21,6 @@ export const ServiceIdentifiers: any = {
     ISourceMapCorrector: Symbol('ISourceMapCorrector'),
     IStackTraceAnalyzer: Symbol('IStackTraceAnalyzer'),
     'IStorage<ICustomNode>': Symbol('IStorage<ICustomNode>'),
-    'IStorage<ICustomNodeGroup>': Symbol('IStorage<ICustomNodeGroup>')
+    'IStorage<ICustomNodeGroup>': Symbol('IStorage<ICustomNodeGroup>'),
+    'IStorage<string>': Symbol('IStorage<string>')
 };

+ 5 - 0
src/container/modules/storages/StoragesModule.ts

@@ -7,6 +7,7 @@ import { IStorage } from '../../../interfaces/storages/IStorage';
 
 import { ControlFlowStorage } from '../../../storages/control-flow/ControlFlowStorage';
 import { CustomNodeGroupStorage } from '../../../storages/custom-node-group/CustomNodeGroupStorage';
+import { StringArrayStorage } from '../../../storages/string-array/StringArrayStorage';
 
 export const storagesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
     // storages
@@ -17,6 +18,10 @@ export const storagesModule: interfaces.ContainerModule = new ContainerModule((b
     bind<IStorage<ICustomNode>>(ServiceIdentifiers['IStorage<ICustomNode>'])
         .to(ControlFlowStorage);
 
+    bind<IStorage<string>>(ServiceIdentifiers['IStorage<string>'])
+        .to(StringArrayStorage)
+        .inSingletonScope();
+
     // controlFlowStorage factory
     bind<IStorage<ICustomNode>>(ServiceIdentifiers['Factory<IStorage<ICustomNode>>'])
         .toFactory<IStorage<ICustomNode>>((context: interfaces.Context) => {

+ 1 - 9
src/custom-nodes/string-array-nodes/StringArrayNode.ts

@@ -5,7 +5,6 @@ import * as format from 'string-template';
 
 import { TStatement } from '../../types/node/TStatement';
 
-import { ICustomNodeWithData } from '../../interfaces/custom-nodes/ICustomNodeWithData';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IStorage } from '../../interfaces/storages/IStorage';
 
@@ -17,7 +16,7 @@ import { AbstractCustomNode } from '../AbstractCustomNode';
 import { StringArrayStorage } from '../../storages/string-array/StringArrayStorage';
 
 @injectable()
-export class StringArrayNode extends AbstractCustomNode implements ICustomNodeWithData {
+export class StringArrayNode extends AbstractCustomNode {
     /**
      * @type {number}
      */
@@ -75,13 +74,6 @@ export class StringArrayNode extends AbstractCustomNode implements ICustomNodeWi
         });
     }
 
-    /**
-     * @returns {IStorage <string>}
-     */
-    public getNodeData (): IStorage <string> {
-        return this.stringArray;
-    }
-
     /**
      * @returns {TStatement[]}
      */

+ 8 - 7
src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts

@@ -21,7 +21,6 @@ import { StringArrayNode } from '../StringArrayNode';
 import { AbstractCustomNodeGroup } from '../../AbstractCustomNodeGroup';
 import { NodeAppender } from '../../../node/NodeAppender';
 import { RandomGeneratorUtils } from '../../../utils/RandomGeneratorUtils';
-import { StringArrayStorage } from '../../../storages/string-array/StringArrayStorage';
 
 @injectable()
 export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
@@ -50,22 +49,25 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
      * @type {IStorage <string>}
      */
     @initializable()
-    private stringArray: IStorage <string>;
+    private stringArrayStorage: IStorage <string>;
 
     /**
      * @param customNodeFactory
      * @param obfuscationEventEmitter
+     * @param stringArrayStorage
      * @param options
      */
     constructor (
         @inject(ServiceIdentifiers['Factory<ICustomNode>']) customNodeFactory: TCustomNodeFactory,
         @inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
+        @inject(ServiceIdentifiers['IStorage<string>']) stringArrayStorage: IStorage<string>,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);
 
         this.customNodeFactory = customNodeFactory;
         this.obfuscationEventEmitter = obfuscationEventEmitter;
+        this.stringArrayStorage = stringArrayStorage;
     }
 
     /**
@@ -73,7 +75,7 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
      * @param stackTraceData
      */
     public appendCustomNodes (blockScopeNode: TNodeWithBlockStatement, stackTraceData: IStackTraceData[]): void {
-        if (!this.stringArray.getLength()) {
+        if (!this.stringArrayStorage.getLength()) {
             return;
         }
 
@@ -95,7 +97,6 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
 
     public initialize (): void {
         this.customNodes = new Map <CustomNodes, ICustomNode> ();
-        this.stringArray = new StringArrayStorage();
 
         if (!this.options.stringArray) {
             return;
@@ -116,9 +117,9 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
             stringArrayRotateValue = 0;
         }
 
-        stringArrayNode.initialize(this.stringArray, stringArrayName, stringArrayRotateValue);
-        stringArrayCallsWrapper.initialize(this.stringArray, stringArrayName, stringArrayCallsWrapperName);
-        stringArrayRotateFunctionNode.initialize(this.stringArray, stringArrayName, stringArrayRotateValue);
+        stringArrayNode.initialize(this.stringArrayStorage, stringArrayName, stringArrayRotateValue);
+        stringArrayCallsWrapper.initialize(this.stringArrayStorage, stringArrayName, stringArrayCallsWrapperName);
+        stringArrayRotateFunctionNode.initialize(this.stringArrayStorage, stringArrayName, stringArrayRotateValue);
 
         this.customNodes.set(CustomNodes.StringArrayNode, stringArrayNode);
         this.customNodes.set(CustomNodes.StringArrayCallsWrapper, stringArrayCallsWrapper);

+ 0 - 8
src/interfaces/custom-nodes/ICustomNodeWithData.d.ts

@@ -1,8 +0,0 @@
-import { ICustomNode } from './ICustomNode';
-
-export interface ICustomNodeWithData extends ICustomNode {
-    /**
-     * @returns any
-     */
-    getNodeData (): any;
-}

+ 11 - 7
src/node-transformers/node-obfuscators/replacers/StringLiteralReplacer.ts

@@ -3,7 +3,6 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { ICustomNodeGroup } from '../../../interfaces/custom-nodes/ICustomNodeGroup';
-import { ICustomNodeWithData } from '../../../interfaces/custom-nodes/ICustomNodeWithData';
 import { ICustomNodeWithIdentifier } from '../../../interfaces/custom-nodes/ICustomNodeWithIdentifier';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IStorage } from '../../../interfaces/storages/IStorage';
@@ -35,17 +34,25 @@ export class StringLiteralReplacer extends AbstractReplacer {
      */
     private readonly customNodeGroupStorage: IStorage<ICustomNodeGroup>;
 
+    /**
+     * @type {IStorage<string>}
+     */
+    private readonly stringArrayStorage: IStorage<string>;
+
     /**
      * @param customNodeGroupStorage
+     * @param stringArrayStorage
      * @param options
      */
     constructor (
         @inject(ServiceIdentifiers['IStorage<ICustomNodeGroup>']) customNodeGroupStorage: IStorage<ICustomNodeGroup>,
+        @inject(ServiceIdentifiers['IStorage<string>']) stringArrayStorage: IStorage<string>,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(options);
 
         this.customNodeGroupStorage = customNodeGroupStorage;
+        this.stringArrayStorage = stringArrayStorage;
     }
 
     /**
@@ -73,8 +80,6 @@ export class StringLiteralReplacer extends AbstractReplacer {
         const stringArrayCustomNodeGroupNodes: Map <CustomNodes, ICustomNode> = this.customNodeGroupStorage
             .get(CustomNodeGroups.StringArrayCustomNodeGroup)
             .getCustomNodes();
-        const stringArrayNode: ICustomNodeWithData = <ICustomNodeWithData>stringArrayCustomNodeGroupNodes
-            .get(CustomNodes.StringArrayNode);
 
         let rc4Key: string = '';
 
@@ -95,16 +100,15 @@ export class StringLiteralReplacer extends AbstractReplacer {
             value = Utils.stringToUnicodeEscapeSequence(value);
         }
 
-        const stringArray: IStorage <string> = stringArrayNode.getNodeData();
-        const indexOfExistingValue: number = <number>stringArray.getKeyOf(value);
+        const indexOfExistingValue: number = <number>this.stringArrayStorage.getKeyOf(value);
 
         let indexOfValue: number;
 
         if (indexOfExistingValue >= 0) {
             indexOfValue = indexOfExistingValue;
         } else {
-            indexOfValue = stringArray.getLength();
-            stringArray.set(null, value);
+            indexOfValue = this.stringArrayStorage.getLength();
+            this.stringArrayStorage.set(null, value);
         }
 
         const stringArrayCallsWrapper: ICustomNodeWithIdentifier = <ICustomNodeWithIdentifier>stringArrayCustomNodeGroupNodes

+ 3 - 0
src/storages/ArrayStorage.ts

@@ -1,7 +1,10 @@
+import { injectable } from 'inversify';
+
 import { IStorage } from '../interfaces/storages/IStorage';
 
 import { initializable } from '../decorators/Initializable';
 
+@injectable()
 export abstract class ArrayStorage <T> implements IStorage <T> {
     /**
      * @type {T[]}

+ 3 - 0
src/storages/string-array/StringArrayStorage.ts

@@ -1,6 +1,9 @@
+import { injectable } from 'inversify';
+
 import { ArrayStorage } from '../ArrayStorage';
 import { Utils } from '../../utils/Utils';
 
+@injectable()
 export class StringArrayStorage extends ArrayStorage <string> {
     constructor () {
         super();