//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void checkType(com.android.ddmlib.log.EventContainer.EventValueType type) throws InvalidValueTypeException public static void checkType(this EventValueDescription.ValueTypes instance, EventContainer.EventValueTypes type) { if ((type != EventContainer.EventValueTypes.INT && type != EventContainer.EventValueTypes.LONG) && instance != EventValueDescription.ValueTypes.NOT_APPLICABLE) { throw new InvalidValueTypeException(string.Format("{0} doesn't support type {1}", type, instance)); } }
/// <summary> /// Builds a <seealso cref="EventValueDescription"/> with a name and a type, and a <seealso cref="ValueType"/>. /// <p/> </summary> /// <param name="name"> </param> /// <param name="type"> </param> /// <param name="valueType"> </param> /// <exception cref="InvalidValueTypeException"> if type and valuetype are not compatible. /// </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: EventValueDescription(String name, com.android.ddmlib.log.EventContainer.EventValueType type, ValueType valueType) throws InvalidValueTypeException internal EventValueDescription(string name, EventContainer.EventValueTypes type, ValueTypes valueType) { mName = name; mEventValueType = type; mValueType = valueType; mValueType.checkType(mEventValueType); }
/// <summary> /// Builds a <seealso cref="EventValueDescription"/> with a name and a type. /// <p/> /// If the type is <seealso cref="EventValueType#INT"/> or <seealso cref="EventValueType#LONG"/>, the /// <seealso cref="#mValueType"/> is set to <seealso cref="ValueType#BYTES"/> by default. It set to /// <seealso cref="ValueType#NOT_APPLICABLE"/> for all other <seealso cref="EventValueType"/> values. </summary> /// <param name="name"> </param> /// <param name="type"> </param> internal EventValueDescription(string name, EventContainer.EventValueTypes type) { mName = name; mEventValueType = type; if (mEventValueType == EventContainer.EventValueTypes.INT || mEventValueType == EventContainer.EventValueTypes.LONG) { mValueType = ValueTypes.BYTES; } else { mValueType = ValueTypes.NOT_APPLICABLE; } }
/// <summary> /// Builds a <seealso cref="EventValueDescription"/> with a name and a type. /// <p/> /// If the type is <seealso cref="EventValueType#INT"/> or <seealso cref="EventValueType#LONG"/>, the /// <seealso cref="#mValueType"/> is set to <seealso cref="ValueType#BYTES"/> by default. It set to /// <seealso cref="ValueType#NOT_APPLICABLE"/> for all other <seealso cref="EventValueType"/> values. </summary> /// <param name="name"> </param> /// <param name="type"> </param> internal EventValueDescription(string name, EventContainer.EventValueTypes type) { mName = name; mEventValueType = type; if (mEventValueType == EventContainer.EventValueTypes.INT || mEventValueType == EventContainer.EventValueTypes.LONG) { mValueType = ValueTypes.BYTES; } else { mValueType = ValueTypes.NOT_APPLICABLE; } }
private object getObjectFromString(string value, EventContainer.EventValueTypes type) { try { switch (type) { case EventContainer.EventValueTypes.INT: return(int.Parse(value)); case EventContainer.EventValueTypes.LONG: return(long.Parse(value)); case EventContainer.EventValueTypes.STRING: return(value); } } catch (Exception) { // do nothing, we'll return null. } return(null); }
public static string ToString(this EventContainer.EventValueTypes instance) { return(instance.ToString().ToLower(CultureInfo.GetCultureInfo("en-US"))); }
public static int getValue(this EventContainer.EventValueTypes valueType) { return((int)valueType); }
/// <summary> /// Builds a <seealso cref="EventValueDescription"/> with a name and a type, and a <seealso cref="ValueType"/>. /// <p/> </summary> /// <param name="name"> </param> /// <param name="type"> </param> /// <param name="valueType"> </param> /// <exception cref="InvalidValueTypeException"> if type and valuetype are not compatible. /// </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: EventValueDescription(String name, com.android.ddmlib.log.EventContainer.EventValueType type, ValueType valueType) throws InvalidValueTypeException internal EventValueDescription(string name, EventContainer.EventValueTypes type, ValueTypes valueType) { mName = name; mEventValueType = type; mValueType = valueType; mValueType.checkType(mEventValueType); }