C# Class GitForce.ClassUtils

Contains various utility functions
Afficher le fichier Open project: gdevic/GitForce Class Usage Examples

Méthodes publiques

Méthode Description
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

Private Methods

Méthode Description
DeleteFolder ( DirectoryInfo dirInfo ) : bool

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

Method Details

AddEnvar() public static méthode

Adds an environment variable for the Run method
public static AddEnvar ( string name, string value ) : void
name string
value string
Résultat void

CommandPromptHere() public static méthode

Open a command prompt at the specific directory
public static CommandPromptHere ( string where ) : void
where string
Résultat void

DeleteFile() public static méthode

Deletes a file from the local file system. Returns true if delete succeeded, false otherwise.
public static DeleteFile ( string name ) : bool
name string
Résultat bool

DeleteFolder() public static méthode

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
Résultat bool

DirStat() public static méthode

Given a fully qualified path to a local directory, return the stat on that folder
public static DirStat ( string path ) : DirStatType
path string
Résultat DirStatType

ExecuteShellCommand() public static méthode

Executes a shell command
public static ExecuteShellCommand ( string cmd, string args ) : string
cmd string
args string
Résultat string

ExplorerHere() public static méthode

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
Résultat void

FileDoubleClick() public static méthode

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
Résultat void

FileOpenFromMenu() public static méthode

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
Résultat void

GetEnvars() public static méthode

Returns a set of environment variables registered for this execution environment
public static GetEnvars ( ) : string>.Dictionary
Résultat string>.Dictionary

GetHomePath() public static méthode

Retruns a path to the home directory.
public static GetHomePath ( ) : string
Résultat string

GetShellExecCmd() public static méthode

Returns CMD/SHELL executable name to execute a command line command
public static GetShellExecCmd ( ) : string
Résultat string

GetShellExecFlags() public static méthode

Returns a string to be used by CMD/SHELL as argument when executing a command line command
public static GetShellExecFlags ( ) : string
Résultat string

GetShortPathName() public static méthode

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
Résultat string

IsMono() public static méthode

Returns true if the app is running on Mono (Linux), false if it is Windows
public static IsMono ( ) : bool
Résultat bool

IsNullOrWhiteSpace() public static méthode

Identical to NET4.0 IsNullOrWhiteSpace()
public static IsNullOrWhiteSpace ( string s ) : bool
s string
Résultat bool

OpenWebLink() public static méthode

Open an HTML link in an external web browser application.
public static OpenWebLink ( string html ) : void
html string
Résultat void

ToPlainAscii() public static méthode

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
Résultat string

UpgradeApplicationSettingsIfNecessary() public static méthode

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
Résultat void

WriteResourceToFile() public static méthode

Writes binary resource to a temporary file
public static WriteResourceToFile ( string pathName, string fileName, byte buffer ) : string
pathName string
fileName string
buffer byte
Résultat string