Ejemplo n.º 1
0
        public void GetHeaderDataToStream(Stream stream)
        {
            if (Body != null)
            {
                Header.Length = (uint)Body.Length;
            }

            MessageWriter writer = new MessageWriter(Header.Endianness);

            //headerWriter (writer, Header);

            writer.Write((byte)Header.Endianness);
            writer.Write((byte)Header.MessageType);
            writer.Write((byte)Header.Flags);
            writer.Write(Header.MajorVersion);
            writer.Write(Header.Length);
            writer.Write(Header.Serial);
            writer.WriteHeaderFields(Header.Fields);

            writer.CloseWrite();

            writer.ToStream(stream);
        }
Ejemplo n.º 2
0
        //public HeaderField[] Fields;

        /*
         * public void SetHeaderData (byte[] data)
         * {
         *      EndianFlag endianness = (EndianFlag)data[0];
         *      MessageReader reader = new MessageReader (endianness, data);
         *
         *      Header = (Header)reader.ReadStruct (typeof (Header));
         * }
         */

        //TypeWriter<Header> headerWriter = TypeImplementer.GetTypeWriter<Header> ();
        public byte[] GetHeaderData()
        {
            if (Body != null)
            {
                Header.Length = (uint)Body.Length;
            }

            MessageWriter writer = new MessageWriter(Header.Endianness);

            //writer.stream.Capacity = 512;
            //headerWriter (writer, Header);

            writer.Write((byte)Header.Endianness);
            writer.Write((byte)Header.MessageType);
            writer.Write((byte)Header.Flags);
            writer.Write(Header.MajorVersion);
            writer.Write(Header.Length);
            writer.Write(Header.Serial);
            writer.WriteHeaderFields(Header.Fields);

            writer.CloseWrite();

            return(writer.ToArray());
        }
Ejemplo n.º 3
0
        public void GetHeaderDataToStream(Stream stream)
        {
            if (Body != null)
                Header.Length = (uint)Body.Length;

            MessageWriter writer = new MessageWriter (Header.Endianness);

            //headerWriter (writer, Header);

            writer.Write ((byte)Header.Endianness);
            writer.Write ((byte)Header.MessageType);
            writer.Write ((byte)Header.Flags);
            writer.Write (Header.MajorVersion);
            writer.Write (Header.Length);
            writer.Write (Header.Serial);
            writer.WriteHeaderFields (Header.Fields);

            writer.CloseWrite ();

            writer.ToStream (stream);
        }
Ejemplo n.º 4
0
        //public HeaderField[] Fields;
        /*
        public void SetHeaderData (byte[] data)
        {
            EndianFlag endianness = (EndianFlag)data[0];
            MessageReader reader = new MessageReader (endianness, data);

            Header = (Header)reader.ReadStruct (typeof (Header));
        }
        */
        //TypeWriter<Header> headerWriter = TypeImplementer.GetTypeWriter<Header> ();
        public byte[] GetHeaderData()
        {
            if (Body != null)
                Header.Length = (uint)Body.Length;

            MessageWriter writer = new MessageWriter (Header.Endianness);

            //writer.stream.Capacity = 512;
            //headerWriter (writer, Header);

            writer.Write ((byte)Header.Endianness);
            writer.Write ((byte)Header.MessageType);
            writer.Write ((byte)Header.Flags);
            writer.Write (Header.MajorVersion);
            writer.Write (Header.Length);
            writer.Write (Header.Serial);
            writer.WriteHeaderFields (Header.Fields);

            writer.CloseWrite ();

            return writer.ToArray ();
        }