123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- namespace BestHTTP
- {
-
-
-
- public sealed class HTTPRange
- {
-
-
-
- public int FirstBytePos { get; private set; }
-
-
-
- public int LastBytePos { get; private set; }
-
-
-
- public int ContentLength { get; private set; }
-
-
-
- public bool IsValid { get; private set; }
- internal HTTPRange()
- {
- this.ContentLength = -1;
- this.IsValid = false;
- }
- internal HTTPRange(int contentLength)
- {
- this.ContentLength = contentLength;
- this.IsValid = false;
- }
- internal HTTPRange(int firstBytePosition, int lastBytePosition, int contentLength)
- {
- this.FirstBytePos = firstBytePosition;
- this.LastBytePos = lastBytePosition;
- this.ContentLength = contentLength;
-
- this.IsValid = this.FirstBytePos <= this.LastBytePos && this.ContentLength > this.LastBytePos;
- }
- public override string ToString()
- {
- return string.Format("{0}-{1}/{2} (valid: {3})", FirstBytePos, LastBytePos, ContentLength, IsValid);
- }
- }
- }
|