Example #1
0
        public override long Seek(long offset, SeekOrigin origin)
        {
            _options.Dispose();
            _result.Dispose();

            switch (origin)
            {
            case SeekOrigin.End:
                Position = Length + offset;
                break;

            case SeekOrigin.Begin:
                Position = offset;
                break;

            case SeekOrigin.Current:
                Position += offset;
                break;

            default:
                throw new NotSupportedException();
            }

            _options = new SWIG.UplinkDownloadOptions {
                length = _length, offset = Position
            };
            _result = SWIG.storj_uplink.uplink_download_object(_bucket._projectRef, _bucket.Name, _objectName, _options);

            return(Position);
        }
Example #2
0
 internal SWIG.UplinkDownloadOptions ToSWIG()
 {
     SWIG.UplinkDownloadOptions options = new SWIG.UplinkDownloadOptions();
     options.length = Length;
     options.offset = Offset;
     
     return options;
 }
Example #3
0
 public DownloadStream(Bucket bucket, int totalBytes, string objectName)
 {
     _length     = totalBytes;
     _bucket     = bucket;
     _objectName = objectName;
     _options    = new SWIG.UplinkDownloadOptions {
         length = totalBytes, offset = Position
     };
     _result = SWIG.storj_uplink.uplink_download_object(_bucket._projectRef, _bucket.Name, _objectName, _options);
 }
Example #4
0
 protected override void Dispose(bool disposing)
 {
     if (_options != null)
     {
         _options.Dispose();
         _options = null;
     }
     if (_result != null)
     {
         _result.Dispose();
         _result = null;
     }
 }