コード例 #1
0
        public ReadHandle ReadAsync()
        {
            if (EndOfStream)
            {
                return(new ReadHandle());              // returns void handle
            }
            // check file termination
            _info.Target->dataLength = Math.Min(_info.Target->blockSize, (int)(_info.Target->fileSize - ((long)_info.Target->blockSize) * _info.Target->blockPos));

            _readCommands[0] = new ReadCommand
            {
                Offset = _info.Target->blockPos * _info.Target->blockSize,
                Size   = _info.Target->dataLength,
                Buffer = _byteBuffer.GetUnsafePtr(),
            };

            ReadHandle read_handle = AsyncReadManager.Read(_path.Target, (ReadCommand *)(_readCommands.GetUnsafePtr()), 1);

            if (!read_handle.IsValid())
            {
                throw new InvalidOperationException("failure to open file.");
            }

            _info.Target->blockPos++;
            return(read_handle);
        }
 public void Execute()
 {
     Memory.Unmanaged.Free(ptr, allocator);
     if (readHandle.IsValid())
     {
         readHandle.Dispose();
     }
 }
コード例 #3
0
 public void Execute()
 {
     UnsafeUtility.Free(ptr, allocator);
     if (readHandle.IsValid())
     {
         readHandle.Dispose();
     }
 }
コード例 #4
0
 public void Dispose()
 {
     if (!m_Handle.IsValid())
     {
         return;
     }
     m_Handle.Dispose();
 }
コード例 #5
0
 public unsafe void Update()
 {
     if (!readHandle.IsValid() || readHandle.Status == ReadStatus.InProgress)
     {
         return;
     }
     readHandle.Dispose();
     UnsafeUtility.Free(cmd[0].Buffer, Allocator.Persistent);
     cmd.Dispose();
 }