示例#1
0
 public string GetTypeName(ArrayType tst)
 {
     return GetTypeName((dynamic)tst.ElementType) + "[]";
 }
示例#2
0
文件: Generator.cs 项目: omeaart/CSTS
        private TypeScriptType GetTypeScriptType(Type type)
        {
            TypeScriptType tst;

              if (TypeHelper.Is(type, typeof(string)))
              {
            tst = new StringType();
              }
              else if (TypeHelper.Is(type, typeof(bool)))
              {
            tst = new BooleanType();
              }
              else if (TypeHelper.Is(type, typeof(int),
                                        typeof(decimal),
                                        typeof(double),
                                        typeof(long),
                                        typeof(float),
                                        typeof(short),
                                        typeof(byte),
                                        typeof(uint),
                                        typeof(ushort),
                                        typeof(ulong),
                                        typeof(sbyte)
                                        ))
              {
            tst = new NumberType();
              }
              else if (TypeHelper.Is(type, typeof(DateTime)))
              {
            tst = new DateTimeType();
              }
              else if (TypeHelper.Is(type, typeof(TimeSpan)))
              {
            tst = new TimeSpanType();
              }
              else if (type.IsGenericParameter)
              {
            tst = new GenericTypeParameter();
              }
              else if (TypeHelper.IsDictionary(type))
              {
            tst = new DictionaryType();
              }
              else if (TypeHelper.IsEnumerable(type))
              {
            tst = new ArrayType();
              }
              else if (TypeHelper.IsEnum(type))
              {
            tst = new EnumType();
              }
              else
              {
            var processType = _options.TypeFilter(type);

            if (processType)
            {
              if (type.IsInterface)
              {
            tst = new InterfaceType(type);
              }
              else
              {
            tst = new CustomType(type);
              }
            }
            else
            {
              tst = new AnyType();
            }
              }

              if (TypeHelper.IsNullableValueType(type))
              {
            ((ValueType)tst).IsNullable = true;
            type = Nullable.GetUnderlyingType(type);
              }

              tst.ClrType = type;

              return tst;
        }
示例#3
0
文件: Generator.cs 项目: omeaart/CSTS
        private TypeScriptType ProcessTypeScriptType(Type t, ArrayType tst)
        {
            var typeInside = TypeHelper.GetTypeInsideEnumerable(t);

              var typeInsideTst = GetTypeScriptType(typeInside);

              tst.ElementType = ProcessTypeScriptType(typeInside, (dynamic)typeInsideTst);

              return tst;
        }
示例#4
0
 public string GetModuleName(ArrayType type)
 {
     return GetModuleName((dynamic)type.ElementType);
 }