示例#1
0
        public SharpImageFactory(SmartConfiguration appConfig)
        {
            switch (appConfig.ImagingMemoryAllocation)
            {
            case ImagingMemoryAllocation.Minimal:
                _memAllocator = ArrayPoolMemoryAllocator.CreateWithMinimalPooling();
                break;

            case ImagingMemoryAllocation.Moderate:
                _memAllocator = ArrayPoolMemoryAllocator.CreateWithModeratePooling();
                break;

            case ImagingMemoryAllocation.Default:
                _memAllocator = ArrayPoolMemoryAllocator.CreateDefault();
                break;

            case ImagingMemoryAllocation.Aggressive:
                _memAllocator = ArrayPoolMemoryAllocator.CreateWithAggressivePooling();
                break;
            }

            SharpConfiguration.Default.MemoryAllocator = _memAllocator;

            // Release memory pool every 10 minutes
            var releaseInterval = TimeSpan.FromMinutes(10);

            _releaseMemTimer = new Timer(o => ReleaseMemory(), null, releaseInterval, releaseInterval);
        }
示例#2
0
 public DatabaseInitializer(ILifetimeScope scope, ITypeScanner typeScanner, SmartConfiguration appConfig)
 {
     _scope       = scope;
     _appConfig   = appConfig;
     _typeScanner = typeScanner;
     _seedersMap  = DiscoverDataSeeders().ToMultimap(key => key.ContextType, value => value.SeederType);
 }
示例#3
0
 public ValidateCaptchaFilter(
     CaptchaSettings captchaSettings,
     ILogger <ValidateCaptchaFilter> logger,
     Localizer localizer,
     SmartConfiguration appConfig)
 {
     _captchaSettings = captchaSettings;
     _appConfig       = appConfig;
     Logger           = logger;
     T = localizer;
 }
示例#4
0
        private static string GetPublicPath(SmartConfiguration appConfig)
        {
            var path = appConfig.MediaPublicPath?.Trim().NullEmpty() ?? "media";

            if (path.IsWebUrl())
            {
                throw new NotSupportedException($"Fully qualified URLs are not supported for the {TypeHelper.NameOf<SmartConfiguration>(x => x.MediaPublicPath)} setting.");
            }

            return(path.TrimStart('~', '/').Replace('\\', '/').ToLower().EnsureEndsWith('/'));
        }
示例#5
0
        private static string GetStoragePath(SmartConfiguration appConfig, out bool pathIsAbsolute)
        {
            var path = appConfig.MediaStoragePath?.Trim().NullEmpty();

            if (path == null)
            {
                path = "App_Data/Tenants/" + DataSettings.Instance.TenantName + "/Media";
            }

            pathIsAbsolute = PathHelper.IsAbsolutePhysicalPath(path);

            return(path);
        }
 public TaskSchedulerInitializer(SmartConfiguration appConfig)
 {
     _appConfig = appConfig;
 }
示例#7
0
 public TaskSchedulerInitializer(SmartConfiguration appConfig, IEventPublisher eventPublisher)
 {
     _appConfig      = appConfig;
     _eventPublisher = eventPublisher;
 }
示例#8
0
 public CaptchaTagHelper(CaptchaSettings captchaSettings, IWorkContext workContext, SmartConfiguration appConfig)
 {
     _captchaSettings = captchaSettings;
     _workContext     = workContext;
     _appConfig       = appConfig;
 }