/// <summary> /// Start an async request from an ICsqWebRequest object /// </summary> /// /// <param name="request"> /// The URL of the remote server. /// </param> /// <param name="success"> /// A delegate to invoke upon successful completion of the request. /// </param> /// <param name="fail"> /// A delegate to invoke when a request fails. /// </param> public static void StartAsyncWebRequest(ICsqWebRequest request, Action<ICsqWebResponse> success, Action<ICsqWebResponse> fail) { var requestObj = (CsqWebRequest)request; requestObj.Async = true; var mrEvent = requestObj.GetAsync(success, fail); AsyncEvents.Add(mrEvent); }
/// <summary> /// Start an async request from an ICsqWebRequest object /// </summary> /// /// <param name="request"> /// The URL of the remote server. /// </param> /// <param name="success"> /// A delegate to invoke upon successful completion of the request. /// </param> /// <param name="fail"> /// A delegate to invoke when a request fails. /// </param> public static void StartAsyncWebRequest(ICsqWebRequest request, Action <ICsqWebResponse> success, Action <ICsqWebResponse> fail) { var requestObj = (CsqWebRequest)request; requestObj.Async = true; var mrEvent = requestObj.GetAsync(success, fail); AsyncEvents.Add(mrEvent); }
/// <summary> /// Apply these options to a web request. /// </summary> /// /// <param name="options"> /// The options. /// </param> /// <param name="request"> /// The CsqWebRequest object to apply the options to. /// </param> public static void Apply(ServerConfig options, ICsqWebRequest request) { var opts = Merge(options); request.Timeout = (int)Math.Floor(opts.Timeout.TotalMilliseconds); if (opts.UserAgent != null) { request.UserAgent = opts.UserAgent; } }
/// <summary> /// Apply these options to a web request. /// </summary> /// /// <param name="options"> /// The options. /// </param> /// <param name="request"> /// The CsqWebRequest object to apply the options to. /// </param> public static void Apply(ServerConfig options, ICsqWebRequest request) { var opts = Merge(options); if (opts.Timeout != null) { request.Timeout = (int)Math.Floor(opts.Timeout.TotalMilliseconds); } if (opts.UserAgent != null) { request.UserAgent = opts.UserAgent; } }