コード例 #1
0
 //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));
     }
 }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
 /// <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;
     }
 }
コード例 #4
0
 /// <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;
     }
 }
コード例 #5
0
ファイル: EventLogParser.cs プロジェクト: yuva2achieve/dot42
        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);
        }
コード例 #6
0
 public static string ToString(this EventContainer.EventValueTypes instance)
 {
     return(instance.ToString().ToLower(CultureInfo.GetCultureInfo("en-US")));
 }
コード例 #7
0
 public static int getValue(this EventContainer.EventValueTypes valueType)
 {
     return((int)valueType);
 }
コード例 #8
0
 /// <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);
 }