mirror of
				https://github.com/MapMakersAndProgrammers/TankiOnline2.0DemoClient.git
				synced 2025-10-27 02:19:07 -07:00 
			
		
		
		
	Add mostly deobfuscated package, class and function name source
This commit is contained in:
		
							
								
								
									
										59
									
								
								src/_codec/commons/VectorCodecIdLevel1.as
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								src/_codec/commons/VectorCodecIdLevel1.as
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,59 @@ | ||||
| package _codec.commons | ||||
| { | ||||
|    import alternativa.protocol.ICodec; | ||||
|    import alternativa.protocol.IProtocol; | ||||
|    import alternativa.protocol.ProtocolBuffer; | ||||
|    import alternativa.protocol.codec.OptionalCodecDecorator; | ||||
|    import alternativa.protocol.impl.LengthCodecHelper; | ||||
|    import alternativa.protocol.info.TypeCodecInfo; | ||||
|    import commons.Id; | ||||
|     | ||||
|    public class VectorCodecIdLevel1 implements ICodec | ||||
|    { | ||||
|       private var elementCodec:ICodec; | ||||
|        | ||||
|       private var optionalElement:Boolean; | ||||
|        | ||||
|       public function VectorCodecIdLevel1(optionalElement:Boolean) | ||||
|       { | ||||
|          super(); | ||||
|          this.optionalElement = optionalElement; | ||||
|       } | ||||
|        | ||||
|       public function init(protocol:IProtocol) : void | ||||
|       { | ||||
|          this.elementCodec = protocol.getCodec(new TypeCodecInfo(Id,false)); | ||||
|          if(this.optionalElement) | ||||
|          { | ||||
|             this.elementCodec = new OptionalCodecDecorator(this.elementCodec); | ||||
|          } | ||||
|       } | ||||
|        | ||||
|       public function decode(protocolBuffer:ProtocolBuffer) : Object | ||||
|       { | ||||
|          var length:int = LengthCodecHelper.decodeLength(protocolBuffer); | ||||
|          var result:Vector.<Id> = new Vector.<Id>(length,true); | ||||
|          for(var i:int = 0; i < length; i++) | ||||
|          { | ||||
|             result[i] = Id(this.elementCodec.decode(protocolBuffer)); | ||||
|          } | ||||
|          return result; | ||||
|       } | ||||
|        | ||||
|       public function encode(protocolBuffer:ProtocolBuffer, object:Object) : void | ||||
|       { | ||||
|          if(object == null) | ||||
|          { | ||||
|             throw new Error("Object is null. Use @ProtocolOptional annotation."); | ||||
|          } | ||||
|          var data:Vector.<Id> = Vector.<Id>(object); | ||||
|          var length:int = int(data.length); | ||||
|          LengthCodecHelper.encodeLength(protocolBuffer,length); | ||||
|          for(var i:int = 0; i < length; i++) | ||||
|          { | ||||
|             this.elementCodec.encode(protocolBuffer,data[i]); | ||||
|          } | ||||
|       } | ||||
|    } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Pyogenics
					Pyogenics