コード例 #1
0
ファイル: jConsoleCmd.cs プロジェクト: weimingtom/job_mobile
            public string Get_string(System.IConvertible _arg_index)
            {
                int arg_index = _arg_index.ToInt32(null);

                if (arg_index < m_ArgList.Length)
                {
                    return(m_ArgList[arg_index]);
                }
                if (arg_index < m_ArgDefault.Length)
                {
                    return(m_ArgDefault[arg_index]);
                }
                throw new System.Exception("arg_index overflow : " + arg_index + " : " + m_sFormat);
            }
コード例 #2
0
        public static global::haxe.root.ValueType @typeof(object v)
        {
            if (v == null)
            {
                return(ValueType.TNull);
            }

            System.Type t = v as System.Type;
            if (t != null)
            {
                //class type
                return(ValueType.TObject);
            }

            t = v.GetType();
            if (t.IsEnum)
            {
                return(ValueType.TEnum(t));
            }
            if (t.IsValueType)
            {
                System.IConvertible vc = v as System.IConvertible;
                if (vc != null)
                {
                    switch (vc.GetTypeCode())
                    {
                    case System.TypeCode.Boolean: return(ValueType.TBool);

                    case System.TypeCode.Double:
                        double d = vc.ToDouble(null);
                        if (d >= int.MinValue && d <= int.MaxValue && d == vc.ToInt32(null))
                        {
                            return(ValueType.TInt);
                        }
                        else
                        {
                            return(ValueType.TFloat);
                        }

                    case System.TypeCode.Int32:
                        return(ValueType.TInt);

                    default:
                        return(ValueType.TClass(t));
                    }
                }
                else
                {
                    return(ValueType.TClass(t));
                }
            }

            if (v is haxe.lang.IHxObject)
            {
                if (v is haxe.lang.DynamicObject)
                {
                    return(ValueType.TObject);
                }
                else if (v is haxe.lang.Enum)
                {
                    return(ValueType.TEnum(t));
                }
                return(ValueType.TClass(t));
            }
            else if (v is haxe.lang.Function)
            {
                return(ValueType.TFunction);
            }
            else
            {
                return(ValueType.TClass(t));
            }
        }