Example #1
0
    //send pose data
    public void SendPoseData()
    {
        PoseDataMessage pdm = new PoseDataMessage();

        pdm.id = myID;
        pdm.pd = NetTypes.getPoseData();
        myClient.Send(MyMessageTypes.pose, pdm);
    }
        public static Array FromNetType(IList values, NetTypes nettype)
        {
            Array result = Array.CreateInstance(APLTypeOfNetType(nettype), values.Count);

            for (int index = 0; index < values.Count; ++index)
            {
                result.SetValue(FromNetType(values[index], nettype), index);
            }
            return(result);
        }
Example #3
0
        public string GetSqlDataArgumentTypeName(string sqlDataTypeName)
        {
            Type netType = null;

            if (NetTypes.TryGetValue(sqlDataTypeName, out netType) == false)
            {
                return("string");
            }
            if (netType == typeof(string))
            {
                return("string");
            }
            return(GetNetSimpleTypeName(netType));
        }
Example #4
0
        /// <summary>
        /// For a given type, return the closest-match SQLite column type, which only understands a very
        /// limited subset of types.
        /// </summary>
        /// <param name="typ"> The type to evaluate. </param>
        /// <returns> The SQLite type column type for that type. </returns>
        internal static SqliteColumnType TypeToColumnType(Type typ)
        {
            var tc = NetTypes.GetNetType(typ);

            if (tc == NetType.Object)
            {
                if (typ == typeof(byte[]) || typ == typeof(Guid))
                {
                    return(SqliteColumnType.Blob);
                }
                else
                {
                    return(SqliteColumnType.Text);
                }
            }
            return(typecodeColumnTypes[(int)tc]);
        }
        public static Type APLTypeOfNetType(NetTypes nettype)
        {
            switch (nettype)
            {
            case NetTypes.Boolean: {
                return(typeof(bool));
            }

            case NetTypes.Int32: {
                return(typeof(int));
            }

            case NetTypes.NullableInt32: {
                return(typeof(object));
            }

            case NetTypes.UInt32: {
                return(typeof(uint));
            }

            case NetTypes.NullableUInt32: {
                return(typeof(object));
            }

            case NetTypes.Double: {
                return(typeof(double));
            }

            case NetTypes.NullableDouble: {
                return(typeof(object));
            }

            case NetTypes.Char: {
                return(typeof(char));
            }

            case NetTypes.NullableChar: {
                return(typeof(object));
            }

            case NetTypes.String: {
                return(typeof(string));
            }

            case NetTypes.DateTime: {
                return(typeof(double));
            }

            case NetTypes.NullableDateTime: {
                return(typeof(object));
            }

            case NetTypes.TimeSpan: {
                return(typeof(double));
            }

            case NetTypes.NullableTimeSpan: {
                return(typeof(object));
            }

            case NetTypes.Object: {
                return(typeof(object));
            }

            case NetTypes.DomainValue: {
                return(typeof(object));
            }

            case NetTypes.Color: {
                return(typeof(int[]));
            }

            case NetTypes.FXRate: {
                return(typeof(Array));
            }

            case NetTypes.NullableFXRate: {
                return(typeof(Array));
            }

            case NetTypes.Byte: {
                return(typeof(sbyte));
            }

            case NetTypes.Int64: {
                return(typeof(double));
            }

            case NetTypes.NullableInt64: {
                return(typeof(object));
            }

            default: {
                throw new UnsupportedNetType("Conversion of Nettypes value {0} is not supported", (int)nettype);
            }
            }
        }
        public static Type TypeOfNetType(NetTypes nettype)
        {
            switch (nettype)
            {
            case NetTypes.Boolean: {
                return(typeof(bool));
            }

            case NetTypes.Int32: {
                return(typeof(int));
            }

            case NetTypes.NullableInt32: {
                return(typeof(int?));
            }

            case NetTypes.UInt32: {
                return(typeof(uint));
            }

            case NetTypes.NullableUInt32: {
                return(typeof(uint?));
            }

            case NetTypes.Double: {
                return(typeof(double));
            }

            case NetTypes.NullableDouble: {
                return(typeof(double?));
            }

            case NetTypes.Char: {
                return(typeof(char));
            }

            case NetTypes.NullableChar: {
                return(typeof(char?));
            }

            case NetTypes.String: {
                return(typeof(string));
            }

            case NetTypes.DateTime: {
                return(typeof(DateTime));
            }

            case NetTypes.NullableDateTime: {
                return(typeof(DateTime?));
            }

            case NetTypes.TimeSpan: {
                return(typeof(TimeSpan));
            }

            case NetTypes.NullableTimeSpan: {
                return(typeof(TimeSpan?));
            }

            case NetTypes.Object: {
                return(typeof(object));
            }

            //case NetTypes.DomainValue: {
            //    return typeof(IDomainValue);
            //}
            //case NetTypes.Color: {
            //    return typeof(Color);
            //}
            //case NetTypes.FXRate: {
            //    return typeof(Precision);
            //}
            //case NetTypes.NullableFXRate: {
            //    return typeof(Precision?);
            //}
            case NetTypes.Byte: {
                return(typeof(byte));
            }

            case NetTypes.Int64: {
                return(typeof(long));
            }

            case NetTypes.NullableInt64: {
                return(typeof(long?));
            }

            default: {
                throw new UnsupportedNetType("Conversion of Nettypes value {0} is not supported", (int)nettype);
            }
            }
        }
        public static object ToNetType(object value, NetTypes nettype)
        {
            switch (nettype)
            {
            case NetTypes.Boolean: {
                return(ToBooleanScalar(value));
            }

            case NetTypes.Int32: {
                return(ToInt32Scalar(value));
            }

            case NetTypes.NullableInt32: {
                return(ToNullableInt32Scalar(value));
            }

            case NetTypes.UInt32: {
                return(ToUInt32Scalar(value));
            }

            case NetTypes.NullableUInt32: {
                return(ToNullableUInt32Scalar(value));
            }

            case NetTypes.Double: {
                return(ToDoubleScalar(value));
            }

            case NetTypes.NullableDouble: {
                return(ToNullableDoubleScalar(value));
            }

            case NetTypes.Char: {
                return(ToCharScalar(value));
            }

            case NetTypes.NullableChar: {
                return(ToNullableCharScalar(value));
            }

            case NetTypes.String: {
                return(ToNetStringsWithLineBreaks(ToStringScalar(value)));
            }

            case NetTypes.TimeSpan: {
                return(ToTimeSpanScalar(value));
            }

            case NetTypes.NullableTimeSpan: {
                return(ToNullableTimeSpanScalar(value));
            }

            case NetTypes.Object: {
                return(ToObjectScalar(value));
            }

            case NetTypes.Byte: {
                return(ToByteScalar(value));
            }

            case NetTypes.Int64: {
                return(ToInt64Scalar(value));
            }

            case NetTypes.NullableInt64: {
                return(ToNullableInt64Scalar(value));
            }

            default: {
                throw new UnsupportedNetType("Conversion of Nettypes value {0} is not supported", (int)nettype);
            }
            }
        }
        public static object FromNetType(object value, NetTypes nettype)
        {
            switch (nettype)
            {
            case NetTypes.Boolean: {
                return(value);
            }

            case NetTypes.Int32: {
                return(value);
            }

            case NetTypes.NullableInt32: {
                return(FromNullableScalar(value));
            }

            case NetTypes.UInt32: {
                return(value);
            }

            case NetTypes.NullableUInt32: {
                return(FromNullableScalar(value));
            }

            case NetTypes.Double: {
                return(value);
            }

            case NetTypes.NullableDouble: {
                return(FromNullableScalar(value));
            }

            case NetTypes.Char: {
                return(value);
            }

            case NetTypes.NullableChar: {
                return(FromNullableScalar(value));
            }

            case NetTypes.String: {
                return(FromStringScalar((string)value));
            }

            case NetTypes.TimeSpan: {
                return(FromTimeSpanScalar((TimeSpan)value));
            }

            case NetTypes.NullableTimeSpan: {
                return(FromNullableTimeSpanScalar((TimeSpan?)value));
            }

            case NetTypes.Object: {
                return(FromObjectScalar(value));
            }

            case NetTypes.Byte: {
                return(FromByteScalar((byte)value));
            }

            case NetTypes.Int64: {
                return(FromInt64Scalar((long)value));
            }

            case NetTypes.NullableInt64: {
                return(FromNullableInt64Scalar((long?)value));
            }

            default: {
                throw new UnsupportedNetType("Conversion of Nettypes value {0} is not supported", (int)nettype);
            }
            }
        }