Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ползалка по файлу БД
- public bool Seek(long Offset, SeekOrigin Origin)
- {
- if (!IsOpen)
- {
- if (string.IsNullOrEmpty(ErrorMessage))
- {
- ErrorMessage = "Database not open";
- }
- return false;
- }
- try
- {
- SxStream.Seek(Offset, Origin);
- }
- catch (Exception ex)
- {
- ErrorMessage = ex.Message;
- return false;
- }
- return true;
- }
- public byte[] ReadBytes(int Count)
- {
- if (!IsOpen)
- {
- if (string.IsNullOrEmpty(ErrorMessage))
- {
- ErrorMessage = "Database not open";
- }
- return null;
- }
- return ReadBytes(SxStream, Count);
- }
- private byte[] ReadBytes(FileStream FST, int Count)
- {
- byte[] buf = new byte[Count];
- int readedBytes = 0;
- try
- {
- readedBytes = FST.Read(buf, 0, Count);
- }
- catch (Exception ex)
- {
- ErrorMessage = ex.Message;
- return null;
- }
- if (readedBytes != Count)
- {
- ErrorMessage = "Format error";
- return null;
- }
- return buf;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement