Пример #1
0
        public Settings_t()
        {
            this.EnvironmentName = "Production";
            ApplicationName      = typeof(Program).Assembly.GetName().Name;
            this.ContentRootPath = System.IO.Path.GetDirectoryName(typeof(Program).Assembly.Location);

            this.ProjectRootPath = this.ContentRootPath;
            this.ProjectRootPath = System.IO.Path.Combine(this.ProjectRootPath, "..", "..", "..");
            this.ProjectRootPath = System.IO.Path.GetFullPath(this.ProjectRootPath);


            this.WebRootPath = this.ProjectRootPath;

            this.ContentRootFileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
                this.ContentRootPath
                );

            this.ProjectRootFileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
                this.ProjectRootPath
                );

            this.WebRootFileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
                this.WebRootPath
                );
        }
        public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddYamlFile(
            this Microsoft.Extensions.Configuration.IConfigurationBuilder builder
            , Microsoft.Extensions.FileProviders.IFileProvider provider
            , string path
            , bool optional
            , bool reloadOnChange)
        {
            if (provider == null && System.IO.Path.IsPathRooted(path))
            {
                provider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
                    System.IO.Path.GetDirectoryName(path)
                    );
                path = System.IO.Path.GetFileName(path);
            }

            Microsoft.Extensions.Configuration.Yaml.YamlConfigurationSource source =
                new Microsoft.Extensions.Configuration.Yaml.YamlConfigurationSource
            {
                FileProvider   = provider,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange
            };
            builder.Add(source);
            return(builder);
        }
Пример #3
0
        protected RoleLoader(AuthorizationConfiguration <TDataActions> authorizationConfiguration, IHostEnvironment hostEnvironment)
        {
            EnsureArg.IsNotNull(authorizationConfiguration, nameof(authorizationConfiguration));
            EnsureArg.IsNotNull(hostEnvironment, nameof(hostEnvironment));
            EnsureArg.IsNotNull(hostEnvironment.ContentRootFileProvider, nameof(hostEnvironment.ContentRootFileProvider));

            _authorizationConfiguration = authorizationConfiguration;
            _fileProvider = hostEnvironment.ContentRootFileProvider;
        }
Пример #4
0
        public RoleLoader(AuthorizationConfiguration authorizationConfiguration, IHostEnvironment hostEnvironment)
        {
            EnsureArg.IsNotNull(authorizationConfiguration, nameof(authorizationConfiguration));
            EnsureArg.IsNotNull(hostEnvironment, nameof(hostEnvironment));
            EnsureArg.IsNotNull(hostEnvironment.ContentRootFileProvider, nameof(hostEnvironment.ContentRootFileProvider));

            _authorizationConfiguration = authorizationConfiguration;
            _hostEnvironment            = hostEnvironment;
            _fileProvider = hostEnvironment.ContentRootFileProvider;
        }
Пример #5
0
 public void ExpireChangeTokens()
 {
     // Use a new scope to get the file provider
     using (IServiceScope scope = _serviceScopeFactory.CreateScope())
     {
         Microsoft.Extensions.FileProviders.IFileProvider fileProvider =
             scope.ServiceProvider.GetService <Microsoft.Extensions.FileProviders.IFileProvider>();
         ((FileSystemFileProvider)fileProvider).ExpireChangeTokens();
     }
 }
Пример #6
0
        public void Update(Action <T> applyChanges)
        {
            Microsoft.Extensions.FileProviders.IFileProvider fileProvider = _environment.ContentRootFileProvider;
            Microsoft.Extensions.FileProviders.IFileInfo     fileInfo     = fileProvider.GetFileInfo(_file);
            string physicalPath = fileInfo.PhysicalPath;

            JObject jsonObject    = JsonConvert.DeserializeObject <JObject>(File.ReadAllText(physicalPath));
            T       sectionObject = jsonObject.TryGetValue(_section, out JToken section) ? JsonConvert.DeserializeObject <T>(section.ToString()) : (Value ?? new T());

            applyChanges(sectionObject);

            jsonObject[_section] = JObject.Parse(JsonConvert.SerializeObject(sectionObject));
            File.WriteAllText(physicalPath, JsonConvert.SerializeObject(jsonObject, Formatting.Indented));
            _configuration.Reload();
        }
Пример #7
0
 public static Microsoft.AspNetCore.Rewrite.RewriteOptions AddIISUrlRewrite(this Microsoft.AspNetCore.Rewrite.RewriteOptions options, Microsoft.Extensions.FileProviders.IFileProvider fileProvider, string filePath, bool alwaysUseManagedServerVariables = default(bool)) => throw null;
Пример #8
0
 public static Microsoft.AspNetCore.Rewrite.RewriteOptions AddApacheModRewrite(this Microsoft.AspNetCore.Rewrite.RewriteOptions options, Microsoft.Extensions.FileProviders.IFileProvider fileProvider, string filePath) => throw null;
Пример #9
0
 public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddIniFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, Microsoft.Extensions.FileProviders.IFileProvider provider, string path, bool optional, bool reloadOnChange)
 {
     throw null;
 }
Пример #10
0
 public static Microsoft.Extensions.Configuration.IConfigurationBuilder SetFileProvider(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, Microsoft.Extensions.FileProviders.IFileProvider fileProvider)
 {
     throw null;
 }
Пример #11
0
 public static FileServicesOptions AddFileProviderReadOnly(this FileServicesOptions app, Microsoft.Extensions.FileProviders.IFileProvider fileProvider)
 {
     return(AddFileProviderReadOnly(app, sp =>
     {
         return fileProvider;
     }));
 }
Пример #12
0
 public ChannelImageTagHelper(Microsoft.Extensions.FileProviders.IFileProvider fileProvider)
 {
     _fileProvider = fileProvider;
 }
 public ExceptionDetailsProvider(Microsoft.Extensions.FileProviders.IFileProvider fileProvider, int sourceCodeLineCount)
 {
 }
 public StaticFileContext(Microsoft.AspNetCore.Http.HttpContext context, Microsoft.AspNetCore.Builder.StaticFileOptions options, Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.FileProviders.IFileProvider fileProvider, string contentType, Microsoft.AspNetCore.Http.PathString subPath)
 {
     throw null;
 }
Пример #15
0
        protected async System.Threading.Tasks.Task <System.Text.Json.JsonDocument?> ParseJsonFromFile(Microsoft.Extensions.FileProviders.IFileProvider fileProvider, string fileName)
        {
            using System.IO.Stream stream = fileProvider.GetFileInfo(fileName).CreateReadStream();
            byte[] buffer = new byte[stream.Length];
            _ = await stream.ReadAsync(buffer, 0, buffer.Length);

            try
            {
                return(System.Text.Json.JsonDocument.Parse(new System.Buffers.ReadOnlySequence <byte>(buffer)));
            }
            catch (System.Text.Json.JsonException)
            {
                return(null);
            }
        }
Пример #16
0
 public Download(IFoo foo, IFileProvider fileProvider)
 {
     _foo          = foo;
     _fileProvider = fileProvider;
 }