Coree.NETStandard
  • API
Show / Hide Table of Contents
  • Coree.NETStandard.Abstractions.DependencySingleton
    • DependencySingleton<T>
    • IDependencySingleton
  • Coree.NETStandard.Abstractions.FluentBase
    • FluentBase
    • IFluentBase
  • Coree.NETStandard.Abstractions.ServiceFactory
    • ServiceFactory<T>
  • Coree.NETStandard.Classes.AsyncEventCollection
    • AsyncEventCollection<T>
    • AsyncEventCollection<T>.CustomEventDelegate
  • Coree.NETStandard.Classes.Criteria
    • CriteriaComparisonMethod
    • CriteriaEnumerableExtensions
    • CriteriaExpressionBuilder
    • CriteriaItem<TValue>
    • CriteriaItems
    • CriteriaOperator
    • CriteriaQueryableExtensions
  • Coree.NETStandard.Classes.Scheduler
    • Scheduler
    • Scheduler.TickerEventArgs
    • Scheduler.TickerEventDelegate
  • Coree.NETStandard.Classes.ThreadSafeCollection
    • ThreadSafeCollection<T>
  • Coree.NETStandard.Classes.ThreadSafeValue
    • ThreadSafeValue<T>
  • Coree.NETStandard.Classes.TimeOfDay
    • TimeOfDay
  • Coree.NETStandard.CoreeHttpClient
    • CoreeHttpClient
    • CoreeHttpClient2
    • HttpHeadersExtensions
    • HttpRequestHeadersExtensions
    • HttpResponseResult
    • HttpResponseResult.OperationStatus
    • HttpResponseResult2
    • HttpResponseResult2.OperationStatus
    • ICoreeHttpClient
    • Product
    • ProductExtensions
    • RequestContentBuilder
    • RequestParamBuilder
    • ServiceCollectionExtensions
    • UriExtensions
  • Coree.NETStandard.Extensions.Collections.Enumerable
    • CollectionsEnumerableExtensions
  • Coree.NETStandard.Extensions.Collections.List
    • CollectionsListExtensions
  • Coree.NETStandard.Extensions.Conversions.ByteArray
    • ConversionsByteArrayExtensions
  • Coree.NETStandard.Extensions.Conversions.HostApplicationBuilder
    • ConversionsHostApplicationBuilderExtensions
  • Coree.NETStandard.Extensions.Conversions.String
    • ConversionsStringExtensions
    • Encodings
  • Coree.NETStandard.Extensions.Conversions.Stringbuilder
    • ConversionsStringbuilderExtension
  • Coree.NETStandard.Extensions.Primitives.Bool
    • PrimitivesBoolExtensions
  • Coree.NETStandard.Extensions.Reflection.ServiceProvider
    • ReflectionServiceProviderExtensions
  • Coree.NETStandard.Extensions.Threading.CancellationToken
    • ThreadingCancellationTokenExtensions
  • Coree.NETStandard.Extensions.Utilities
    • DateTimeExtensions
  • Coree.NETStandard.Extensions.Validations.String
    • ValidationsStringExtensions
  • Coree.NETStandard.HostedServicesCollection
    • HostedServicesCollectionConfig<T>
    • IHostedServicesCollectionConfig<T>
    • ServiceCollectionExtensions
    • ServiceProviderExtensions
  • Coree.NETStandard.Serilog
    • ConditionalLevelSink
    • LoggerSinkConfigurationExtensions
    • OutputTemplates
    • ServiceCollectionExtensions
    • SourceContextShortEnricher
  • Coree.NETStandard.Services
    • IRuntimeInsightsx
    • RuntimeInsightsServicex
  • Coree.NETStandard.Services.File
    • FileService
    • IFileService
  • Coree.NETStandard.Services.Process
    • IProcessService
    • ProcessRunExitCodeState
    • ProcessRunResult
    • ProcessService
  • Coree.NETStandard.Services.RuntimeInsights
    • IRuntimeInsightsService
    • RuntimeInsightsService
  • Coree.NETStandard.SpectreConsole
    • CommandAppExtensions
    • HostBuilderExtensions
    • ServiceCollectionExtensions
    • SpectreConsoleHostedService
    • SpectreConsoleHostedService.ExitCode
    • SpectreConsoleTypeRegistrar
    • SpectreConsoleTypeResolver
  • Coree.NETStandard.UnderConstruction
    • DbContextExtensions
    • HttpClientStatic
    • HttpClientStatic.HttpClientResponse
    • HttpClientStatic.XRate
    • HttpClientStatic.XRateGroup
    • HttpClientStatic.XRateItem
    • IScheduleProvider
    • IntervalScheduleProvider
    • LimitedHistory<T>
    • ScheduleCombiner
    • Scheduler2
    • Scheduler2.TickerEventArgs
    • Scheduler2.TickerEventDelegate
    • Scheduler3
    • Scheduler3.TickerEventArgs
    • Scheduler3.TickerEventDelegate
    • SqlliteMemoryContext
    • SqlliteMemoryContext.UserDataDto
    • TimedEntry<T>
    • Timing
    • Timing.Ticker
    • Timing.Ticker.TickerEventArgs
    • Timing.TickerSync
    • WeekDayAtScheduleProvider
  • Coree.NETStandard.Utilities
    • EventSubscription
    • MainContext

Class FileService

Defines a service for file system operations.

Inheritance
object
ServiceFactory<FileService>
FileService
Implements
IDisposable
IFileService
Inherited Members
ServiceFactory<FileService>.CreateServiceFactory(Action<IHostBuilder>)
ServiceFactory<FileService>.CreateServiceFactory(Action<IServiceCollection>)
ServiceFactory<FileService>.CreateServiceFactory(Action<IServiceCollection>, Action<ILoggingBuilder>, Action<IHostBuilder>)
ServiceFactory<FileService>.CreateServiceFactory()
ServiceFactory<FileService>.CreateServiceFactory(LogLevel)
ServiceFactory<FileService>.Dispose()
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Coree.NETStandard.Services.File
Assembly: Coree.NETStandard.dll
Syntax
public class FileService : ServiceFactory<FileService>, IDisposable, IFileService

Constructors

| <<<<<<< HEAD Edit this page View Source ======= Edit this page View Source >>>>>>> release

FileService(ILogger<FileService>?)

Declaration
public FileService(ILogger<FileService>? logger = null)
Parameters
Type Name Description
ILogger<FileService> logger

Methods

| <<<<<<< HEAD Edit this page View Source ======= Edit this page View Source >>>>>>> release

GetCorrectCasedPath(string?)

Declaration
public string? GetCorrectCasedPath(string? path)
Parameters
Type Name Description
string path
Returns
Type Description
string
| <<<<<<< HEAD Edit this page View Source ======= Edit this page View Source >>>>>>> release

GetCorrectCasedPathAsync(string?, CancellationToken)

Corrects the casing of a specified file or directory path based on the actual casing on the file system.

Declaration
public Task<string?> GetCorrectCasedPathAsync(string? path, CancellationToken cancellationToken)
Parameters
Type Name Description
string path

The path to correct. Can be either a file or directory path.

CancellationToken cancellationToken
Returns
Type Description
Task<string>

The path with corrected casing if the file or directory exists. Returns null for null or empty input, returns the original path if the path does not exist or if the file system is case-sensitive and not NTFS or FAT.

Remarks

This method checks the existence of the path and then corrects its casing to match the case used in the file system. It considers the file system's case sensitivity: on NTFS or FAT (case-insensitive file systems), it corrects the path casing; otherwise, it assumes a case-sensitive file system and returns the original path if the drive format is not recognized. The method processes each component of the path to ensure the entire path is correctly cased from root to leaf.

| <<<<<<< HEAD Edit this page View Source ======= Edit this page View Source >>>>>>> release

IsCommandAvailable(string?)

Declaration
public string? IsCommandAvailable(string? path)
Parameters
Type Name Description
string path
Returns
Type Description
string
| <<<<<<< HEAD Edit this page View Source ======= Edit this page View Source >>>>>>> release

IsCommandAvailableAsync(string?, CancellationToken)

Declaration
public Task<string?> IsCommandAvailableAsync(string? command, CancellationToken cancellationToken)
Parameters
Type Name Description
string command
CancellationToken cancellationToken
Returns
Type Description
Task<string>
| <<<<<<< HEAD Edit this page View Source ======= Edit this page View Source >>>>>>> release

IsExecutableFilePresent(string?, string)

Declaration
public string? IsExecutableFilePresent(string? command, string path)
Parameters
Type Name Description
string command
string path
Returns
Type Description
string
| <<<<<<< HEAD Edit this page View Source ======= Edit this page View Source >>>>>>> release

IsExecutableFilePresentAsync(string?, string)

Declaration
public Task<string?> IsExecutableFilePresentAsync(string? command, string path)
Parameters
Type Name Description
string command
string path
Returns
Type Description
Task<string>

Implements

IDisposable
IFileService
  • <<<<<<< HEAD Edit this page
  • View Source ======= Edit this page
  • View Source >>>>>>> release
In this article
Back to top