public void Write(Stream outputStream) { if (Data == null) { return; } byte[] data = Data; if (GameVersion == GameVersion.Bloodborne) { DxgiFormat dxgiFormat = (DxgiFormat)DxgiFormat; DdsPixelFormat pixelFormat = DdsPixelFormat.DxgiToDdsPixelFormat(dxgiFormat); DdsFile ddsFile = new DdsFile { Header = new DdsFileHeader { Flags = DdsFileHeaderFlags.Texture | (MipMapCount > 1 ? DdsFileHeaderFlags.MipMap : 0), Height = Height, Width = Width, Depth = 0, PitchOrLinearSize = Data.Length, MipMapCount = MipMapCount, PixelFormat = pixelFormat, Caps = DdsSurfaceFlags.Texture | (MipMapCount > 1 ? DdsSurfaceFlags.MipMap : 0) }, HeaderDx10 = pixelFormat.FourCc != DdsPixelFormat.Dx10FourCc ? null : new DdsFileHeaderDx10 { Format = dxgiFormat, ResourceDimension = D3D10ResourceDimension.Texture2D, MiscFlag = 0, ArraySize = 1, MiscFlags2 = 0 }, Data = DdsFile.ConvertData(data, Height, Width, dxgiFormat) }; ddsFile.Write(outputStream); } else { outputStream.Write(data, 0, data.Length); } }