Exemple #1
0
 protected int write(ref zdll.args arg, byte[] src)
 {
     if (src.Length > arg.buffsz)
     {
         return(zdll.OOM);
     }
     Marshal.Copy(src, 0, arg.buff, src.Length);
     return(src.Length);
 }
Exemple #2
0
 protected int read(ref zdll.args arg, out int val)
 {
     val = 0;
     if (arg.buffsz < sizeof(int))
     {
         return(zdll.ERROR);
     }
     val = BitConverter.ToInt32(read(ref arg), 0);
     return(arg.buffsz);
 }
Exemple #3
0
 protected int read(ref zdll.args arg, out bool val)
 {
     val = false;
     if (arg.buffsz < 1)
     {
         return(zdll.ERROR);
     }
     val = BitConverter.ToBoolean(read(ref arg), 0);
     return(arg.buffsz);
 }
Exemple #4
0
 protected int read(ref zdll.args arg, out float val)
 {
     val = 0.0f;
     if (arg.buffsz < sizeof(float))
     {
         return(zdll.ERROR);
     }
     val = BitConverter.ToSingle(read(ref arg), 0);
     return(arg.buffsz);
 }
Exemple #5
0
 protected int write(ref zdll.args arg, string val)
 {
     byte[] src = Encoding.ASCII.GetBytes(val);
     return(write(ref arg, src));
 }
Exemple #6
0
 protected abstract int _decode_field(ref zdll.args arg);
Exemple #7
0
 protected int read(ref zdll.args arg, out string val)
 {
     val = Encoding.Default.GetString(read(ref arg));
     return(arg.buffsz);
 }
Exemple #8
0
 protected int read(ref zdll.args arg, out byte[] val)
 {
     val = read(ref arg);
     return(arg.buffsz);
 }
Exemple #9
0
        private static int decode_cb(ref zdll.args arg)
        {
            wire obj = uds[arg.ud];

            return(obj._decode_field(ref arg));
        }
Exemple #10
0
 protected int read(ref zdll.args arg, out ulong val)
 {
     val = BitConverter.ToUInt64(read(ref arg), 0);
     return(arg.buffsz);
 }
Exemple #11
0
 protected int read(ref zdll.args arg, out byte val)
 {
     val = (byte)read(ref arg)[0];
     return(arg.buffsz);
 }
Exemple #12
0
 protected int read(ref zdll.args arg, out int val)
 {
     val = BitConverter.ToInt32(read(ref arg), 0);
     return(arg.buffsz);
 }
Exemple #13
0
 protected int read(ref zdll.args arg, out bool val)
 {
     val = BitConverter.ToBoolean(read(ref arg), 0);
     return(arg.buffsz);
 }
Exemple #14
0
 private byte[] read(ref zdll.args arg)
 {
     byte[] ret = new byte[arg.buffsz];
     Marshal.Copy(arg.buff, ret, 0, ret.Length);
     return(ret);
 }
Exemple #15
0
 protected int write(ref zdll.args arg, byte val)
 {
     byte[] src = new byte[1];
     src[0] = (byte)val;
     return(write(ref arg, src));
 }
Exemple #16
0
 protected int write(ref zdll.args arg, ushort val)
 {
     byte[] src = BitConverter.GetBytes(val);
     return(write(ref arg, src));
 }
Exemple #17
0
 protected int read(ref zdll.args arg, out float val)
 {
     val = BitConverter.ToSingle(read(ref arg), 0);
     return(arg.buffsz);
 }