public DocumentFormatReader(Uri address, OpenOptions options = null)
        {
            _request = (HttpWebRequest)WebRequest.Create(address);
            if (options != null)
            {
                if (options.SkipContent)
                {
                    _request.Method = WebRequestMethods.Http.Head;
                }

                if (options.RangeFrom.HasValue)
                {
                    if (options.RangeTo.HasValue)
                    {
                        _request.AddRange(options.RangeFrom.Value, options.RangeTo.Value);
                    }
                    else
                    {
                        _request.AddRange(options.RangeFrom.Value);
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Open a file on DocumentStore
        /// </summary>
        /// <param name="documentHandle">Document handle</param>
        /// <param name="format">Document format</param>
        /// <param name="options">Open options</param>
        /// <returns>A document format reader</returns>
        public DocumentFormatReader OpenRead(DocumentHandle documentHandle, DocumentFormat format = null, OpenOptions options = null)
        {
            format = format ?? OriginalFormat;
            var relativeUri = Tenant + "/documents/" + documentHandle + "/" + format;

            if (options != null && !string.IsNullOrWhiteSpace(options.FileName))
            {
                relativeUri = relativeUri + "/" + options.FileName;
            }

            var endPoint = new Uri(_documentStoreUri, relativeUri);

            return(new DocumentFormatReader(endPoint, options));
        }