UnicodeArrayNodesGroup.js 2.0 KB

123456789101112131415161718192021222324252627
  1. "use strict";
  2. const NodesGroup_1 = require('./NodesGroup');
  3. const UnicodeArrayCallsWrapper_1 = require("../custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper");
  4. const UnicodeArrayDecodeNode_1 = require("../custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode");
  5. const UnicodeArrayNode_1 = require('../custom-nodes/unicode-array-nodes/UnicodeArrayNode');
  6. const UnicodeArrayRotateFunctionNode_1 = require('../custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode');
  7. const Utils_1 = require('../Utils');
  8. class UnicodeArrayNodesGroup extends NodesGroup_1.NodesGroup {
  9. constructor(options = {}) {
  10. super(options);
  11. this.unicodeArrayName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
  12. this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
  13. this.unicodeArrayRotateValue = this.options['rotateUnicodeArray'] ? Utils_1.Utils.getRandomInteger(100, 500) : 0;
  14. let unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(this.unicodeArrayName, this.unicodeArrayRotateValue), unicodeArray = unicodeArrayNode.getNodeData();
  15. this.nodes.set('unicodeArrayNode', unicodeArrayNode);
  16. if (this.options['wrapUnicodeArrayCalls']) {
  17. this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(this.unicodeArrayTranslatorName, this.unicodeArrayName, unicodeArray));
  18. }
  19. if (this.options['encodeUnicodeArray']) {
  20. this.nodes.set('unicodeArrayDecodeNode', new UnicodeArrayDecodeNode_1.UnicodeArrayDecodeNode(this.unicodeArrayName, unicodeArray));
  21. }
  22. if (this.options['rotateUnicodeArray']) {
  23. this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(this.unicodeArrayName, unicodeArray, this.unicodeArrayRotateValue));
  24. }
  25. }
  26. }
  27. exports.UnicodeArrayNodesGroup = UnicodeArrayNodesGroup;