예제 #1
0
        public FileSystemStorageProvider(IConfigurationProvider <FileSystemSettings> provider)
        {
            this.settings = provider.Settings;
            var mediaPath = HostingEnvironment.IsHosted
                                ? HostingEnvironment.MapPath("~/Media/") ?? ""
                                : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Media");

            storagePath = Path.Combine(mediaPath, settings.DirectoryName);

            var appPath = "";

            if (HostingEnvironment.IsHosted)
            {
                appPath = HostingEnvironment.ApplicationVirtualPath;
            }
            if (!appPath.EndsWith("/"))
            {
                appPath = appPath + '/';
            }
            if (!appPath.StartsWith("/"))
            {
                appPath = '/' + appPath;
            }

            var dirPath = string.IsNullOrEmpty(settings.DirectoryName) ? string.Empty : settings.DirectoryName + "/";

            publicPath = appPath + "Media/" + dirPath;
        }
예제 #2
0
 public void Execute()
 {
     if (provider.Settings.IsDefaultOrEmpty())
     {
         var settings = FileSystemSettings.Default();
         provider.Save(settings);
     }
 }