public static SHBD Load(int xSize, int ySize, Bitmap bitmap) { SHBD shbd = new SHBD { XSize = xSize / 8, YSize = ySize, Bitmap = bitmap }; return(shbd); }
public static SHBD Load(byte[] data, bool readHeader, int xSize, int ySize) { var shbd = new SHBD(); using (var memoryStream = new MemoryStream(data)) using (var binaryReader = new BinaryReader(memoryStream)) { if (readHeader) { shbd.XSize = binaryReader.ReadInt32(); shbd.YSize = binaryReader.ReadInt32(); } else { shbd.XSize = xSize; shbd.YSize = ySize; } shbd.Data = binaryReader.ReadBytes(shbd.XSize * shbd.YSize); } return(shbd); }