public PCXRWriterBuffered(string fullName, PCXRHeader header) { _FullName = fullName; _NumberOfPoints = header.NumberOfPoints; _Header = header; if (File.Exists(fullName)) { File.Delete(fullName); } _NumberOfPointsToBuffer = (int)_NumberOfPoints - 1; int bufferSize = _NumberOfPointsToBuffer * _Header.Stride * sizeof(float); _Buffer = new byte[bufferSize]; _BufferSpill = _NumberOfPoints % (uint)_NumberOfPointsToBuffer; if (_NumberOfPoints <= _NumberOfPointsToBuffer) { _UseBuffer = false; } _StreamWriter = File.Create(fullName); WriteHeader(); }
public PCXRWriter(string fullName, PCXRHeader header) { _FullName = fullName; _Header = header; _Writer = new BinaryWriter(File.Open(_FullName, FileMode.Create)); WriteHeader(); }
public PCXRReaderIO(string fullName, PCXRHeader header) { if (File.Exists(fullName)) { _FilePath = fullName; _NumberOfPointsToBuffer = header.NumberOfPoints; _Header = header; _BytesToReadIntoPointsBuffer = (int)(_Header.Stride * sizeof(float) * _NumberOfPointsToBuffer); _ReadBuffer = new byte[_BytesToReadIntoPointsBuffer + _Header.GetHeaderSizeInBytes()]; ReadFile(); } else { throw new FileNotFoundException(fullName + " not found"); } }
public PCXRReader(string fullName, uint numberOfPointsToBuffer) { if (File.Exists(fullName)) { _FilePath = fullName; _NumberOfPointsToBuffer = numberOfPointsToBuffer; _Header = new PCXRHeader(); _Header.ReadHeader(fullName); _BytesToReadIntoBuffer = (int)(_Header.Stride * sizeof(float) * _NumberOfPointsToBuffer); _FileStream = File.OpenRead(_FilePath); _Header.OffsetToPointData = 92; _FileStream.Seek(_Header.OffsetToPointData, SeekOrigin.Begin); _Buffer = new byte[_BytesToReadIntoBuffer]; FillBuffer(); } else { throw new FileNotFoundException(fullName + " not found"); } }