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); }
public DatabaseInitializer(ILifetimeScope scope, ITypeScanner typeScanner, SmartConfiguration appConfig) { _scope = scope; _appConfig = appConfig; _typeScanner = typeScanner; _seedersMap = DiscoverDataSeeders().ToMultimap(key => key.ContextType, value => value.SeederType); }
public ValidateCaptchaFilter( CaptchaSettings captchaSettings, ILogger <ValidateCaptchaFilter> logger, Localizer localizer, SmartConfiguration appConfig) { _captchaSettings = captchaSettings; _appConfig = appConfig; Logger = logger; T = localizer; }
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('/')); }
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; }
public TaskSchedulerInitializer(SmartConfiguration appConfig, IEventPublisher eventPublisher) { _appConfig = appConfig; _eventPublisher = eventPublisher; }
public CaptchaTagHelper(CaptchaSettings captchaSettings, IWorkContext workContext, SmartConfiguration appConfig) { _captchaSettings = captchaSettings; _workContext = workContext; _appConfig = appConfig; }