| 
				
			 | 
			
			
				@@ -1,5 +1,5 @@ 
			 | 
		
	
		
			
			| 
				1
			 | 
			
				1
			 | 
			
			
				 import { Utils } from './utils'; 
			 | 
		
	
		
			
			| 
				2
			 | 
			
				
			 | 
			
			
				-import Int64 from 'node-int64'; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				2
			 | 
			
			
				+import * as Int64 from 'node-int64'; 
			 | 
		
	
		
			
			| 
				3
			 | 
			
				3
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				4
			 | 
			
				4
			 | 
			
			
				 export class Packet { 
			 | 
		
	
		
			
			| 
				5
			 | 
			
				5
			 | 
			
			
				   private key: string = 'b8ca9aa66def05ff3f24919274bb4a66'; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -10,12 +10,7 @@ export class Packet { 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				10
			 | 
			
			
				   public header: string; 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				11
			 | 
			
			
				   public body: string; 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				12
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				13
			 | 
			
				
			 | 
			
			
				-  public pack( 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				
			 | 
			
			
				-    operator: number, 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				
			 | 
			
			
				-    sequence: number, 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				
			 | 
			
			
				-    header: string, 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				
			 | 
			
			
				-    body: string, 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				
			 | 
			
			
				-  ): ArrayBuffer { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				13
			 | 
			
			
				+  public pack(operator: number, sequence: number, header: string, body: string): ArrayBuffer { 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				14
			 | 
			
			
				     header = Utils.encrypt(header, this.key, this.key); 
			 | 
		
	
		
			
			| 
				20
			 | 
			
				15
			 | 
			
			
				     body = Utils.encrypt(body, this.key, this.key); 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				16
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -49,15 +44,11 @@ export class Packet { 
			 | 
		
	
		
			
			| 
				49
			 | 
			
				44
			 | 
			
			
				     const dataView = new DataView(data); 
			 | 
		
	
		
			
			| 
				50
			 | 
			
				45
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				51
			 | 
			
				46
			 | 
			
			
				     this.operator = dataView.getUint32(0, false); 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				
			 | 
			
			
				-    this.sequence = new Int64( 
			 | 
		
	
		
			
			| 
				53
			 | 
			
				
			 | 
			
			
				-      new Uint8Array(dataView.buffer.slice(4, 12)), 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				
			 | 
			
			
				-    ).toNumber(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+    this.sequence = new Int64(new Uint8Array(dataView.buffer.slice(4, 12))).toNumber(); 
			 | 
		
	
		
			
			| 
				55
			 | 
			
				48
			 | 
			
			
				     this.headerLength = dataView.getUint32(12, false); 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				49
			 | 
			
			
				     this.bodyLength = dataView.getUint32(16, false); 
			 | 
		
	
		
			
			| 
				57
			 | 
			
				50
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				58
			 | 
			
				
			 | 
			
			
				-    const header = Utils.ab2str( 
			 | 
		
	
		
			
			| 
				59
			 | 
			
				
			 | 
			
			
				-      dataView.buffer.slice(20, 20 + this.headerLength), 
			 | 
		
	
		
			
			| 
				60
			 | 
			
				
			 | 
			
			
				-    ); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+    const header = Utils.ab2str(dataView.buffer.slice(20, 20 + this.headerLength)); 
			 | 
		
	
		
			
			| 
				61
			 | 
			
				52
			 | 
			
			
				     const body = Utils.ab2str(dataView.buffer.slice(20 + this.headerLength)); 
			 | 
		
	
		
			
			| 
				62
			 | 
			
				53
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				63
			 | 
			
				54
			 | 
			
			
				     this.header = Utils.decrypt(header, this.key, this.key); 
			 |