Exemple #1
0
 public WebPath(
     WebPathSettings webPathSettings,
     StaticUploader staticUploader,
     SettingsManager settingsManager,
     StorageSettingsHelper storageSettingsHelper,
     IHttpContextAccessor httpContextAccessor,
     IHostEnvironment hostEnvironment,
     CoreBaseSettings coreBaseSettings,
     IOptionsMonitor <ILog> options)
     : this(webPathSettings, staticUploader, settingsManager, storageSettingsHelper, hostEnvironment, coreBaseSettings, options)
 {
     HttpContextAccessor = httpContextAccessor;
 }
Exemple #2
0
 public WebPath(
     WebPathSettings webPathSettings,
     StaticUploader staticUploader,
     SettingsManager settingsManager,
     StorageSettingsHelper storageSettingsHelper,
     IHostEnvironment hostEnvironment,
     CoreBaseSettings coreBaseSettings,
     IOptionsMonitor <ILog> options)
 {
     WebPathSettings       = webPathSettings;
     StaticUploader        = staticUploader;
     SettingsManager       = settingsManager;
     StorageSettingsHelper = storageSettingsHelper;
     HostEnvironment       = hostEnvironment;
     CoreBaseSettings      = coreBaseSettings;
     Options = options;
 }
Exemple #3
0
        public string GetPath(string relativePath)
        {
            if (!string.IsNullOrEmpty(relativePath) && relativePath.IndexOf('~') == 0)
            {
                throw new ArgumentException(string.Format("bad path format {0} remove '~'", relativePath), "relativePath");
            }

            if (CoreBaseSettings.Standalone && StaticUploader.CanUpload())
            {
                try
                {
                    var result = StorageSettingsHelper.DataStore(SettingsManager.Load <CdnStorageSettings>()).GetInternalUri("", relativePath, TimeSpan.Zero, null).AbsoluteUri.ToLower();
                    if (!string.IsNullOrEmpty(result))
                    {
                        return(result);
                    }
                }
                catch (Exception)
                {
                }
            }

            return(WebPathSettings.GetPath(HttpContextAccessor.HttpContext, Options, relativePath));
        }