Esempio n. 1
0
		public void Encode (TypeSpec type)
		{
			if (type == TypeManager.bool_type) {
				Stream.Write ((byte) 0x02);
			} else if (type == TypeManager.char_type) {
				Stream.Write ((byte) 0x03);
			} else if (type == TypeManager.sbyte_type) {
				Stream.Write ((byte) 0x04);
			} else if (type == TypeManager.byte_type) {
				Stream.Write ((byte) 0x05);
			} else if (type == TypeManager.short_type) {
				Stream.Write ((byte) 0x06);
			} else if (type == TypeManager.ushort_type) {
				Stream.Write ((byte) 0x07);
			} else if (type == TypeManager.int32_type) {
				Stream.Write ((byte) 0x08);
			} else if (type == TypeManager.uint32_type) {
				Stream.Write ((byte) 0x09);
			} else if (type == TypeManager.int64_type) {
				Stream.Write ((byte) 0x0A);
			} else if (type == TypeManager.uint64_type) {
				Stream.Write ((byte) 0x0B);
			} else if (type == TypeManager.float_type) {
				Stream.Write ((byte) 0x0C);
			} else if (type == TypeManager.double_type) {
				Stream.Write ((byte) 0x0D);
			} else if (type == TypeManager.string_type) {
				Stream.Write ((byte) 0x0E);
			} else if (type == TypeManager.type_type) {
				Stream.Write ((byte) 0x50);
			} else if (type == TypeManager.object_type) {
				Stream.Write ((byte) 0x51);
			} else if (TypeManager.IsEnumType (type)) {
				Stream.Write ((byte) 0x55);
				EncodeTypeName (type);
			} else if (type.IsArray) {
				Stream.Write ((byte) 0x1D);
				Encode (TypeManager.GetElementType (type));
			} else {
				throw new NotImplementedException (type.ToString ());
			}
		}