本文整理汇总了C#中IEncoder.WriteUint64方法的典型用法代码示例。如果您正苦于以下问题:C# IEncoder.WriteUint64方法的具体用法?C# IEncoder.WriteUint64怎么用?C# IEncoder.WriteUint64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEncoder
的用法示例。
在下文中一共展示了IEncoder.WriteUint64方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: encode
public void encode(IEncoder enc) {
enc.WriteUint64((long)first) ;
enc.WriteUint64((long)second) ;
}
示例2: EncodeValue
public void EncodeValue(IEncoder enc, short type, object val) {
try {
switch ((int)type) {
case 1: enc.WriteUint8((short) val) ; break; // U8
case 2: enc.WriteUint16((int) val) ; break; // U16
case 3: enc.WriteUint32((long) val) ; break; // U32
case 4: enc.WriteUint64((long) val) ; break; // U64
case 6: enc.WriteStr8((string) val) ; break; // SSTR
case 7: enc.WriteStr16((string) val) ; break; // LSTR
case 8: enc.WriteDatetime((long) val); break; // ABSTIME
case 9: enc.WriteUint32((long) val); break; // DELTATIME
case 10: ((ObjectID)val).encode(enc) ; break; // ref
case 11:
if ((bool) val) {
enc.WriteUint8(1) ;
} else {
enc.WriteUint8(0) ;
}
break ;
case 12: enc.WriteFloat((float) val); break; // FLOAT
case 13: enc.WriteDouble((double) val); break; // DOUBLE
case 14: enc.WriteUuid((UUID) val) ; break ; // UUID
case 15: enc.WriteMap((Dictionary<string, object>) val) ; break ; // Ftable
case 16: enc.WriteInt8((short) val) ; break; // int8
case 17: enc.WriteInt16((int) val) ; break; // int16
case 18: enc.WriteInt32(long.Parse(""+ val)) ; break; // int32
case 19: enc.WriteInt64(long.Parse("" + val)) ; break; // int64
case 20: // Object
// Check that the object has a session, if not
// take ownership of it
QMFObject qObj = (QMFObject) val ;
if (qObj.Session == null) {
qObj.Session = this ;
}
qObj.Encode(enc) ;
break;
case 21: // List
List<object> items = (List<object>) val ;
MSEncoder lEnc = new MSEncoder(1) ;
lEnc.Init() ;
lEnc.WriteUint32(items.Count) ;
foreach (object obj in items) {
short innerType = Util.QMFType(obj) ;
lEnc.WriteUint8(innerType) ;
this.EncodeValue(lEnc,innerType,obj) ;
}
enc.WriteVbin32(lEnc.Segment().ToArray()) ;
break ;
case 22: // Array
List<object> aItems = (List<object>) val ;
MSEncoder aEnc = new MSEncoder(1) ;
aEnc.Init() ;
long aCount = aItems.Count ;
aEnc.WriteUint32(aCount) ;
if (aCount > 0) {
Object anObj = aItems[0] ;
short innerType = Util.QMFType(anObj) ;
aEnc.WriteUint8(innerType) ;
foreach (object obj in aItems) {
this.EncodeValue(aEnc,innerType,obj) ;
}
}
enc.WriteVbin32(aEnc.Segment().ToArray()) ;
break ;
default:
throw new Exception(String.Format("Invalid Type Code: {0}", type)) ;
}
}
catch (System.InvalidCastException e) {
string msg = String.Format("Class cast exception for typecode {0}, type {1} ", type, val.GetType()) ;
log.Error(msg) ;
throw new Exception(msg + type, e) ;
}
}