C# Класс GitForce.ClassUtils

Contains various utility functions
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddEnvar ( string name, string value ) : void

Adds an environment variable for the Run method

CommandPromptHere ( string where ) : void

Open a command prompt at the specific directory

DeleteFile ( string name ) : bool

Deletes a file from the local file system. Returns true if delete succeeded, false otherwise.

DeleteFolder ( DirectoryInfo dirInfo, bool fPreserveGit, bool fPreserveRootFolder ) : bool

Remove given folder and all files and subfolders under it. If fPreserveGit is true, all folders that are named ".git" will be preserved (not removed) If fPreserveRootFolder is true, the first (root) folder will also be preserved Return false if the function could not remove all folders, true otherwise.

DirStat ( string path ) : DirStatType

Given a fully qualified path to a local directory, return the stat on that folder

ExecuteShellCommand ( string cmd, string args ) : string

Executes a shell command

ExplorerHere ( string where, string selFile ) : void

Open a file browser/Explorer at the specific directory, optionally selecting a file

FileDoubleClick ( string file ) : void

Handle double-clicking on a file. Depending on the saved options, we either do nothing ("0"), open a file using a default Explorer file association ("1"), or open a file using a specified application ("2")

FileOpenFromMenu ( object sender, string file ) : void

Edit selected file using either the default editor (native OS file association, if the tag is null, or the editor program specified in the tag field. This is a handler for the context menu, edit tool bar button and also revision history view menus.

GetEnvars ( ) : string>.Dictionary

Returns a set of environment variables registered for this execution environment

GetHomePath ( ) : string

Retruns a path to the home directory.

GetShellExecCmd ( ) : string

Returns CMD/SHELL executable name to execute a command line command

GetShellExecFlags ( ) : string

Returns a string to be used by CMD/SHELL as argument when executing a command line command

GetShortPathName ( string path ) : string

This function is meaningful only on Windows: Given a long file path name, return its short version. This is used mainly to avoid various problems with paths containing spaces and the inability of git to handle them.

IsMono ( ) : bool

Returns true if the app is running on Mono (Linux), false if it is Windows

IsNullOrWhiteSpace ( string s ) : bool

Identical to NET4.0 IsNullOrWhiteSpace()

OpenWebLink ( string html ) : void

Open an HTML link in an external web browser application.

ToPlainAscii ( string s ) : string

Returns a copy of the input string, but with all non-ASCII characters stripped down. This function also removes ANSI escape codes from the string.

UpgradeApplicationSettingsIfNecessary ( ) : void

Upgrades the application settings to a new version, if necessary http://stackoverflow.com/questions/10121044/app-loses-all-settings-when-app-update-is-installed

WriteResourceToFile ( string pathName, string fileName, byte buffer ) : string

Writes binary resource to a temporary file

Приватные методы

Метод Описание
DeleteFolder ( DirectoryInfo dirInfo ) : bool

Deletes a folder from the local file system. Returns true if delete succeeded, false otherwise.

Описание методов

AddEnvar() публичный статический Метод

Adds an environment variable for the Run method
public static AddEnvar ( string name, string value ) : void
name string
value string
Результат void

CommandPromptHere() публичный статический Метод

Open a command prompt at the specific directory
public static CommandPromptHere ( string where ) : void
where string
Результат void

DeleteFile() публичный статический Метод

Deletes a file from the local file system. Returns true if delete succeeded, false otherwise.
public static DeleteFile ( string name ) : bool
name string
Результат bool

DeleteFolder() публичный статический Метод

Remove given folder and all files and subfolders under it. If fPreserveGit is true, all folders that are named ".git" will be preserved (not removed) If fPreserveRootFolder is true, the first (root) folder will also be preserved Return false if the function could not remove all folders, true otherwise.
public static DeleteFolder ( DirectoryInfo dirInfo, bool fPreserveGit, bool fPreserveRootFolder ) : bool
dirInfo System.IO.DirectoryInfo
fPreserveGit bool
fPreserveRootFolder bool
Результат bool

DirStat() публичный статический Метод

Given a fully qualified path to a local directory, return the stat on that folder
public static DirStat ( string path ) : DirStatType
path string
Результат DirStatType

ExecuteShellCommand() публичный статический Метод

Executes a shell command
public static ExecuteShellCommand ( string cmd, string args ) : string
cmd string
args string
Результат string

ExplorerHere() публичный статический Метод

Open a file browser/Explorer at the specific directory, optionally selecting a file
public static ExplorerHere ( string where, string selFile ) : void
where string
selFile string
Результат void

FileDoubleClick() публичный статический Метод

Handle double-clicking on a file. Depending on the saved options, we either do nothing ("0"), open a file using a default Explorer file association ("1"), or open a file using a specified application ("2")
public static FileDoubleClick ( string file ) : void
file string
Результат void

FileOpenFromMenu() публичный статический Метод

Edit selected file using either the default editor (native OS file association, if the tag is null, or the editor program specified in the tag field. This is a handler for the context menu, edit tool bar button and also revision history view menus.
public static FileOpenFromMenu ( object sender, string file ) : void
sender object
file string
Результат void

GetEnvars() публичный статический Метод

Returns a set of environment variables registered for this execution environment
public static GetEnvars ( ) : string>.Dictionary
Результат string>.Dictionary

GetHomePath() публичный статический Метод

Retruns a path to the home directory.
public static GetHomePath ( ) : string
Результат string

GetShellExecCmd() публичный статический Метод

Returns CMD/SHELL executable name to execute a command line command
public static GetShellExecCmd ( ) : string
Результат string

GetShellExecFlags() публичный статический Метод

Returns a string to be used by CMD/SHELL as argument when executing a command line command
public static GetShellExecFlags ( ) : string
Результат string

GetShortPathName() публичный статический Метод

This function is meaningful only on Windows: Given a long file path name, return its short version. This is used mainly to avoid various problems with paths containing spaces and the inability of git to handle them.
public static GetShortPathName ( string path ) : string
path string
Результат string

IsMono() публичный статический Метод

Returns true if the app is running on Mono (Linux), false if it is Windows
public static IsMono ( ) : bool
Результат bool

IsNullOrWhiteSpace() публичный статический Метод

Identical to NET4.0 IsNullOrWhiteSpace()
public static IsNullOrWhiteSpace ( string s ) : bool
s string
Результат bool

OpenWebLink() публичный статический Метод

Open an HTML link in an external web browser application.
public static OpenWebLink ( string html ) : void
html string
Результат void

ToPlainAscii() публичный статический Метод

Returns a copy of the input string, but with all non-ASCII characters stripped down. This function also removes ANSI escape codes from the string.
public static ToPlainAscii ( string s ) : string
s string
Результат string

UpgradeApplicationSettingsIfNecessary() публичный статический Метод

Upgrades the application settings to a new version, if necessary http://stackoverflow.com/questions/10121044/app-loses-all-settings-when-app-update-is-installed
public static UpgradeApplicationSettingsIfNecessary ( ) : void
Результат void

WriteResourceToFile() публичный статический Метод

Writes binary resource to a temporary file
public static WriteResourceToFile ( string pathName, string fileName, byte buffer ) : string
pathName string
fileName string
buffer byte
Результат string