当前位置: 首页>>代码示例>>C#>>正文


C# IDecoder.ReadUint8方法代码示例

本文整理汇总了C#中IDecoder.ReadUint8方法的典型用法代码示例。如果您正苦于以下问题:C# IDecoder.ReadUint8方法的具体用法?C# IDecoder.ReadUint8怎么用?C# IDecoder.ReadUint8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDecoder的用法示例。


在下文中一共展示了IDecoder.ReadUint8方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: QMFEvent

		public QMFEvent(Session session, IDecoder dec)
		{
			Session = session ;
			ClassKey = new ClassKey(dec) ;
			Timestamp = dec.ReadInt64() ;
			Severity = (EventSeverity) dec.ReadUint8() ;
			SchemaClass sClass = Session.GetSchema(ClassKey) ;
			Arguments = new Dictionary<string, object>() ;
			
			if (sClass != null) {
				foreach (SchemaArgument arg in sClass.Arguments) {
					Arguments[arg.Name] = Session.DecodeValue(dec, arg.Type) ;	
				}
			}	
		}
开发者ID:drzo,项目名称:opensim4opencog,代码行数:15,代码来源:QMFEvent.cs

示例2: DecodeValue

		public object DecodeValue(IDecoder dec, short type) {
		
		 	switch (type) {
		 		case 1: return dec.ReadUint8() ;        // U8
		 		case 2: return dec.ReadUint16() ;       // U16     
		 		case 3: return dec.ReadUint32() ;       // U32
		 		case 4: return dec.ReadUint64() ;       // U64 
		 		case 6: return dec.ReadStr8() ;         // SSTR
		 		case 7: return dec.ReadStr16() ;        // LSTR
		 		case 8: return dec.ReadDatetime() ;	    // ABSTIME
		 		case 9: return dec.ReadUint32() ;       // DELTATIME
		 		case 10: return new ObjectID(dec) ;		// ref
		 		case 11: return dec.ReadUint8() != 0 ;  // bool
		 		case 12: return dec.ReadFloat() ;       // float		
		 		case 13: return dec.ReadDouble() ;      // double		 
		 		case 14: return dec.ReadUuid() ;	    // UUID			
		 		case 15: return dec.ReadMap() ;             // Ftable
		 		case 16: return dec.ReadInt8() ;        // int8
		 		case 17: return dec.ReadInt16() ;       // int16    
		 		case 18: return dec.ReadInt32() ;       // int32
		 		case 19: return dec.ReadInt64() ;       // int64 		 			
		 		case 20:                                // Object
		 			// Peek into the inner type code, make sure 
		 			// it is actually an object
		 			object returnValue = null ;
		 			short innerTypeCode = dec.ReadUint8() ;
		 			if (innerTypeCode != 20) {
		 				returnValue = this.DecodeValue(dec, innerTypeCode) ;
		 			}
		 			else {
		 				ClassKey classKey = new ClassKey(dec) ;
		 				lock(LockObject) {
		 					SchemaClass sClass = GetSchema(classKey) ;
		 					if (sClass != null) {
		 						returnValue = this.CreateQMFObject(sClass, dec, true, true, false) ;
		 					}
		 				}
		 			}
		 			return returnValue;
                case 21:                                 // List
		 	        {
		 	            MSDecoder lDec = new MSDecoder();
		 	            lDec.Init(new MemoryStream(dec.ReadVbin32()));
		 	            long count = lDec.ReadUint32();
		 	            List<object> newList = new List<object>();
		 	            while (count > 0)
		 	            {
		 	                short innerType = lDec.ReadUint8();
		 	                newList.Add(this.DecodeValue(lDec, innerType));
		 	                count -= 1;
		 	            }
		 	            return newList;
		 	        }
                case 22:							    // Array
		 	        {
		 	            MSDecoder aDec = new MSDecoder();
		 	            aDec.Init(new MemoryStream(dec.ReadVbin32()));
		 	            long cnt = aDec.ReadUint32();
		 	            short innerType = aDec.ReadUint8();
		 	            List<object> aList = new List<object>();
		 	            while (cnt > 0)
		 	            {
		 	                aList.Add(this.DecodeValue(aDec, innerType));
		 	                cnt -= 1;
		 	            }
		 	            return aList;
		 	        }
		 	    default: 
		 			throw new Exception(String.Format("Invalid Type Code: {0}", type)) ;		
		 	}	
		 }		
开发者ID:drzo,项目名称:opensim4opencog,代码行数:71,代码来源:Session.cs

示例3: HandleSchemaResponse

		public void HandleSchemaResponse(Broker broker, IDecoder decoder, long sequence) {
			short kind = decoder.ReadUint8() ;	
			ClassKey classKey = new ClassKey(decoder) ;
			SchemaClass sClass = new SchemaClass(kind, classKey, decoder, this) ;				
			lock(LockObject) {
				Dictionary<string, SchemaClass> classMappings = Packages[sClass.PackageName] ;
				classMappings.Remove(sClass.ClassKeyString) ;
				classMappings.Add(sClass.ClassKeyString, sClass) ;
			}
			
			SequenceManager.Release(sequence) ;
			broker.DecrementOutstanding() ;
			if (Console != null) {
				this.Console.NewClass(kind, classKey) ;
			}	
		}	
开发者ID:drzo,项目名称:opensim4opencog,代码行数:16,代码来源:Session.cs

示例4: HandleClassIndicator

		public void HandleClassIndicator(Broker broker, IDecoder decoder, long sequence) {
			short kind = decoder.ReadUint8() ;	
			ClassKey classKey = new ClassKey(decoder) ;
			bool unknown = false ;
			
			
			lock (LockObject) {
				if (Packages.ContainsKey(classKey.PackageName)) {
					if (!Packages[classKey.PackageName].ContainsKey(classKey.GetKeyString())) {
						unknown = true ;
					}
				}
			}
			
			if (unknown) {
				broker.IncrementOutstanding() ;
				long seq = SequenceManager.Reserve(Session.CONTEXT_STARTUP) ; 
				IEncoder enc = broker.CreateEncoder('S', seq) ;			
				classKey.encode(enc) ;	
				broker.Send(enc) ;				
			}
		}		
开发者ID:drzo,项目名称:opensim4opencog,代码行数:22,代码来源:Session.cs

示例5: ProcessPresenceMasks

		protected List<string> ProcessPresenceMasks(IDecoder dec, SchemaClass schema) {
			List<string> excludes = new List<string> () ;
			short bit = 0 ;
			short mask = 0 ;
			foreach (SchemaProperty prop in Schema.GetAllProperties()) {
				if (prop.Optional) {
					//log.Debug(String.Format("Property named {0} is optional", prop.Name)) ;				
					if (bit == 0) {
						mask=dec.ReadUint8() ;
						bit = 1 ;
					}

					if ((mask & bit) == 0) {
						//log.Debug(String.Format("Property named {0} is not present", prop.Name)) ;
						excludes.Add(prop.Name) ;
					}
					bit *= 2 ;
					if (bit == 256) {
						bit = 0 ;
					}
				}
			}
			return excludes ;			
		}
开发者ID:drzo,项目名称:opensim4opencog,代码行数:24,代码来源:QMFObject.cs

示例6: CheckHeader

		protected bool CheckHeader(IDecoder decoder, out char opcode, out long sequence) {
			bool returnValue = false ;		
			opcode = 'x' ;
			sequence = -1 ;
			if(decoder.HasRemaining()) {
				char character = (char) decoder.ReadUint8() ;
				if (character != 'A') {
					return returnValue ;
				}
				character = (char) decoder.ReadUint8() ;			
				if (character != 'M') {
					return returnValue ;
				}
				character = (char) decoder.ReadUint8() ;			
				if (character != '2') {
					return returnValue ;
				}	
				returnValue = true ;
				opcode = (char) decoder.ReadUint8() ;
				sequence = decoder.ReadUint32() ;
			}
			return returnValue ;
		}
开发者ID:drzo,项目名称:opensim4opencog,代码行数:23,代码来源:Broker.cs


注:本文中的IDecoder.ReadUint8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。