1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import { IOptions } from "../interfaces/IOptions";
- import { NodesGroup } from './NodesGroup';
- import { UnicodeArrayCallsWrapper } from "../custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper";
- import { UnicodeArrayDecodeNode } from "../custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode";
- import { UnicodeArrayNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayNode';
- import { UnicodeArrayRotateFunctionNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode';
- import { Utils } from '../Utils';
- export class UnicodeArrayNodesGroup extends NodesGroup {
- /**
- * @type {string}
- */
- private unicodeArrayName: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
- /**
- * @type {number}
- */
- private unicodeArrayRotateValue: number;
- /**
- * @type {string}
- */
- private unicodeArrayTranslatorName: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
- /**
- * @param options
- */
- constructor (options: IOptions) {
- super(options);
- if (!this.options.get('unicodeArray')) {
- return;
- }
- if (this.options.get('rotateUnicodeArray')) {
- this.unicodeArrayRotateValue = Utils.getRandomGenerator().integer({
- min: 100,
- max: 500
- });
- } else {
- this.unicodeArrayRotateValue = 0;
- }
- let unicodeArrayNode: UnicodeArrayNode = new UnicodeArrayNode(
- this.unicodeArrayName,
- this.unicodeArrayRotateValue,
- this.options
- ),
- unicodeArray: string [] = unicodeArrayNode.getNodeData();
- this.nodes.set(
- 'unicodeArrayNode',
- unicodeArrayNode
- );
- if (this.options.get('wrapUnicodeArrayCalls')) {
- this.nodes.set(
- 'unicodeArrayCallsWrapper',
- new UnicodeArrayCallsWrapper(
- this.unicodeArrayTranslatorName,
- this.unicodeArrayName,
- unicodeArray,
- this.options
- )
- );
- }
- if (this.options.get('encodeUnicodeLiterals')) {
- this.nodes.set(
- 'unicodeArrayDecodeNode',
- new UnicodeArrayDecodeNode (
- this.unicodeArrayName,
- unicodeArray,
- this.options
- )
- );
- }
- if (this.options.get('rotateUnicodeArray')) {
- this.nodes.set(
- 'unicodeArrayRotateFunctionNode',
- new UnicodeArrayRotateFunctionNode(
- this.unicodeArrayName,
- unicodeArray,
- this.unicodeArrayRotateValue,
- this.options
- )
- );
- }
- }
- }
|