示例#1
0
        private static int GetComponent(ConversionStorage <int> /*!*/ conversionStorage, object[] components, int index, int defValue, bool zeroOk)
        {
            if (index >= components.Length || components[index] == null)
            {
                return(defValue);
            }

            object component = components[index];

            int result;

            try {
                result = Protocols.CastToFixnum(conversionStorage, component);
            } catch (InvalidOperationException) {
                MutableString str = component as MutableString;
                if (str == null)
                {
                    throw;
                }
                result = checked ((int)MutableStringOps.ToInteger(str, 10));
            }

            if (result == 0 && !zeroOk)
            {
                return(defValue);
            }
            else
            {
                return(result);
            }
        }