Skip to content

Options

TypNull edited this page May 8, 2024 · 1 revision

Summary

$\text{\color{orange}I\color{none}WebRequestOptions<\color{green}TCompleated\color{none}>}$ Interface

This interface is for all WebRequest instances.

Generic Parameters:

  • $\text{\color{green}TCompleated}$: Type: none
    • Represents the return type when the WebRequest<> completes successfully.

Properties:

  • IsDownload: Type: bool
    • This property gets a value indicating whether the WebRequest is downloading a large file in a separate Thread. This will be ignored if IRequestOptions.Handler is manually set.
  • Timeout: Type: Nullable<TimeSpan>
    • This property gets or sets the timeout duration for a single WebRequest attempt.
  • UserAgent: Type: string
    • This property gets or sets a string containing the value of the HTTP User-agent header.
  • Headers: Type: WebHeaderCollection
    • This property gets or sets the header (key/value) pairs to be set for the WebRequest.

$\text{\color{none}WebRequestOptions&lt;\color{green}TCompleated\color{none}&gt;}$ Record

This is an implementation of IWebRequestOptions<TCompleated> as a generic record.

Generic Parameters:

  • $\text{\color{green}TCompleated}$: Type: none
    • This is the type of return if completed.

Properties:

  • IsDownload: Type: bool
    • This property gets or sets a value indicating whether the Request<TOptions, TCompleated, TFailed> is downloading a large file in a separate Thread. This property can't be used if RequestHandler is manually set.
  • UserAgent: Type: string
    • This property gets or sets the UserAgent.
  • Headers: Type: WebHeaderCollection
    • This property gets or sets the Headers.
  • Timeout: Type: Nullable<TimeSpan>
    • This property gets or sets the Timeout.

Methods:

  • Constructor:
    • This is the main constructor for the WebRequestOptions<TCompleated> record.
  • protected Constructor:
    • This is the copy constructor for the WebRequestOptions<TCompleated> record. It takes options to copy as a parameter.

GetRequestOptions Record

This record holds the options for a GetRequest class and modifies it.

Properties:

  • DirectoryPath: Type: string
    • This property gets or sets the path to the directory where the file should be stored.
  • Filename: Type: string
    • This property gets or sets the filename of the file that will be created and written to.
  • WriteMode: Type: WriteMode
    • This property gets or sets the write mode to specify how the file should be written.
  • BufferLength: Type: int
    • This property gets or sets the length of the stream buffer. Default is 1024 (8kb).
  • MinReloadSize: Type: uint
    • This property gets or sets the minimum byte length to restart the request and download only partial. Default is 2Mb.
  • MaxBytesPerSecond: Type: Nullable<long>
    • This property gets or sets the maximum of bytes that can be downloaded by the GetRequest per second.
  • MinByte: Type: Nullable<long>
    • This property gets or sets the minimum content byte of the Request.
  • MaxByte: Type: Nullable<long>
    • This property gets or sets the maximum content byte of the Request.
  • SupportsHeadRequest: Type: bool
    • This property gets or sets a value indicating whether the server supports this feature.
  • Progress: Type: Nullable<Progress<float>>
    • This property gets or sets the progress to watch the GetRequest.
  • Range: Type: LoadRange
    • This property gets or sets the download range of the GetRequest. Start cannot be used with LoadMode.Append, it will switch to LoadMode.Create.
  • InfosFetched: Type: Nullable<Notify<GetRequest>>
    • This property gets or sets the notification when Fileinfos are fetched from the server.

Methods:

  • Constructor:
    • This initializes a new instance of the GetRequestOptions record.
  • protected Constructor:
    • Initializes a new instance of the GetRequestOptions record by copying an existing instance.

LoadRequestOptions Record

A class to hold the options for a LoadRequest object and modify it.

Properties:

  • Filename: Type: string
    • Gets or sets the filename of the file to be created and written to. Invalid filename characters are removed.
  • Range: Type: LoadRange
    • Gets the download range of the LoadRequest. Note: Start cannot be used with LoadMode.Append.
  • InfosFetched: Type: Nullable<Notify<LoadRequest>>
    • Event raised when file information is fetched from the server.
  • MinReloadSize: Type: uint
    • Gets or sets the minimum byte length to restart the request and download only partially. Default is 2Mb.
  • ExcludedExtensions: Type: string[]
    • Gets or sets the extensions that are not allowed.
  • MaxBytesPerSecond: Type: Nullable<long>
    • Gets or sets the maximum number of bytes that can be downloaded by the LoadRequest per second.
  • SupportsHeadRequest: Type: bool
    • Gets or sets a value indicating whether the server supports the HEAD request. Default is true.
  • BufferLength: Type: int
    • Gets or sets the length of the stream buffer. Default is 1024 (8kb).
  • WriteMode: Type: WriteMode
    • Gets or sets the file writing mode. Default is WriteMode.Append.
  • TempDestination: Type: string
    • Gets or sets the path to the directory where the temporary file should be stored. Default is the DestinationPath.
  • DestinationPath: Type: string
    • Gets or sets the path to the directory where the file should be stored.
  • Chunks: Type: int
    • Gets or sets the number of chunks for the LoadRequest to partially download the files. Note: Minimum value has to be 2. Only applicable if the server supports it.
  • MergeWhileProgress: Type: bool
    • Gets or sets a value indicating whether to merge the chunked files on the fly and not at the end.
  • DeleteTmpOnFailure: Type: bool
    • Gets or sets a value indicating whether to delete temporary files if the LoadRequest fails.

Methods:

  • Constructor:
    • Initializes a new instance of the LoadRequestOptions record.
  • protected Constructor:
    • Initializes a new instance of the LoadRequestOptions record by copying an existing instance.
  • ToGetRequestOptions: Type: GetRequestOptions
    • Converts a LoadRequestOptions instance to a GetRequestOptions instance.