Пример #1
0
 /// <summary>
 /// AppendFileRangeToBody() is used to append part or
 /// all of a file, to be uploaded, to the request body. A content-length
 /// request header will be automatically generated.
 /// </summary>
 /// <param name="fileRef">A <code>FileRef</code> containing the file
 /// reference.</param>
 /// <param name="startOffset">An optional starting point offset within the
 /// file.</param>
 /// <param name="length">An optional number of bytes of the file to
 /// be included. If the value is -1, then the sub-range to upload extends
 /// to the end of the file.</param>
 /// <param name="utcExpectedLastModifiedTime">An optional last
 /// modified time stamp used to validate that the file was not modified since
 /// the given time before it was uploaded. The upload will fail with an error
 /// code of <code>ErrorFilechanged</code> if the file has been modified
 /// since the given time. If utcExpectedLastModifiedTime is null, then no
 /// validation is performed.</param>
 /// <returns>true if successful, false if any of the parameters are invalid.</returns>
 public bool AppendFileRangeToBody(FileRef fileRef,
                                   long startOffset,
                                   long length,
                                   DateTime?utcExpectedLastModifiedTime = null)
 => PPBURLRequestInfo.AppendFileToBody(this,
                                       fileRef,
                                       startOffset,
                                       length,
                                       (utcExpectedLastModifiedTime.HasValue) ? PepperSharpUtils.ConvertToPepperTimestamp(utcExpectedLastModifiedTime.Value) : 0) == PPBool.True;
Пример #2
0
 /// <summary>
 /// SetProperty() sets a request property. The value of the property must be
 /// the correct type according to the property being set.
 /// </summary>
 /// <param name="property">A <code>URLRequestProperty</code> identifying the
 /// property to set.</param>
 /// <param name="value">An <code>Object</code> containing the property value.</param>
 /// <returns>true if successful, false if any of the parameters are invalid.</returns>
 public bool SetProperty(URLRequestProperty property, object value)
 => PPBURLRequestInfo.SetProperty(this, (PPURLRequestProperty)property, new Var(value)) == PPBool.True;
Пример #3
0
 /// <summary>
 /// AppendDataToBody() appends data to the request body. A content-length
 /// request header will be automatically generated.
 /// </summary>
 /// <param name="data">A byte array buffer holding the data.</param>
 /// <param name="len">The length, in bytes, of the data.</param>
 /// <returns>true if successful, false if any of the parameters are invalid.</returns>
 public bool AppendDataToBody(byte[] data, uint len)
 => PPBURLRequestInfo.AppendDataToBody(this, data, len) == PPBool.True;
Пример #4
0
 /// <summary>
 /// Constructs a URLRequestInfo object.
 /// </summary>
 /// <param name="instance">The instance with which this resource will be
 /// associated.</param>
 public URLRequestInfo(Instance instance)
 {
     handle = PPBURLRequestInfo.Create(instance);
 }