Example #1
0
 /// <summary>
 /// Writes an 18-byte <see cref="ShortPlane"/> to the data stream.
 /// </summary>
 /// <param name="binaryWriter">The current <see cref="BinaryWriter"/> object.</param>
 /// <param name="shortPlane">The plane to write.</param>
 public static void WriteShortPlane(this BinaryWriter binaryWriter, ShortPlane shortPlane)
 {
     for (int y = 0; y < 3; ++y)
     {
         for (int x = 0; x < 3; ++x)
         {
             binaryWriter.Write(shortPlane.Coordinates[y][x]);
         }
     }
 }
Example #2
0
        /// <summary>
        /// Reads an 18-byte <see cref="ShortPlane"/> from the data stream.
        /// </summary>
        /// <returns>The plane.</returns>
        /// <param name="binaryReader">The current <see cref="BinaryReader"/></param>
        public static ShortPlane ReadShortPlane(this BinaryReader binaryReader)
        {
            ShortPlane shortPlane = new ShortPlane();

            for (int y = 0; y < 3; ++y)
            {
                List <short> coordinateRow = new List <short>();
                for (int x = 0; x < 3; ++x)
                {
                    coordinateRow.Add(binaryReader.ReadInt16());
                }
                shortPlane.Coordinates.Add(coordinateRow);
            }

            return(shortPlane);
        }