Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #5
0
 protected int write(ref zdll.args arg, string val)
 {
     byte[] src = Encoding.ASCII.GetBytes(val);
     return(write(ref arg, src));
 }
Пример #6
0
 protected abstract int _decode_field(ref zdll.args arg);
Пример #7
0
 protected int read(ref zdll.args arg, out string val)
 {
     val = Encoding.Default.GetString(read(ref arg));
     return(arg.buffsz);
 }
Пример #8
0
 protected int read(ref zdll.args arg, out byte[] val)
 {
     val = read(ref arg);
     return(arg.buffsz);
 }
Пример #9
0
        private static int decode_cb(ref zdll.args arg)
        {
            wire obj = uds[arg.ud];

            return(obj._decode_field(ref arg));
        }
Пример #10
0
 protected int read(ref zdll.args arg, out ulong val)
 {
     val = BitConverter.ToUInt64(read(ref arg), 0);
     return(arg.buffsz);
 }
Пример #11
0
 protected int read(ref zdll.args arg, out byte val)
 {
     val = (byte)read(ref arg)[0];
     return(arg.buffsz);
 }
Пример #12
0
 protected int read(ref zdll.args arg, out int val)
 {
     val = BitConverter.ToInt32(read(ref arg), 0);
     return(arg.buffsz);
 }
Пример #13
0
 protected int read(ref zdll.args arg, out bool val)
 {
     val = BitConverter.ToBoolean(read(ref arg), 0);
     return(arg.buffsz);
 }
Пример #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);
 }
Пример #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));
 }
Пример #16
0
 protected int write(ref zdll.args arg, ushort val)
 {
     byte[] src = BitConverter.GetBytes(val);
     return(write(ref arg, src));
 }
Пример #17
0
 protected int read(ref zdll.args arg, out float val)
 {
     val = BitConverter.ToSingle(read(ref arg), 0);
     return(arg.buffsz);
 }