예제 #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="UploadToCoderr" /> class.
        /// </summary>
        /// <param name="coderrServerAddress">
        ///     Uri to the root of the codeRR web. Example.
        ///     <code>http://yourWebServer/coderr/</code>
        /// </param>
        /// <param name="apiKey">The API key.</param>
        /// <param name="sharedSecret">The shared secret.</param>
        /// <exception cref="System.ArgumentNullException">apiKey</exception>
        public UploadToCoderr(Uri coderrServerAddress, string apiKey, string sharedSecret)
        {
            if (string.IsNullOrEmpty(apiKey))
            {
                throw new ArgumentNullException("apiKey");
            }
            if (string.IsNullOrEmpty(sharedSecret))
            {
                throw new ArgumentNullException("sharedSecret");
            }

            if (coderrServerAddress.AbsolutePath.Contains("/receiver/"))
            {
                throw new ArgumentException(
                          "The codeRR URI should not contain the reporting area '/receiver/', but should point at the site root.");
            }
            if (!coderrServerAddress.AbsolutePath.EndsWith("/"))
            {
                coderrServerAddress = new Uri(coderrServerAddress + "/");
            }

            _reportUri     = new Uri(coderrServerAddress, "receiver/report/" + apiKey + "/");
            _feedbackUri   = new Uri(coderrServerAddress, "receiver/report/" + apiKey + "/feedback/");
            ApiKey         = apiKey;
            SharedSecret   = sharedSecret;
            _feedbackQueue = new UploadQueue <FeedbackDTO>(OnInvokeBackgroundUpload);
            _feedbackQueue.UploadFailed += OnUploadFailed;
            _reportQueue = new UploadQueue <ErrorReportDTO>(OnInvokeBackgroundUpload);
            _reportQueue.UploadFailed += OnUploadFailed;

            _throwExceptionsAccessor = () => Err.Configuration.ThrowExceptions;
            _queueReportsAccessor    = () => Err.Configuration.QueueReports;
        }
예제 #2
0
 /// <summary>
 ///     Creates a new instance of <see cref="UploadDispatcher" />.
 /// </summary>
 /// <param name="configuration">Used to check at runtime of queuing is enabled or not.</param>
 public UploadDispatcher(CoderrConfiguration configuration)
 {
     _configuration = configuration;
     _reportQueue   = new UploadQueue <ErrorReportDTO>(UploadReportNow);
     _feedbackQueue = new UploadQueue <FeedbackDTO>(UploadFeedbackNow);
 }