Esempio n. 1
0
 public CssReducer(IWebClientWrapper webClientWrapper, IStore store, IMinifier minifier, ISpriteManager spriteManager, ICssImageTransformer cssImageTransformer, IUriBuilder uriBuilder, IRRConfiguration configuration)
     : base(webClientWrapper, store, minifier, uriBuilder)
 {
     this.cssImageTransformer = cssImageTransformer;
     this.configuration       = configuration;
     this.spriteManager       = spriteManager;
 }
        /// <summary>
        ///   Initializes a new instance of the <see cref="SteamCommunityManager" /> class.
        /// </summary>
        /// <param name="webClient"> The web client. </param>
        /// <param name="profileParser"> The profile parser. </param>
        /// <param name="gamesParser"> The games parser. </param>
        /// <param name="achievementParser"> The achievement parser. </param>
        /// <param name="errorLogger"> The error logger. </param>
        public SteamCommunityManager(IWebClientWrapper webClient, ISteamProfileXmlParser profileParser,
                                     IGameXmlParser gamesParser, IAchievementXmlParser achievementParser,
                                     IErrorLogger errorLogger)
        {
            if (webClient == null)
            {
                throw new ArgumentNullException("webClient");
            }
            if (profileParser == null)
            {
                throw new ArgumentNullException("profileParser");
            }
            if (gamesParser == null)
            {
                throw new ArgumentNullException("gamesParser");
            }
            if (achievementParser == null)
            {
                throw new ArgumentNullException("achievementParser");
            }
            if (errorLogger == null)
            {
                throw new ArgumentNullException("errorLogger");
            }

            _webClient         = webClient;
            _achievementParser = achievementParser;
            _errorLogger       = errorLogger;
            _gamesParser       = gamesParser;
            _profileParser     = profileParser;
        }
 protected HeadResourceReducerBase(IWebClientWrapper webClientWrapper, IStore store, IMinifier minifier, IUriBuilder uriBuilder)
 {
     WebClientWrapper = webClientWrapper;
     this.uriBuilder  = uriBuilder;
     this.minifier    = minifier;
     this.store       = store;
 }
Esempio n. 4
0
 public void DownloadFile(IWebClientWrapper client, string fileLocation, string url)
 {
     if (!FileSystem.File.Exists(fileLocation))
     {
         client.DownloadFile(url, fileLocation);
     }
 }
Esempio n. 5
0
 public SpriteManager(IWebClientWrapper webClientWrapper, IRRConfiguration config, IUriBuilder uriBuilder, IStore store)
 {
     this.webClientWrapper = webClientWrapper;
     this.uriBuilder = uriBuilder;
     this.store = store;
     this.config = config;
     SpriteContainer = new SpriteContainer(webClientWrapper);
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SteamCommunityManager"/> class.
 /// </summary>
 /// <param name="webClient">The web client.</param>
 /// <param name="profileParser">The profile parser.</param>
 /// <param name="gamesParser">The games parser.</param>
 /// <param name="achievementParser">The achievement parser.</param>
 public SteamCommunityManager(IWebClientWrapper webClient, ISteamProfileXmlParser profileParser,
                              IGameXmlParser gamesParser, IAchievementXmlParser achievementParser)
 {
     _webClient         = webClient;
     _achievementParser = achievementParser;
     _gamesParser       = gamesParser;
     _profileParser     = profileParser;
 }
Esempio n. 7
0
 public Detektor(IWebClientWrapper webClient, string address)
 {
     _webClient       = webClient;
     _address         = address;
     _optionalHeaders = new Dictionary <string, string> {
         { "Content-Type", "application/xml" }
     };
 }
Esempio n. 8
0
 public void DisposeClient()
 {
     if (Client != null)
     {
         Client.Dispose();
         Client = null;
     }
 }
Esempio n. 9
0
 public Reducer(IWebClientWrapper webClientWrapper, IStore store, IMinifier minifier, ISpriteManager spriteManager, ICssImageTransformer cssImageTransformer, IUriBuilder uriBuilder)
 {
     this.webClientWrapper = webClientWrapper;
     this.cssImageTransformer = cssImageTransformer;
     this.uriBuilder = uriBuilder;
     this.spriteManager = spriteManager;
     this.minifier = minifier;
     this.store = store;
 }
Esempio n. 10
0
 public SpriteManager(IWebClientWrapper webClientWrapper, IRRConfiguration config, IUriBuilder uriBuilder, IStore store, IPngOptimizer pngOptimizer)
 {
     this.webClientWrapper = webClientWrapper;
     this.uriBuilder       = uriBuilder;
     this.store            = store;
     this.pngOptimizer     = pngOptimizer;
     this.config           = config;
     SpriteContainer       = new SpriteContainer(webClientWrapper, config);
 }
Esempio n. 11
0
 public RssFeedRepository(
     IWebClientWrapper webClient,
     IXDocumentParseWrapper xDocument,
     IRssReaderModelFactory <BaseRssFeed> rssFeedModelFactory,
     IRssReaderFeed feedDb)
 {
     this.webClient           = webClient;
     this.xDocument           = xDocument;
     this.rssFeedModelFactory = rssFeedModelFactory;
     this.feedDb = feedDb;
 }
Esempio n. 12
0
 public SpriteManagerToTest(IWebClientWrapper webClientWrapper, IRRConfiguration config, IUriBuilder uriBuilder, IStore store, IPngOptimizer pngOptimizer) : base(webClientWrapper, config, uriBuilder, store, pngOptimizer)
 {
     MockSpriteContainer = new Mock <ISpriteContainer>();
     MockSpriteContainer.Setup(x => x.GetEnumerator()).Returns(new List <SpritedImage>().GetEnumerator());
     MockSpriteContainer.Setup(x => x.Width).Returns(1);
     MockSpriteContainer.Setup(x => x.Height).Returns(1);
     MockSpriteContainer.Setup(x => x.AddImage(It.IsAny <BackgroundImageClass>())).
     Returns((BackgroundImageClass c) => new SpritedImage(1, c, null));
     base.SpriteContainer = MockSpriteContainer.Object;
     SpritedCssKey        = Guid.NewGuid();
 }
        public FacebookProvider(string clientId, string clientSecret, Uri redirectUri, IWebClientWrapper webClient)
        {
            Condition.Requires(clientId).IsNotNullOrEmpty();
            Condition.Requires(clientSecret).IsNotNullOrEmpty();
            Condition.Requires(redirectUri).IsNotNull();
            Condition.Requires(webClient).IsNotNull();

            ClientId     = clientId;
            ClientSecret = clientSecret;
            RedirectUri  = redirectUri;
            WebClient    = webClient;
        }
        public FacebookProvider(string clientId, string clientSecret, Uri redirectUri, IWebClientWrapper webClient)
        {
            Condition.Requires(clientId).IsNotNullOrEmpty();
            Condition.Requires(clientSecret).IsNotNullOrEmpty();
            Condition.Requires(redirectUri).IsNotNull();
            Condition.Requires(webClient).IsNotNull();

            ClientId = clientId;
            ClientSecret = clientSecret;
            RedirectUri = redirectUri;
            WebClient = webClient;
        }
 public PageGetter(
     IWebClientWrapper client,
     IHtmlDocumentWrapper document,
     IWebsite website,
     ILog log)
 {
     _client   = client;
     _document = document;
     _website  = website;
     _log      = log;
     _urls     = new List <string>();
 }
 public PageChecker(
     ILinkDictionary dictionary,
     IWebClientWrapper client,
     IHtmlDocumentWrapper document,
     ILog logger,
     IWebsite website)
 {
     _dictionary = dictionary;
     _client     = client;
     _document   = document;
     _logger     = logger;
     _website    = website;
 }
Esempio n. 17
0
        public async Task <ContractExecutionResult> DeleteImportedFileV6(
            [FromQuery] Guid projectUid,
            [FromQuery] Guid?importedFileUid, // for 3dpm imported files
            [FromServices] IPegasusClient pegasusClient,
            [FromServices] IWebClientWrapper webClient)
        {
            Logger.LogInformation($"{nameof(DeleteImportedFileV6)}: projectUid {projectUid} importedFileUid: {importedFileUid}");

            await ValidateProjectId(projectUid.ToString());

            var importedFiles = await ImportedFileRequestDatabaseHelper.GetImportedFiles(projectUid.ToString(), Logger, ProjectRepo).ConfigureAwait(false);

            ImportedFile existing = null;

            if (importedFiles.Count > 0)
            {
                existing = importedFiles.FirstOrDefault(f => f.ImportedFileUid == importedFileUid.ToString());
            }

            if (existing == null)
            {
                ServiceExceptionHandler.ThrowServiceException(HttpStatusCode.BadRequest, 56);
                return(new ContractExecutionResult(ContractExecutionStatesEnum.InternalProcessingError, "shouldn't get here")); // to keep compiler happy
            }

            var deleteImportedFile = new DeleteImportedFile(
                projectUid, existing.ImportedFileType, JsonConvert.DeserializeObject <FileDescriptor>(existing.FileDescriptor),
                Guid.Parse(existing.ImportedFileUid), existing.ImportedFileId, existing.LegacyImportedFileId,
                DataOceanRootFolderId, existing.SurveyedUtc);

            var result = await WithServiceExceptionTryExecuteAsync(() =>
                                                                   RequestExecutorContainerFactory
                                                                   .Build <DeleteImportedFileExecutor>(
                                                                       LoggerFactory, ConfigStore, ServiceExceptionHandler, CustomerUid, UserId, UserEmailAddress, customHeaders,
                                                                       persistantTransferProxyFactory : persistantTransferProxyFactory, filterServiceProxy : filterServiceProxy, tRexImportFileProxy : tRexImportFileProxy,
                                                                       projectRepo : ProjectRepo, dataOceanClient : DataOceanClient, authn : Authorization, pegasusClient : pegasusClient, cwsProjectClient : CwsProjectClient)
                                                                   .ProcessAsync(deleteImportedFile)
                                                                   );

            await NotificationHubClient.Notify(new ProjectChangedNotification(projectUid));

            Logger.LogInformation(
                $"{nameof(DeleteImportedFileV6)}: Completed successfully. projectUid {projectUid} importedFileUid: {importedFileUid}");
            return(result);
        }
Esempio n. 18
0
        public Update CheckForUpdates(IWebClientWrapper client)
        {
            string url = BrandingControl.getString("BRANDING_updaterURL");

            if (String.IsNullOrEmpty(url))
            {
                url = "https://pvupdates.vmd.citrix.com/updates.v2.tsv";
            }

            string identify = (string)getreg.GetReg("HKEY_LOCAL_MACHINE\\Software\\Citrix\\XenTools\\AutoUpdate", "Identify", "NO");

            if (identify.Equals("YES"))
            {
                url += "?id=" + uuid.Value.Substring(4);
            }

            if (update_url.Exists)
            {
                url = update_url.Value;
            }

            url = (string)getreg.GetReg("HKEY_LOCAL_MACHINE\\SOFTWARE\\Citrix\\XenTools", "update_url", url);

            if (String.IsNullOrEmpty(url))
            {
                session.Log("Update URL is Null or Empty");
                throw new ArgumentNullException("URL is empty");
            }
            session.Log("Checking URL: " + url + " for updates after: " + version.ToString());

            string contents = null;

            try
            {
                string userAgent = (string)getreg.GetReg("HKEY_LOCAL_MACHINE\\SOFTWARE\\Citrix\\XenTools\\AutoUpdate", "UserAgent", BrandingControl.getString("BRANDING_userAgent"));
                session.Log("This is my user agent : " + userAgent);
                client.AddHeader("User-Agent", userAgent);
                contents = client.DownloadString(url);
            }
            catch (Exception e)
            {
                session.Log("Download failed " + e.Message);
                throw;
            }
            if (String.IsNullOrEmpty(contents))
            {
                return(null);
            }

            string        arch    = (Win32Impl.Is64BitOS() && (!Win32Impl.IsWOW64())) ? "x64" : "x86";
            List <Update> updates = new List <Update>();

            foreach (string line in contents.Split(new char[] { '\n' }))
            {
                if (String.IsNullOrEmpty(line))
                {
                    continue;
                }
                try
                {
                    Update update = new Update(line);
                    session.Log("Update Entry " + update.ToString());
                    if (update.Arch != arch)
                    {
                        continue;
                    }
                    if (update.Version.CompareTo(version) <= 0)
                    {
                        continue;
                    }

                    updates.Add(update);
                }
                catch (Exception e)
                {
                    session.Log("Exception: " + e.Message);
                }
            }

            updates.Reverse();
            if (updates.Count > 0)
            {
                return(updates[0]);
            }

            session.Log("No updates found");
            return(null);
        }
Esempio n. 19
0
        public void ReportingServicesReportExecutorTest_SetUp()
        {
            _webClientWrapper = Substitute.For <IWebClientWrapper>();

            _reportExecutor = new ReportingServicesReportExecutor(_webClientWrapper);
        }
Esempio n. 20
0
 public SpriteContainer(IWebClientWrapper webClientWrapper, IRRConfiguration rrConfiguration)
 {
     this.webClientWrapper = webClientWrapper;
     this.rrConfiguration = rrConfiguration;
 }
Esempio n. 21
0
 public InventoryService(IWebClientWrapper client)
 {
     _client = client;
 }
Esempio n. 22
0
 public OpenWeatherService(IWebClientWrapper webClientWrapper)
 {
     _webClientWrapper = webClientWrapper;
 }
 public ReportingServicesReportExecutor(IWebClientWrapper webClientWrapper)
 {
     _webClientWrapper = webClientWrapper;
 }
Esempio n. 24
0
 public SpriteContainer(IWebClientWrapper webClientWrapper, IRRConfiguration rrConfiguration)
 {
     this.webClientWrapper = webClientWrapper;
     this.rrConfiguration  = rrConfiguration;
 }
Esempio n. 25
0
 public HtmlLoader(IHtmlWrapperFactory htmlFactory, IWebClientWrapper webClient)
 {
     _htmlFactory = htmlFactory;
     _webClient   = webClient;
 }
Esempio n. 26
0
 public CnbExchangeRatesSource(IWebClientWrapper webClientWrapper, Uri cnbRatesUri)
 {
     _webClientWrapper = webClientWrapper;
     _cnbRatesUri      = cnbRatesUri;
 }
 public TrainingSessionsService(IWebClientWrapper webClient)
 {
     _webClient = webClient;
 }
Esempio n. 28
0
 public InventoryService(IWebClientWrapper webClientWrapper)
 {
     _webClientWrapper = webClientWrapper;
 }
Esempio n. 29
0
 public HttpImageLoader(IWebClientWrapper webClientWrapper)
 {
     WebClientWrapper = webClientWrapper;
 }
 public JsonWebServiceClassProvider(IWebClientWrapper webClientWrapper)
 {
     _webClientWrapper = webClientWrapper;
 }
Esempio n. 31
0
 public FakeSpriteContainer(IWebClientWrapper webClientWrapper, IRRConfiguration config) : base(webClientWrapper, config)
 {
 }
Esempio n. 32
0
 public WebClient(params ISite[] sites)
     : this()
 {
     Sites.AddRange(sites.CheckForNull());
     _webClientWrapper = new WebClientWrapper();
 }
Esempio n. 33
0
 public HttpImageLoader(IWebClientWrapper webClientWrapper)
 {
     WebClientWrapper = webClientWrapper;
 }
Esempio n. 34
0
 public WebClient(IWebClientWrapper webClientWrapper, params ISite[] sites)
     : this(sites)
 {
     _webClientWrapper = webClientWrapper.CheckForNull();
 }
Esempio n. 35
0
 public SpriteContainer(IWebClientWrapper webClientWrapper)
 {
     this.webClientWrapper = webClientWrapper;
 }
 public JavaScriptReducer(IWebClientWrapper webClientWrapper, IStore store, IMinifier minifier, IUriBuilder uriBuilder, IRRConfiguration config, IResponseDecoder responseDecoder) : base(webClientWrapper, store, minifier, uriBuilder)
 {
     this.config          = config;
     this.responseDecoder = responseDecoder;
 }