MsgPack.MessagePackCode.ToString C# (CSharp) Method

ToString() private method

private ToString ( int code ) : string
code int
return string
		public static string ToString( int code )
		{
			if( code < 0x80)
			{
				return "PositiveFixNum";
			}
			else if( code >= 0xE0)
			{
				return "NegativeFixNum";
			}

			switch( code )
			{
				case 0xC0:
				{
					return "Nil";
				}
				case 0xC3:
				{
					return "True";
				}
				case 0xD0:
				{
					return "SingnedInt8";
				}
				case 0xCC:
				{
					return "UnsignedInt8";
				}
				case 0xD1:
				{
					return "SignedInt16";
				}
				case 0xCD:
				{
					return "UnsignedInt16";
				}
				case 0xD2:
				{
					return "SignedInt32";
				}
				case 0xCE:
				{
					return "UnsignedInt32";
				}
				case 0xD3:
				{
					return "SignedInt64";
				}
				case 0xCF:
				{
					return "UnsignedInt64";
				}
				case 0xCA:
				{
					return "Real32";
				}
				case 0xCB:
				{
					return "Real64";
				}
				case 0xDC:
				{
					return "Array16";
				}
				case 0xDD:
				{
					return "Array32";
				}
				case 0xDE:
				{
					return "Map16";
				}
				case 0xDF:
				{
					return "Map32";
				}
				case 0xDA:
				{
					return "Raw16";
				}
				case 0xDB:
				{
					return "Raw32";
				}
			}

			switch( ( code & 0xF0))
			{
				case 0x80:
				{
					return "FixedMap";
				}
				case 0x90:
				{
					return "FixedArray";
				}
				case 0xA0:
				case 0xB0:
				{
					return "FixedRaw";
				}
			}

			return "Unknown";
		}
	}

Usage Example

Ejemplo n.º 1
0
 private void ThrowTypeException(Type type, byte header)
 {
     throw new MessageTypeException(
               String.Format(
                   CultureInfo.CurrentCulture,
                   this._source.CanSeek
                                 ? "Cannot convert '{0}' type value from type '{2}'(0x{1:X}) in position {3:#,0}."
                                 : "Cannot convert '{0}' type value from type '{2}'(0x{1:X}) in offset {3:#,0}.",
                   type,
                   header,
                   MessagePackCode.ToString(header),
                   this._offset
                   )
               );
 }
All Usage Examples Of MsgPack.MessagePackCode::ToString
MessagePackCode