コード例 #1
0
        /// <exception cref="ArgumentNullException">
        /// <paramref name="serverImagesPath"/> or
        /// <paramref name="archiveDirectoryPath"/> or
        /// <paramref name="contextFactory"/> or
        /// <paramref name="dateTimeProxy"/> or
        /// <paramref name="activatorProxy"/> is <see langword="null" />.</exception>
        internal UpdateService(string serverImagesPath, string archiveDirectoryPath, IDbContextFactory <UpdateDbContext> contextFactory,
                               IDateTimeProxy dateTimeProxy, IActivatorProxy activatorProxy)
        {
            if (serverImagesPath == null)
            {
                throw new ArgumentNullException("serverImagesPath");
            }

            if (archiveDirectoryPath == null)
            {
                throw new ArgumentNullException("archiveDirectoryPath");
            }

            if (contextFactory == null)
            {
                throw new ArgumentNullException("contextFactory");
            }

            if (dateTimeProxy == null)
            {
                throw new ArgumentNullException("dateTimeProxy");
            }

            if (activatorProxy == null)
            {
                throw new ArgumentNullException("activatorProxy");
            }

            _serverImagesPath     = serverImagesPath;
            _archiveDirectoryPath = archiveDirectoryPath;
            _contextFactory       = contextFactory;
            _dateTimeProxy        = dateTimeProxy;
            _activatorProxy       = activatorProxy;
        }
コード例 #2
0
        internal HttpDownloadManager(IActivatorProxy activatorProxy)
        {
            if (activatorProxy == null)
            {
                throw new ArgumentNullException("activatorProxy");
            }

            var requestDelaySetting = ConfigurationManager.AppSettings["TM.HttpDownloadManager.RequestDelay"];

            if (requestDelaySetting == null)
            {
                _requestDelay = DefaultRequestDelay;
            }

            _requestDelay = Convert.ToInt32(requestDelaySetting);


            var fileRequestDelaySetting = ConfigurationManager.AppSettings["TM.HttpDownloadManager.FileRequestDelay"];

            if (fileRequestDelaySetting == null)
            {
                _fileRequestDelay = DefaultFileRequestDelay;
            }

            _fileRequestDelay = Convert.ToInt32(fileRequestDelaySetting);

            var retryAttemptsSetting = ConfigurationManager.AppSettings["TM.HttpDownloadManager.RetryAttempts"];

            if (retryAttemptsSetting == null)
            {
                _retryAttempts = DefaultRetryAttempts;
            }

            _retryAttempts = Convert.ToInt32(retryAttemptsSetting);

            var proxyTypeSetting = ConfigurationManager.AppSettings["TM.HttpDownloadManager.ProxyType"];

            if (proxyTypeSetting == null)
            {
                _proxy = DefaultProxy;
            }
            else
            {
                _proxy = activatorProxy.CreateInstance <ProxyBase>(proxyTypeSetting);
            }
        }
コード例 #3
0
      internal HttpDownloadManager(IActivatorProxy activatorProxy)
      {
         if (activatorProxy == null)
            throw new ArgumentNullException("activatorProxy");

         var requestDelaySetting = ConfigurationManager.AppSettings["TM.HttpDownloadManager.RequestDelay"];
         if (requestDelaySetting == null)
         {
            _requestDelay = DefaultRequestDelay;
         }

         _requestDelay = Convert.ToInt32(requestDelaySetting);


         var fileRequestDelaySetting = ConfigurationManager.AppSettings["TM.HttpDownloadManager.FileRequestDelay"];
         if (fileRequestDelaySetting == null)
         {
            _fileRequestDelay = DefaultFileRequestDelay;
         }

         _fileRequestDelay = Convert.ToInt32(fileRequestDelaySetting);

         var retryAttemptsSetting = ConfigurationManager.AppSettings["TM.HttpDownloadManager.RetryAttempts"];
         if (retryAttemptsSetting == null)
         {
            _retryAttempts = DefaultRetryAttempts;
         }

         _retryAttempts = Convert.ToInt32(retryAttemptsSetting);

         var proxyTypeSetting = ConfigurationManager.AppSettings["TM.HttpDownloadManager.ProxyType"];
         if (proxyTypeSetting == null)
         {
            _proxy = DefaultProxy;
         } else
         {
            _proxy = activatorProxy.CreateInstance<ProxyBase>(proxyTypeSetting);
         }

      }
コード例 #4
0
      /// <exception cref="ArgumentNullException">
      /// <paramref name="serverImagesPath"/> or
      /// <paramref name="archiveDirectoryPath"/> or
      /// <paramref name="contextFactory"/> or
      /// <paramref name="dateTimeProxy"/> or
      /// <paramref name="activatorProxy"/> is <see langword="null" />.</exception>
      internal UpdateService(string serverImagesPath, string archiveDirectoryPath, IDbContextFactory<UpdateDbContext> contextFactory,
         IDateTimeProxy dateTimeProxy, IActivatorProxy activatorProxy)
      {
         if (serverImagesPath == null)
            throw new ArgumentNullException("serverImagesPath");

         if (archiveDirectoryPath == null)
            throw new ArgumentNullException("archiveDirectoryPath");

         if (contextFactory == null)
            throw new ArgumentNullException("contextFactory");

         if (dateTimeProxy == null)
            throw new ArgumentNullException("dateTimeProxy");

         if (activatorProxy == null)
            throw new ArgumentNullException("activatorProxy");

         _serverImagesPath = serverImagesPath;
         _archiveDirectoryPath = archiveDirectoryPath;
         _contextFactory = contextFactory;
         _dateTimeProxy = dateTimeProxy;
         _activatorProxy = activatorProxy;
      }