Beispiel #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;
            }
        }
Beispiel #2
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);
        }