public override void Write(Union v, int s)
        {
            if (setMaxSize > -1 && Position + s > setMaxSize)
                throw new EndOfStreamException();
            if (Position + s > size)
                size++;

            for (int i = 0; i < s; i++)
                Marshal.WriteByte(address, Position + i, v[i]);

            Position += s;
        }
Пример #2
0
 public abstract void Write(Union v, int size);
        public override Union ReadUnion(int s)
        {
            if (setMaxSize > -1 && Position + s > setMaxSize)
                throw new EndOfStreamException();
            if (Position + s > size)
                size = Position + s;

            var u = new Union();

            for (int i = 0; i < s; i++)
                u[i] = Marshal.ReadByte(address, Position + i);

            Position += s;

            return u;
        }
        public override void Write(Union v, int s)
        {
            if (pos > buffer.Length - s)
                ResizeBuffer(buffer.Length + s);
            if (pos > size - s)
                size++;

            for (int i = 0; i < s; i++)
                buffer[pos + i] = v[i];

            pos += s;
        }
        public override Union ReadUnion(int s)
        {
            if (pos + s > size)
                throw new EndOfStreamException();

            Union u = new Union();

            for (int i = 0; i < s; i++)
                u[i] = buffer[pos + i];

            return u;
        }
 public override void Write(Union v, int size)
 {
     for (int i = 0; i < size; i++)
         stream.WriteByte(v[i]);
 }
        public override Union ReadUnion(int size)
        {
            var u = new Union();

            for (int i = 0; i < size; i++)
            {
                var v = stream.ReadByte();

                if (v == -1)
                    throw new EndOfStreamException();

                u[i] = (byte)v;
            }

            return u;
        }
Пример #8
0
 public override void Write(Union v, int size)
 {
     res.Write(v, size);
 }