Exemplo n.º 1
0
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="userAgentStringsPath">User agent file path</param>
        /// <param name="crawlerOnlyUserAgentStringsPath">User agent with crawlers only file path</param>
        /// <param name="fileProvider">File provider</param>
        public BrowscapXmlHelper(string userAgentStringsPath, string crawlerOnlyUserAgentStringsPath, IGSFileProvider fileProvider)
        {
            this._crawlerUserAgentsRegexp = new List <string>();
            this._fileProvider            = fileProvider;

            Initialize(userAgentStringsPath, crawlerOnlyUserAgentStringsPath);
        }
Exemplo n.º 2
0
 public CommonController(ICommonModelFactory commonModelFactory,
                         ICustomerService customerService,
                         IDateTimeHelper dateTimeHelper,
                         ILanguageService languageService,
                         ILocalizationService localizationService,
                         IMaintenanceService maintenanceService,
                         IGSFileProvider fileProvider,
                         IPermissionService permissionService,
                         IStaticCacheManager cacheManager,
                         IUrlRecordService urlRecordService,
                         IWebHelper webHelper,
                         IWorkContext workContext)
 {
     this._commonModelFactory  = commonModelFactory;
     this._customerService     = customerService;
     this._dateTimeHelper      = dateTimeHelper;
     this._languageService     = languageService;
     this._localizationService = localizationService;
     this._maintenanceService  = maintenanceService;
     this._fileProvider        = fileProvider;
     this._permissionService   = permissionService;
     this._cacheManager        = cacheManager;
     this._urlRecordService    = urlRecordService;
     this._webHelper           = webHelper;
     this._workContext         = workContext;
 }
Exemplo n.º 3
0
 public MaintenanceService(IDataProvider dataProvider,
                           IDbContext dbContext,
                           IGSFileProvider fileProvider)
 {
     this._dataProvider = dataProvider;
     this._dbContext    = dbContext;
     this._fileProvider = fileProvider;
 }
Exemplo n.º 4
0
 public WebHelper(HostingConfig hostingConfig,
                  IHttpContextAccessor httpContextAccessor,
                  IGSFileProvider fileProvider)
 {
     this._hostingConfig       = hostingConfig;
     this._httpContextAccessor = httpContextAccessor;
     this._fileProvider        = fileProvider;
 }
Exemplo n.º 5
0
 public UserAgentHelper(IHttpContextAccessor httpContextAccessor,
                        IGSFileProvider fileProvider,
                        GSConfig nopConfig)
 {
     this._httpContextAccessor = httpContextAccessor;
     this._fileProvider        = fileProvider;
     this._nopConfig           = nopConfig;
 }
Exemplo n.º 6
0
 public PictureController(IDownloadService downloadService,
                          IGSFileProvider fileProvider,
                          IPictureService pictureService)
 {
     this._downloadService = downloadService;
     this._fileProvider    = fileProvider;
     this._pictureService  = pictureService;
 }
Exemplo n.º 7
0
 public RoxyFilemanController(IHostingEnvironment hostingEnvironment,
                              IGSFileProvider fileProvider,
                              IPermissionService permissionService,
                              IWorkContext workContext)
 {
     this._hostingEnvironment = hostingEnvironment;
     this._fileProvider       = fileProvider;
     this._permissionService  = permissionService;
     this._workContext        = workContext;
 }
Exemplo n.º 8
0
 public CommonModelFactory(AdminAreaSettings adminAreaSettings,
                           CatalogSettings catalogSettings,
                           CurrencySettings currencySettings,
                           IActionContextAccessor actionContextAccessor,
                           ICurrencyService currencyService,
                           ICustomerService customerService,
                           IDateTimeHelper dateTimeHelper,
                           IExternalAuthenticationService externalAuthenticationService,
                           IGSFileProvider fileProvider,
                           IHttpContextAccessor httpContextAccessor,
                           ILanguageService languageService,
                           ILocalizationService localizationService,
                           IMaintenanceService maintenanceService,
                           IMeasureService measureService,
                           IPluginFinder pluginFinder,
                           ISearchTermService searchTermService,
                           IStoreContext storeContext,
                           IStoreService storeService,
                           IUrlHelperFactory urlHelperFactory,
                           IUrlRecordService urlRecordService,
                           IWebHelper webHelper,
                           IWidgetService widgetService,
                           IWorkContext workContext,
                           MeasureSettings measureSettings,
                           TaxSettings taxSettings)
 {
     this._adminAreaSettings             = adminAreaSettings;
     this._catalogSettings               = catalogSettings;
     this._currencySettings              = currencySettings;
     this._actionContextAccessor         = actionContextAccessor;
     this._currencyService               = currencyService;
     this._customerService               = customerService;
     this._dateTimeHelper                = dateTimeHelper;
     this._externalAuthenticationService = externalAuthenticationService;
     this._fileProvider        = fileProvider;
     this._httpContextAccessor = httpContextAccessor;
     this._languageService     = languageService;
     this._localizationService = localizationService;
     this._maintenanceService  = maintenanceService;
     this._measureService      = measureService;
     this._pluginFinder        = pluginFinder;
     this._searchTermService   = searchTermService;
     this._storeContext        = storeContext;
     this._storeService        = storeService;
     this._urlHelperFactory    = urlHelperFactory;
     this._urlRecordService    = urlRecordService;
     this._webHelper           = webHelper;
     this._widgetService       = widgetService;
     this._workContext         = workContext;
     this._measureSettings     = measureSettings;
     this._taxSettings         = taxSettings;
 }
 public SqlFileInstallationService(IDbContext dbContext,
                                   IGSFileProvider fileProvider,
                                   IRepository <Customer> customerRepository,
                                   IRepository <Language> languageRepository,
                                   IRepository <Store> storeRepository,
                                   IWebHelper webHelper)
 {
     this._dbContext          = dbContext;
     this._fileProvider       = fileProvider;
     this._customerRepository = customerRepository;
     this._languageRepository = languageRepository;
     this._storeRepository    = storeRepository;
     this._webHelper          = webHelper;
 }
Exemplo n.º 10
0
 public WorkFileController(IPermissionService permissionService,
                           IContractService contractService,
                           IWorkTaskService workTaskService,
                           IWorkContext workContext,
                           IWorkFileService workfileService,
                           IGSFileProvider fileProvider
                           )
 {
     this._permissionService = permissionService;
     this._workTaskService   = workTaskService;
     this._contractService   = contractService;
     this._workContext       = workContext;
     this._workfileService   = workfileService;
     this._fileProvider      = fileProvider;
 }
Exemplo n.º 11
0
        /// <summary>
        /// Save data settings to the file
        /// </summary>
        /// <param name="settings">Data settings</param>
        /// <param name="fileProvider">File provider</param>
        public static void SaveSettings(DataSettings settings, IGSFileProvider fileProvider = null)
        {
            Singleton <DataSettings> .Instance = settings ?? throw new ArgumentNullException(nameof(settings));

            fileProvider = fileProvider ?? CommonHelper.DefaultFileProvider;
            var filePath = fileProvider.MapPath(GSDataSettingsDefaults.FilePath);

            //create file if not exists
            fileProvider.CreateFile(filePath);

            //save data settings to the file
            var text = JsonConvert.SerializeObject(Singleton <DataSettings> .Instance, Formatting.Indented);

            fileProvider.WriteAllText(filePath, text, Encoding.UTF8);
        }
Exemplo n.º 12
0
 public ImportManager(CatalogSettings catalogSettings,
                      ICategoryService categoryService,
                      ICountryService countryService,
                      ICustomerActivityService customerActivityService,
                      IDataProvider dataProvider,
                      IEncryptionService encryptionService,
                      ILocalizationService localizationService,
                      ILogger logger,
                      IManufacturerService manufacturerService,
                      IMeasureService measureService,
                      INewsLetterSubscriptionService newsLetterSubscriptionService,
                      IGSFileProvider fileProvider,
                      IPictureService pictureService,
                      IServiceScopeFactory serviceScopeFactory,
                      ISpecificationAttributeService specificationAttributeService,
                      IStateProvinceService stateProvinceService,
                      IStoreContext storeContext,
                      IStoreMappingService storeMappingService,
                      IUrlRecordService urlRecordService,
                      IVendorService vendorService,
                      IWorkContext workContext,
                      MediaSettings mediaSettings,
                      VendorSettings vendorSettings)
 {
     this._catalogSettings         = catalogSettings;
     this._categoryService         = categoryService;
     this._countryService          = countryService;
     this._customerActivityService = customerActivityService;
     this._dataProvider            = dataProvider;
     this._encryptionService       = encryptionService;
     this._fileProvider            = fileProvider;
     this._localizationService     = localizationService;
     this._logger = logger;
     this._manufacturerService           = manufacturerService;
     this._measureService                = measureService;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._pictureService                = pictureService;
     this._serviceScopeFactory           = serviceScopeFactory;
     this._specificationAttributeService = specificationAttributeService;
     this._stateProvinceService          = stateProvinceService;
     this._storeContext        = storeContext;
     this._storeMappingService = storeMappingService;
     this._urlRecordService    = urlRecordService;
     this._vendorService       = vendorService;
     this._workContext         = workContext;
     this._mediaSettings       = mediaSettings;
     this._vendorSettings      = vendorSettings;
 }
Exemplo n.º 13
0
        public AzurePictureService(IDataProvider dataProvider,
                                   IDbContext dbContext,
                                   IEventPublisher eventPublisher,
                                   IGSFileProvider fileProvider,
                                   IRepository <Picture> pictureRepository,
                                   IRepository <PictureBinary> pictureBinaryRepository,
                                   //IRepository<ContractPicture> contractPictureRepository,
                                   ISettingService settingService,
                                   IStaticCacheManager cacheManager,
                                   IUrlRecordService urlRecordService,
                                   IWebHelper webHelper,
                                   MediaSettings mediaSettings,
                                   GSConfig config)
            : base(dataProvider,
                   dbContext,
                   eventPublisher,
                   fileProvider,
                   pictureRepository,
                   pictureBinaryRepository,
                   //contractPictureRepository,
                   settingService,
                   urlRecordService,
                   webHelper,
                   mediaSettings)
        {
            this._cacheManager  = cacheManager;
            this._mediaSettings = mediaSettings;
            this._config        = config;

            if (string.IsNullOrEmpty(_config.AzureBlobStorageConnectionString))
            {
                throw new Exception("Azure connection string for BLOB is not specified");
            }

            if (string.IsNullOrEmpty(_config.AzureBlobStorageContainerName))
            {
                throw new Exception("Azure container name for BLOB is not specified");
            }

            if (string.IsNullOrEmpty(_config.AzureBlobStorageEndPoint))
            {
                throw new Exception("Azure end point for BLOB is not specified");
            }

            CreateCloudBlobContainer();
        }
Exemplo n.º 14
0
 public LanguageController(ICustomerActivityService customerActivityService,
                           ILanguageModelFactory languageModelFactory,
                           ILanguageService languageService,
                           ILocalizationService localizationService,
                           IGSFileProvider fileProvider,
                           IPermissionService permissionService,
                           IStoreMappingService storeMappingService,
                           IStoreService storeService)
 {
     this._customerActivityService = customerActivityService;
     this._languageModelFactory    = languageModelFactory;
     this._languageService         = languageService;
     this._localizationService     = localizationService;
     this._fileProvider            = fileProvider;
     this._permissionService       = permissionService;
     this._storeMappingService     = storeMappingService;
     this._storeService            = storeService;
 }
Exemplo n.º 15
0
 public PdfService(AddressSettings addressSettings,
                   CatalogSettings catalogSettings,
                   CurrencySettings currencySettings,
                   IAddressAttributeFormatter addressAttributeFormatter,
                   ICurrencyService currencyService,
                   IDateTimeHelper dateTimeHelper,
                   ILanguageService languageService,
                   ILocalizationService localizationService,
                   IMeasureService measureService,
                   IGSFileProvider fileProvider,
                   IPictureService pictureService,
                   ISettingService settingService,
                   IStoreContext storeContext,
                   IStoreService storeService,
                   IVendorService vendorService,
                   IWorkContext workContext,
                   MeasureSettings measureSettings,
                   PdfSettings pdfSettings,
                   TaxSettings taxSettings,
                   VendorSettings vendorSettings)
 {
     this._addressSettings           = addressSettings;
     this._catalogSettings           = catalogSettings;
     this._currencySettings          = currencySettings;
     this._addressAttributeFormatter = addressAttributeFormatter;
     this._currencyService           = currencyService;
     this._dateTimeHelper            = dateTimeHelper;
     this._languageService           = languageService;
     this._localizationService       = localizationService;
     this._measureService            = measureService;
     this._fileProvider    = fileProvider;
     this._pictureService  = pictureService;
     this._settingService  = settingService;
     this._storeContext    = storeContext;
     this._storeService    = storeService;
     this._vendorService   = vendorService;
     this._workContext     = workContext;
     this._measureSettings = measureSettings;
     this._pdfSettings     = pdfSettings;
     this._taxSettings     = taxSettings;
     this._vendorSettings  = vendorSettings;
 }
Exemplo n.º 16
0
        static PluginManager()
        {
            //we use the default file provider, since the DI isn't initialized yet
            _fileProvider = CommonHelper.DefaultFileProvider;

            //get all libraries from /bin/{version}/ directory
            _baseAppLibraries = _fileProvider.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll").Select(fi => _fileProvider.GetFileName(fi)).ToList();

            //get all libraries from base site directory
            if (!AppDomain.CurrentDomain.BaseDirectory.Equals(Environment.CurrentDirectory, StringComparison.InvariantCultureIgnoreCase))
            {
                _baseAppLibraries.AddRange(_fileProvider.GetFiles(Environment.CurrentDirectory, "*.dll").Select(fi => _fileProvider.GetFileName(fi)));
            }

            //get all libraries from refs directory
            var refsPathName = _fileProvider.Combine(Environment.CurrentDirectory, GSPluginDefaults.RefsPathName);

            if (_fileProvider.DirectoryExists(refsPathName))
            {
                _baseAppLibraries.AddRange(_fileProvider.GetFiles(refsPathName, "*.dll").Select(fi => _fileProvider.GetFileName(fi)));
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="seoSettings">SEO settings</param>
        /// <param name="hostingEnvironment">Hosting environment</param>
        /// <param name="cacheManager">Cache manager</param>
        /// <param name="fileProvider">File provider</param>
        /// <param name="urlRecordService">Url record service</param>
        public PageHeadBuilder(SeoSettings seoSettings,
                               IHostingEnvironment hostingEnvironment,
                               IStaticCacheManager cacheManager,
                               IGSFileProvider fileProvider,
                               IUrlRecordService urlRecordService)
        {
            this._seoSettings        = seoSettings;
            this._hostingEnvironment = hostingEnvironment;
            this._cacheManager       = cacheManager;
            this._fileProvider       = fileProvider;
            this._urlRecordService   = urlRecordService;
            this._processor          = new BundleFileProcessor();

            this._titleParts           = new List <string>();
            this._metaDescriptionParts = new List <string>();
            this._metaKeywordParts     = new List <string>();
            this._scriptParts          = new Dictionary <ResourceLocation, List <ScriptReferenceMeta> >();
            this._inlineScriptParts    = new Dictionary <ResourceLocation, List <string> >();
            this._cssParts             = new Dictionary <ResourceLocation, List <CssReferenceMeta> >();
            this._canonicalUrlParts    = new List <string>();
            this._headCustomParts      = new List <string>();
            this._pageCssClassParts    = new List <string>();
        }
Exemplo n.º 18
0
 public PictureService(IDataProvider dataProvider,
                       IDbContext dbContext,
                       IEventPublisher eventPublisher,
                       IGSFileProvider fileProvider,
                       IRepository <Picture> pictureRepository,
                       IRepository <PictureBinary> pictureBinaryRepository,
                       //IRepository<ProductPicture> productPictureRepository,
                       ISettingService settingService,
                       IUrlRecordService urlRecordService,
                       IWebHelper webHelper,
                       MediaSettings mediaSettings)
 {
     this._dataProvider            = dataProvider;
     this._dbContext               = dbContext;
     this._eventPublisher          = eventPublisher;
     this._fileProvider            = fileProvider;
     this._pictureRepository       = pictureRepository;
     this._pictureBinaryRepository = pictureBinaryRepository;
     //this._productPictureRepository = productPictureRepository;
     this._settingService   = settingService;
     this._urlRecordService = urlRecordService;
     this._webHelper        = webHelper;
     this._mediaSettings    = mediaSettings;
 }
Exemplo n.º 19
0
 public WebAppTypeFinder(IGSFileProvider fileProvider = null) : base(fileProvider)
 {
 }
 public InstallationLocalizationService(IHttpContextAccessor httpContextAccessor,
                                        IGSFileProvider fileProvider)
 {
     this._httpContextAccessor = httpContextAccessor;
     this._fileProvider        = fileProvider;
 }
Exemplo n.º 21
0
 public GeoLookupService(ILogger logger,
                         IGSFileProvider fileProvider)
 {
     this._logger       = logger;
     this._fileProvider = fileProvider;
 }
Exemplo n.º 22
0
 public CommonModelFactory(BlogSettings blogSettings,
                           CaptchaSettings captchaSettings,
                           CatalogSettings catalogSettings,
                           CommonSettings commonSettings,
                           CustomerSettings customerSettings,
                           DisplayDefaultFooterItemSettings displayDefaultFooterItemSettings,
                           ForumSettings forumSettings,
                           IActionContextAccessor actionContextAccessor,
                           ICategoryService categoryService,
                           ICurrencyService currencyService,
                           ICustomerService customerService,
                           IForumService forumService,
                           IGenericAttributeService genericAttributeService,
                           IHostingEnvironment hostingEnvironment,
                           ILanguageService languageService,
                           ILocalizationService localizationService,
                           IManufacturerService manufacturerService,
                           IGSFileProvider fileProvider,
                           IPageHeadBuilder pageHeadBuilder,
                           IPermissionService permissionService,
                           IPictureService pictureService,
                           ISitemapGenerator sitemapGenerator,
                           IStaticCacheManager cacheManager,
                           IStoreContext storeContext,
                           IThemeContext themeContext,
                           IThemeProvider themeProvider,
                           ITopicService topicService,
                           IUrlHelperFactory urlHelperFactory,
                           IUrlRecordService urlRecordService,
                           IWebHelper webHelper,
                           IWorkContext workContext,
                           LocalizationSettings localizationSettings,
                           NewsSettings newsSettings,
                           StoreInformationSettings storeInformationSettings,
                           VendorSettings vendorSettings)
 {
     this._blogSettings     = blogSettings;
     this._captchaSettings  = captchaSettings;
     this._catalogSettings  = catalogSettings;
     this._commonSettings   = commonSettings;
     this._customerSettings = customerSettings;
     this._displayDefaultFooterItemSettings = displayDefaultFooterItemSettings;
     this._forumSettings           = forumSettings;
     this._actionContextAccessor   = actionContextAccessor;
     this._categoryService         = categoryService;
     this._currencyService         = currencyService;
     this._customerService         = customerService;
     this._forumService            = forumService;
     this._genericAttributeService = genericAttributeService;
     this._hostingEnvironment      = hostingEnvironment;
     this._languageService         = languageService;
     this._localizationService     = localizationService;
     this._manufacturerService     = manufacturerService;
     this._fileProvider            = fileProvider;
     this._pageHeadBuilder         = pageHeadBuilder;
     this._permissionService       = permissionService;
     this._pictureService          = pictureService;
     this._sitemapGenerator        = sitemapGenerator;
     this._cacheManager            = cacheManager;
     this._storeContext            = storeContext;
     this._themeContext            = themeContext;
     this._themeProvider           = themeProvider;
     this._topicService            = topicService;
     this._urlHelperFactory        = urlHelperFactory;
     this._urlRecordService        = urlRecordService;
     this._webHelper                = webHelper;
     this._workContext              = workContext;
     this._localizationSettings     = localizationSettings;
     this._newsSettings             = newsSettings;
     this._storeInformationSettings = storeInformationSettings;
     this._vendorSettings           = vendorSettings;
 }
Exemplo n.º 23
0
 public UploadService(IGSFileProvider fileProvider,
                      IThemeProvider themeProvider)
 {
     this._fileProvider  = fileProvider;
     this._themeProvider = themeProvider;
 }
Exemplo n.º 24
0
 public DownloadController(IDownloadService downloadService,
                           IGSFileProvider fileProvider)
 {
     this._downloadService = downloadService;
     this._fileProvider    = fileProvider;
 }
Exemplo n.º 25
0
 public AppDomainTypeFinder(IGSFileProvider fileProvider = null)
 {
     this._fileProvider = fileProvider ?? CommonHelper.DefaultFileProvider;
 }
Exemplo n.º 26
0
 public EmailSender(IDownloadService downloadService,
                    IGSFileProvider fileProvider)
 {
     this._downloadService = downloadService;
     this._fileProvider    = fileProvider;
 }
Exemplo n.º 27
0
        /// <summary>
        /// Load data settings
        /// </summary>
        /// <param name="filePath">File path; pass null to use the default settings file</param>
        /// <param name="reloadSettings">Whether to reload data, if they already loaded</param>
        /// <param name="fileProvider">File provider</param>
        /// <returns>Data settings</returns>
        public static DataSettings LoadSettings(string filePath = null, bool reloadSettings = false, IGSFileProvider fileProvider = null)
        {
            if (!reloadSettings && Singleton <DataSettings> .Instance != null)
            {
                return(Singleton <DataSettings> .Instance);
            }

            fileProvider = fileProvider ?? CommonHelper.DefaultFileProvider;
            filePath     = filePath ?? fileProvider.MapPath(GSDataSettingsDefaults.FilePath);

            //check whether file exists
            if (!fileProvider.FileExists(filePath))
            {
                //if not, try to parse the file that was used in previous nopCommerce versions
                filePath = fileProvider.MapPath(GSDataSettingsDefaults.ObsoleteFilePath);
                if (!fileProvider.FileExists(filePath))
                {
                    return(new DataSettings());
                }

                //get data settings from the old txt file
                var dataSettings = new DataSettings();
                using (var reader = new StringReader(fileProvider.ReadAllText(filePath, Encoding.UTF8)))
                {
                    string settingsLine;
                    while ((settingsLine = reader.ReadLine()) != null)
                    {
                        var separatorIndex = settingsLine.IndexOf(':');
                        if (separatorIndex == -1)
                        {
                            continue;
                        }

                        var key   = settingsLine.Substring(0, separatorIndex).Trim();
                        var value = settingsLine.Substring(separatorIndex + 1).Trim();

                        switch (key)
                        {
                        case "DataProvider":
                            dataSettings.DataProvider = Enum.TryParse(value, true, out DataProviderType providerType) ? providerType : DataProviderType.Unknown;
                            continue;

                        case "DataConnectionString":
                            dataSettings.DataConnectionString = value;
                            continue;

                        default:
                            dataSettings.RawDataSettings.Add(key, value);
                            continue;
                        }
                    }
                }

                //save data settings to the new file
                SaveSettings(dataSettings, fileProvider);

                //and delete the old one
                fileProvider.DeleteFile(filePath);

                Singleton <DataSettings> .Instance = dataSettings;
                return(Singleton <DataSettings> .Instance);
            }

            var text = fileProvider.ReadAllText(filePath, Encoding.UTF8);

            if (string.IsNullOrEmpty(text))
            {
                return(new DataSettings());
            }

            //get data settings from the JSON file
            Singleton <DataSettings> .Instance = JsonConvert.DeserializeObject <DataSettings>(text);

            return(Singleton <DataSettings> .Instance);
        }
Exemplo n.º 28
0
 public ThemeProvider(IGSFileProvider fileProvider)
 {
     this._fileProvider = fileProvider;
 }
Exemplo n.º 29
0
 public JbimagesController(IGSFileProvider fileProvider,
                           IPermissionService permissionService)
 {
     this._fileProvider      = fileProvider;
     this._permissionService = permissionService;
 }