C# Class KeePassLib.Utility.UrlUtil

A class containing various static path utility helper methods (like stripping extension from a file, etc.).
ファイルを表示 Open project: cappert/keepass2

Public Methods

Method Description
AssemblyEquals ( string strExt, string strShort ) : bool
ConvertSeparators ( string strPath ) : string
ConvertSeparators ( string strPath, char chSeparator ) : string
EnsureTerminatingSeparator ( string strPath, bool bUrl ) : string

Ensure that a path is terminated with a directory separator character.

FileUrlToPath ( string strUrl ) : string
FilterFileName ( string strName ) : string
GetExtension ( string strPath ) : string

Get the extension of a file.

GetFileDirectory ( string strFile, bool bAppendTerminatingChar, bool bEnsureValidDirSpec ) : string

Get the directory (path) of a file name. The returned string may be terminated by a directory separator character. Example: passing C:\\My Documents\\My File.kdb in strFile and true to bAppendTerminatingChar would produce this string: C:\\My Documents\\.

GetFileInfos ( DirectoryInfo di, string strPattern, SearchOption opt ) : List
GetFileName ( string strPath ) : string

Gets the file name of the specified file (full path). Example: if strPath is C:\\My Documents\\My File.kdb the returned string is My File.kdb.

GetFilePaths ( string strDir, string strPattern, SearchOption opt ) : List
GetHost ( string strUrl ) : string

Get the host component of an URL. This method is faster and more fault-tolerant than creating an Uri object and querying its Host property.

GetQuotedAppPath ( string strPath ) : string

Test if a specified path is accessible, either in read or write mode.

GetShortestAbsolutePath ( string strPath ) : string
GetTempPath ( ) : string
GetUrlLength ( string strText, int nOffset ) : int
HideFile ( string strFile, bool bHide ) : bool
IsAbsolutePath ( string strPath ) : bool
IsUncPath ( string strPath ) : bool
MakeAbsolutePath ( string strBaseFile, string strTargetFile ) : string
MakeRelativePath ( string strBaseFile, string strTargetFile ) : string
RemoveScheme ( string strUrl ) : string
StripExtension ( string strPath ) : string

Strip the extension of a file.

UnhideFile ( string strFile ) : bool

Method Details

AssemblyEquals() public static method

public static AssemblyEquals ( string strExt, string strShort ) : bool
strExt string
strShort string
return bool

ConvertSeparators() public static method

public static ConvertSeparators ( string strPath ) : string
strPath string
return string

ConvertSeparators() public static method

public static ConvertSeparators ( string strPath, char chSeparator ) : string
strPath string
chSeparator char
return string

EnsureTerminatingSeparator() public static method

Ensure that a path is terminated with a directory separator character.
public static EnsureTerminatingSeparator ( string strPath, bool bUrl ) : string
strPath string Input path.
bUrl bool If true, a slash (/) is appended to /// the string if it's not terminated already. If false, the /// default system directory separator character is used.
return string

FileUrlToPath() public static method

public static FileUrlToPath ( string strUrl ) : string
strUrl string
return string

FilterFileName() public static method

public static FilterFileName ( string strName ) : string
strName string
return string

GetExtension() public static method

Get the extension of a file.
public static GetExtension ( string strPath ) : string
strPath string Full path of a file with extension.
return string

GetFileDirectory() public static method

Get the directory (path) of a file name. The returned string may be terminated by a directory separator character. Example: passing C:\\My Documents\\My File.kdb in strFile and true to bAppendTerminatingChar would produce this string: C:\\My Documents\\.
public static GetFileDirectory ( string strFile, bool bAppendTerminatingChar, bool bEnsureValidDirSpec ) : string
strFile string Full path of a file.
bAppendTerminatingChar bool Append a terminating directory separator /// character to the returned path.
bEnsureValidDirSpec bool If true, the returned path /// is guaranteed to be a valid directory path (for example X:\\ instead /// of X:, overriding ). /// This should only be set to true, if the returned path is directly /// passed to some directory API.
return string

GetFileInfos() public static method

public static GetFileInfos ( DirectoryInfo di, string strPattern, SearchOption opt ) : List
di System.IO.DirectoryInfo
strPattern string
opt SearchOption
return List

GetFileName() public static method

Gets the file name of the specified file (full path). Example: if strPath is C:\\My Documents\\My File.kdb the returned string is My File.kdb.
public static GetFileName ( string strPath ) : string
strPath string Full path of a file.
return string

GetFilePaths() public static method

public static GetFilePaths ( string strDir, string strPattern, SearchOption opt ) : List
strDir string
strPattern string
opt SearchOption
return List

GetHost() public static method

Get the host component of an URL. This method is faster and more fault-tolerant than creating an Uri object and querying its Host property.
public static GetHost ( string strUrl ) : string
strUrl string
return string

GetQuotedAppPath() public static method

Test if a specified path is accessible, either in read or write mode.
public static GetQuotedAppPath ( string strPath ) : string
strPath string
return string

GetShortestAbsolutePath() public static method

public static GetShortestAbsolutePath ( string strPath ) : string
strPath string
return string

GetTempPath() public static method

public static GetTempPath ( ) : string
return string

GetUrlLength() public static method

public static GetUrlLength ( string strText, int nOffset ) : int
strText string
nOffset int
return int

HideFile() public static method

public static HideFile ( string strFile, bool bHide ) : bool
strFile string
bHide bool
return bool

IsAbsolutePath() public static method

public static IsAbsolutePath ( string strPath ) : bool
strPath string
return bool

IsUncPath() public static method

public static IsUncPath ( string strPath ) : bool
strPath string
return bool

MakeAbsolutePath() public static method

public static MakeAbsolutePath ( string strBaseFile, string strTargetFile ) : string
strBaseFile string
strTargetFile string
return string

MakeRelativePath() public static method

public static MakeRelativePath ( string strBaseFile, string strTargetFile ) : string
strBaseFile string
strTargetFile string
return string

RemoveScheme() public static method

public static RemoveScheme ( string strUrl ) : string
strUrl string
return string

StripExtension() public static method

Strip the extension of a file.
public static StripExtension ( string strPath ) : string
strPath string Full path of a file with extension.
return string

UnhideFile() public static method

public static UnhideFile ( string strFile ) : bool
strFile string
return bool