예제 #1
0
 public static void Register(Transmuter transmuter)
 {
     transmuter.Register(FromTimestamp());
     transmuter.Register(ToTimestamp());
     transmuter.Register(FromString());
     transmuter.Register(new ToStringConverter <DateTime>());
 }
예제 #2
0
 public static void Register(Transmuter transmuter)
 {
     transmuter.Register(FromInts());
     transmuter.Register(ToInts());
     transmuter.Register(FromFloats());
     transmuter.Register(ToFloats());
 }
예제 #3
0
        public static void Register(Transmuter transmuter)
        {
            //bytes
            transmuter.Register(new RelayConverter <short, byte[]>(x => BitConverter.GetBytes(x)));
            transmuter.Register(new RelayConverter <int, byte[]>(x => BitConverter.GetBytes(x)));
            transmuter.Register(new RelayConverter <long, byte[]>(x => BitConverter.GetBytes(x)));
            transmuter.Register(new RelayConverter <float, byte[]>(x => BitConverter.GetBytes(x)));
            transmuter.Register(new RelayConverter <double, byte[]>(x => BitConverter.GetBytes(x)));
            transmuter.Register(new RelayConverter <bool, byte[]>(x => BitConverter.GetBytes(x)));
            transmuter.Register(new RelayConverter <byte[], short>(x => BitConverter.ToInt16(x, 0)));
            transmuter.Register(new RelayConverter <byte[], int>(x => BitConverter.ToInt32(x, 0)));
            transmuter.Register(new RelayConverter <byte[], long>(x => BitConverter.ToInt64(x, 0)));
            transmuter.Register(new RelayConverter <byte[], float>(x => BitConverter.ToSingle(x, 0)));
            transmuter.Register(new RelayConverter <byte[], double>(x => BitConverter.ToDouble(x, 0)));
            transmuter.Register(new RelayConverter <byte[], bool>(x => BitConverter.ToBoolean(x, 0)));

            //Casts
            transmuter.Register(new CastConverter <int, short>());
            transmuter.Register(new CastConverter <short, int>());
            transmuter.Register(new CastConverter <int, long>());
            transmuter.Register(new CastConverter <long, int>());
            transmuter.Register(new CastConverter <int, float>());
            transmuter.Register(new CastConverter <float, int>());
            transmuter.Register(new CastConverter <int, double>());
            transmuter.Register(new CastConverter <double, int>());
            transmuter.Register(new CastConverter <float, double>());
            transmuter.Register(new CastConverter <double, float>());

            //bool
            transmuter.Register(new RelayConverter <int, bool>(x => x > 0));
            transmuter.Register(new RelayConverter <bool, int>(x => x ? 1 : 0));
            transmuter.Register(new RelayConverter <bool, bool>(x => !x), "invert");
        }
예제 #4
0
 public static void Register(Transmuter transmuter)
 {
     transmuter.Register(FromBytes());
     transmuter.Register(ToBytes());
     transmuter.Register(FromInt());
     transmuter.Register(ToInt());
     transmuter.Register(FromBool());
     transmuter.Register(ToBool());
 }
예제 #5
0
 public static void Register(Transmuter transmuter)
 {
     //Casts
     transmuter.Register(new RelayConverter <nint, int>(x => (int)x));
     transmuter.Register(new RelayConverter <int, nint>(x => new nint(x)));
     transmuter.Register(new RelayConverter <nint, float>(x => (int)x));
     transmuter.Register(new RelayConverter <float, nint>(x => new nint((int)x)));
     transmuter.Register(new RelayConverter <nint, double>(x => (int)x));
     transmuter.Register(new RelayConverter <double, nint>(x => new nint((int)x)));
     transmuter.Register(new RelayConverter <nfloat, int>(x => (int)x));
     transmuter.Register(new RelayConverter <int, nfloat>(x => new nfloat(x)));
     transmuter.Register(new RelayConverter <nfloat, float>(x => (float)x));
     transmuter.Register(new RelayConverter <float, nfloat>(x => new nfloat(x)));
     transmuter.Register(new RelayConverter <nfloat, double>(x => x));
     transmuter.Register(new RelayConverter <double, nfloat>(x => new nfloat(x)));
 }
예제 #6
0
 public static void Register(Transmuter transmuter)
 {
     transmuter.Register(FromString());
 }
예제 #7
0
 public static void Register(Transmuter transmuter)
 {
     transmuter.Register(FromDateTime());
     transmuter.Register(ToDateTime());
 }