Class ShellUtils

Windows specific shell utility functions

System.Object
  Westwind.Utilities.ShellUtils
public static class ShellUtils : object

Class Members

MemberDescription

ExecuteCommandLine

Executes a Windows Command Line using Shell Execute as a single command line with parameters. This method handles parsing out the executable from the parameters.

public static void ExecuteCommandLine(string fullCommandLine,     string workingFolder,     int waitForExitMs,     string verb,     ProcessWindowStyle windowStyle,     bool useShellExecute)

ExecuteProcess

Executes a Windows process with given command line parameters

public static int ExecuteProcess(string executable,     string arguments,     int timeoutMs,     ProcessWindowStyle windowStyle)

public static int ExecuteProcess(string executable,     string arguments,     int timeoutMs,     ref StringBuilder output,     ProcessWindowStyle windowStyle,     Action completionDelegate)

public static int ExecuteProcess(string executable,     string arguments,     int timeoutMs,     Action writeDelegate,     ProcessWindowStyle windowStyle,     Action completionDelegate)

GoUrl

Uses the Shell Extensions to launch a program based on URL moniker or file name Basically a wrapper around ShellExecute

public static bool GoUrl(string url,     string workingFolder)

HttpGet

Simple method to retrieve HTTP content from the Web quickly

public static string HttpGet(string url)

public static string HttpGet(string url,     ref string errorMessage)

HttpGetBytes

Retrieves a buffer of binary data from a URL using a plain HTTP Get.

public static Byte[] HttpGetBytes(string url)

public static Byte[] HttpGetBytes(string url,     ref string errorMessage)

OpenFileInExplorer

Opens a File or Folder in Explorer. If the path is a file Explorer is opened in the parent folder with the file selected

public static bool OpenFileInExplorer(string filename)

OpenTerminal

Opens a Terminal window in the specified folder

public static bool OpenTerminal(string folder,     TerminalModes mode)

OpenUrl

Opens a URL in the browser. This version is specific to opening a URL in a browser and it's cross platform enabled.

public static bool OpenUrl(string url)

ShellExecute

Wrapper around the Shell Execute API. Windows specific.

public static int ShellExecute(string url,     string arguments,     string workingFolder,     string verb)

ShowHtml

Shows a string as HTML

public static bool ShowHtml(string htmlString)

ShowString

Displays a string in in a browser as HTML. Optionally provide an alternate extension to display in the appropriate text viewer (ie. "txt" likely shows in NotePad)

public static bool ShowString(string text,     string extension)

ShowText

Displays a large Text string as a text file in the systems' default text viewer (ie. NotePad)

public static bool ShowText(string TextString)

Requirements

Namespace: Westwind.Utilities
Assembly: westwind.utilities.dll

© West Wind Technologies, 1996-2024 • Updated: 06/29/24
Comment or report problem with topic