/// <summary> /// Decodes a byte array into a matrix map /// </summary> /// <param name="buffer"></param> /// <param name="offset"></param> /// <returns></returns> internal static MatrixMap Decode(byte[] buffer, ref int offset) { var matx = new MatrixMap(); matx.Height = buffer.GetUInt32(ref offset); matx.Width = buffer.GetUInt32(ref offset); matx.Matrix = new uint[matx.Height, matx.Width]; for (int i = 0; i < matx.Height; i++) { for (int j = 0; j < matx.Width; j++) { matx.Matrix[i, j] = buffer.GetUInt32(ref offset); } } return(matx); }
/// <summary> /// Decodes a byte array into a matrix map /// </summary> /// <param name="reader"></param> internal static MatrixMap Decode(BinaryReader reader) { var matx = new MatrixMap(); matx.Height = reader.ReadUInt32(); matx.Width = reader.ReadUInt32(); matx.Matrix = new uint[matx.Height, matx.Width]; for (int i = 0; i < matx.Height; i++) { for (int j = 0; j < matx.Width; j++) { matx.Matrix[i, j] = reader.ReadUInt32(); } } return(matx); }