Exemple #1
0
        public unsafe void WriteTo(ref byte *Buffer)
        {
            int a, b; bool c;

            *((uint *)Buffer) = number;
            Buffer           += TypeSizes.INT;

            *((uint *)Buffer) = MeridianDate.ToMeridianDate(time);
            Buffer           += TypeSizes.INT;

            fixed(char *pString = poster)
            {
                ushort len = (ushort)poster.Length;

                *((ushort *)Buffer) = len;
                Buffer += TypeSizes.SHORT;

                Encoding.Default.GetEncoder().Convert(pString, len, Buffer, len, true, out a, out b, out c);
                Buffer += len;
            }

            fixed(char *pString = title)
            {
                ushort len = (ushort)title.Length;

                *((ushort *)Buffer) = len;
                Buffer += TypeSizes.SHORT;

                Encoding.Default.GetEncoder().Convert(pString, len, Buffer, len, true, out a, out b, out c);
                Buffer += len;
            }
        }
Exemple #2
0
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            number  = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            time    = MeridianDate.ToDateTime(BitConverter.ToUInt32(Buffer, cursor));
            cursor += TypeSizes.INT;

            ushort strlen = BitConverter.ToUInt16(Buffer, cursor);

            cursor += TypeSizes.SHORT;

            poster  = Encoding.Default.GetString(Buffer, cursor, strlen);
            cursor += strlen;

            strlen  = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            title   = Encoding.Default.GetString(Buffer, cursor, strlen);
            cursor += strlen;

            return(cursor - StartIndex);
        }
Exemple #3
0
        public unsafe void ReadFrom(ref byte *Buffer)
        {
            number  = *((uint *)Buffer);
            Buffer += TypeSizes.INT;

            time    = MeridianDate.ToDateTime(*((uint *)Buffer));
            Buffer += TypeSizes.INT;

            ushort len = *((ushort *)Buffer);

            Buffer += TypeSizes.SHORT;

            poster  = new string((sbyte *)Buffer, 0, len);
            Buffer += len;

            len     = *((ushort *)Buffer);
            Buffer += TypeSizes.SHORT;

            title   = new string((sbyte *)Buffer, 0, len);
            Buffer += len;
        }
Exemple #4
0
        public int WriteTo(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            Array.Copy(BitConverter.GetBytes(number), 0, Buffer, cursor, TypeSizes.INT);
            cursor += TypeSizes.INT;

            Array.Copy(BitConverter.GetBytes(MeridianDate.ToMeridianDate(time)), 0, Buffer, cursor, TypeSizes.INT);
            cursor += TypeSizes.INT;

            Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(poster.Length)), 0, Buffer, cursor, TypeSizes.SHORT);
            cursor += TypeSizes.SHORT;

            Array.Copy(Encoding.Default.GetBytes(poster), 0, Buffer, cursor, poster.Length);
            cursor += poster.Length;

            Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(title.Length)), 0, Buffer, cursor, TypeSizes.SHORT);
            cursor += TypeSizes.SHORT;

            Array.Copy(Encoding.Default.GetBytes(title), 0, Buffer, cursor, title.Length);
            cursor += title.Length;

            return(cursor - StartIndex);
        }