Working commit

This commit is contained in:
David Majdandžić
2023-04-05 16:51:29 +02:00
parent 3acb1f0889
commit eb22a43ee2
13 changed files with 104 additions and 82 deletions

View File

@@ -0,0 +1,20 @@
import {Client} from "../../../Client/Client";
import {PDU} from "../../../CommonObjects";
import Preprocessor from "../Preprocessor";
export class DestinationEnumeratorProcessor extends Preprocessor {
serverSessionType: string = Client.name;
private iterator = 0;
processPdu(session: any, pdu: PDU, ...args: any[]): Promise<any> {
return new Promise<any>((resolve, reject) => {
if (!!pdu.destination_addr) {
pdu.destination_addr = pdu.destination_addr + this.padLeft(String(this.iterator++), '0', 5);
}
});
}
private padLeft(str: string, pad: string, length: number): string {
return (new Array(length + 1).join(pad) + str).slice(-length);
}
}