• Articles
  • Api Documentation
Show / Hide Table of Contents
  • Dapplo.Addons
    • IAction
    • IApplicationBootstrapper
    • IAsyncShutdownAction
    • IAsyncStartupAction
    • IBootstrapper
    • IDependencyProvider
    • IMefServiceLocator
    • IModule
    • IServiceExporter
    • IServiceRepository
    • IShutdownAction
    • IShutdownMetadata
    • IShutdownModule
    • IStartupAction
    • IStartupMetadata
    • IStartupModule
    • ModuleAttribute
    • ShutdownActionAttribute
    • StartupActionAttribute
    • StartupException
  • Dapplo.Addons.Bootstrapper
    • ApplicationBootstrapper
    • CompositionBootstrapper
    • ResourceMutex
    • StartupShutdownBootstrapper
  • Dapplo.Addons.Bootstrapper.Internal
    • CompressionTypes
    • StreamExtensions
  • Dapplo.Addons.Bootstrapper.Resolving
    • AssemblyResolver
    • EmbeddedResources
    • FileLocations
    • FileTools

Class FileTools

Some utils for working with files (mainly filename)

Inheritance
System.Object
FileTools
Namespace:Dapplo.Addons.Bootstrapper.Resolving
Assembly:Dapplo.Addons.Bootstrapper.dll
Syntax
public static class FileTools : object

Methods

| Improve this Doc View Source

FilenameToRegex(String, IEnumerable<String>, Boolean, String)

Create a regex to find the specified file with wildcards.

Declaration
public static Regex FilenameToRegex(string filename, IEnumerable<string> extensions, bool ignoreCase = true, string prefix = "^(.*\\\\)*")
Parameters
Type Name Description
System.String filename

string with the filename pattern to match, like Dapplo.* is allowed. Together with extensions "dll" and "dll.gz" this would be converted to Dapplo..*(.dll|.dll.gz)$ (the . in the filename pattern is NOT a any, for this a ? should be used)

IEnumerable<System.String> extensions

Extensions which need to be matched allowed

System.Boolean ignoreCase

default is true and makes sure the case is ignored

System.String prefix

The prefix by default restricts the match to be a complete filename, independend of the path before it. For resources the predix could be the namespace but you can also specify the directory up to the file if you want a concrete fix.

Returns
Type Description
Regex

Regex representing the filename pattern

| Improve this Doc View Source

RemoveExtensions(String, IEnumerable<String>)

Remove extensions from a filename / path

Declaration
public static string RemoveExtensions(string filepath, IEnumerable<string> extensions = null)
Parameters
Type Name Description
System.String filepath

string with a filename or path

IEnumerable<System.String> extensions

IEnumerable with extensions to remove

Returns
Type Description
System.String

string

  • Improve this Doc
  • View Source
Back to top Copyright © 2017 Dapplo