예제 #1
0
        /// <summary>
        /// Deserializes this structure from binary data.
        /// </summary>
        /// <param name="reader">The <see cref="BinaryReader"/> to read the data from.</param>
        /// <param name="font">Tiny Font containing this appendix.</param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="font"/> is null.</exception>
        public override void ReadFrom(BinaryReader reader, TinyFont font)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (font == null)
            {
                throw new ArgumentNullException("font");
            }

            _mask     = reader.ReadUInt16();
            _reserved = reader.ReadUInt16();

            _fontPlanes.Clear();

            ushort positionMask = _mask;

            while (positionMask != 0)
            {
                if ((positionMask & 1) != 0)
                {
                    FontPlane plane = new FontPlane();
                    plane.ReadFrom(reader, font);

                    _fontPlanes.Add(plane);
                }

                positionMask >>= 1;
            }
        }
예제 #2
0
        /// <summary>
        /// Deserializes this structure from binary data.
        /// </summary>
        /// <param name="reader">The <see cref="BinaryReader"/> to read the data from.</param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        public void ReadFrom(BinaryReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException();
            }

            _baseFontPlane.ReadFrom(reader, this);

            ReadAppendicesFrom(reader);
        }