Ejemplo n.º 1
0
        public static object GetFieldOrProperty(string typename, string name)
        {
            Type t = ClrFacade.GetType(typename);

            if (t == null)
            {
                throw new ArgumentException(String.Format("Type not found: {0}", typename));
            }
            return(GetFieldOrPropertyType(t, name));
        }
Ejemplo n.º 2
0
        public static string[] GetEnumNames(string enumTypename)
        {
            var t = ClrFacade.GetType(enumTypename);

            if (t == null)
            {
                throw new ArgumentException(String.Format("Type not found: {0}", enumTypename));
            }
            return(GetEnumNames(t));
        }
Ejemplo n.º 3
0
 private SymbolicExpression ConvertDateTime(object obj)
 {
     if (!ConvertVectors) return null;
     if (!ConvertValueTypes) return null;
     DateTime value = (DateTime)obj;
     var doubleValue = ClrFacade.GetRPosixCtDoubleRepresentation(value);
     var result = ConvertDouble(doubleValue);
     AddPosixctAttributes(result);
     return result;
 }
Ejemplo n.º 4
0
        public static string[] GetSignature(string typeName, string memberName)
        {
            Type type = ClrFacade.GetType(typeName);

            if (type != null)
            {
                return(GetSignature_Type(type, memberName));
            }
            else
            {
                return new string[] {}
            };
        }
Ejemplo n.º 5
0
        private static DateTime[] RPosixctToDateTime(SymbolicExpression sexp, double[] values)
        {
            var tz = RDotNetDataConverter.GetTzoneAttrib(sexp);

            if (!isSupportedTimeZone(tz))
            {
                throw new NotSupportedException("POSIXct conversion supported only for UTC or unspecified (local) time zone, not for " + tz);
            }

            //number of seconds since 1970-01-01 UTC
            return(Array.ConvertAll(values,
                                    v =>
            {
                bool utc = isUtc(tz);
                return ClrFacade.ForceDateKind(RDateOrigin + TimeSpan.FromTicks((long)(TimeSpan.TicksPerSecond * v)), utc);
            }
                                    ));
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Gets a string helping to identify the COM variant to which an object is converted to an unmanaged data structure, if at all.
 /// </summary>
 /// <param name="obj">An object or type name, from which to call a method</param>
 /// <param name="methodName">the name of a method to call on the object or class</param>
 /// <param name="arguments">The arguments to the method call</param>
 /// <returns>A string such as "VT_ARRAY | VT_BOOL" if the method call returns a bool[]</returns>
 public static string GetReturnedVariantTypename(object obj, string methodName, params object[] arguments)
 {
     if (obj == null)
     {
         throw new ArgumentNullException("obj");
     }
     else if (obj is Type)
     {
         return(GetVariantTypename(ClrFacade.InternalCallStaticMethod((Type)obj, methodName, false, arguments)));
     }
     else if (obj is string)
     {
         return(GetVariantTypename(ClrFacade.InternalCallStaticMethod(ClrFacade.GetType((string)obj), methodName, false, arguments)));
     }
     else
     {
         return(GetVariantTypename(ClrFacade.InternalCallInstanceMethod(obj, methodName, false, arguments)));
     }
 }
Ejemplo n.º 7
0
 public static string GetExceptionMessage()
 {
     return(ClrFacade.FormatExceptionInnermost(CreateInnerExceptions()));
 }
Ejemplo n.º 8
0
        public static string[] GetStaticProperties(string typeName, string pattern)
        {
            Type type = ClrFacade.GetType(typeName);

            return(getProperties(type, pattern, BindingFlags.Public | BindingFlags.Static));
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Gets all the non-static public constructors of a class.
 /// </summary>
 /// <param name="typeName">type name</param>
 public static string[] GetConstructors(string typeName)
 {
     return(GetConstructors(ClrFacade.GetType(typeName)));
 }