C# Class Open.Core.Common.StringExtensions

Datei anzeigen Open project: philcockfield/Open.TestHarness.SL

Public Methods

Method Description
GetFolder ( string folderPath ) : DirectoryInfo
ToComponentUri ( this resourcePath ) : Uri

Converts the path to a resource into a fully qualified component URI using the calling assembly (eg "/assembly;component/Images/MyImage.png").

ToComponentUri ( this resourcePath, Assembly assembly ) : Uri

Converts the path to a resource into a fully qualified component URI (eg "/assembly;component/Images/MyImage.png").

ToImage ( this source ) : System.Image

Converts the given source to an Image.

ToImage ( this url, UriKind uriKind ) : System.Image

Creates an image setting the 'Source' to the specified image path.

To load images dynamicaly from the server use the following settings:
1. UriKind = Relative.
2. Prefix the URL with a '/' (eg. /Images/Logo.png).
3. If storing the images in the calling project set the image BuildAction = 'None' and Copy to Output Directory = 'Copy always'
Look for the image in the 'bin' directory. 3. Copy the images to the 'ClientBin' folder of the hosting web-site.

ToImageSource ( this resourcePath ) : BitmapImage

Converts the path to a resource into a fully qualified component URI (eg "/assembly;component/Images/MyImage.png") and loads it into a bitmap image which can be used as the 'Source' of an Image.

ToImageSource ( this resourcePath, Assembly assembly ) : BitmapImage

Converts the path to a resource into a fully qualified component URI (eg "/assembly;component/Images/MyImage.png") and loads it into a bitmap image which can be used as the 'Source' of an Image.

ToImageSource ( this resourcePath, ImageLocation location ) : BitmapImage

Converts the path to a resource into bitmap image which can be used as the 'Source' of an Image.

ToPathGeometry ( this self ) : Path

Loads the given geometry data string as a XAML Path..

Don't forget to set the Fill and Stretch properties on the returned object.

WriteToProjectFile ( this content, string folder, string fileName ) : void

Writes the given string to a file within the executing application's folder.

Private Methods

Method Description
GetApplicationPath ( ) : string
GetMatchingDirectory ( DirectoryInfo start, string name ) : DirectoryInfo

Method Details

GetFolder() public static method

public static GetFolder ( string folderPath ) : DirectoryInfo
folderPath string
return System.IO.DirectoryInfo

ToComponentUri() public static method

Converts the path to a resource into a fully qualified component URI using the calling assembly (eg "/assembly;component/Images/MyImage.png").
public static ToComponentUri ( this resourcePath ) : Uri
resourcePath this /// The path to the resource from the root of the project.
/// This may, or may not, contain a leading '/' character.
/// For example: "Images/MyImage.png"
///
return System.Uri

ToComponentUri() public static method

Converts the path to a resource into a fully qualified component URI (eg "/assembly;component/Images/MyImage.png").
public static ToComponentUri ( this resourcePath, Assembly assembly ) : Uri
resourcePath this /// The path to the resource from the root of the project.
/// This may, or may not, contain a leading '/' character.
/// For example: "Images/MyImage.png"
///
assembly System.Reflection.Assembly The assembly the resource is within.
return System.Uri

ToImage() public static method

Converts the given source to an Image.
public static ToImage ( this source ) : System.Image
source this The source of the image.
return System.Image

ToImage() public static method

Creates an image setting the 'Source' to the specified image path.
To load images dynamicaly from the server use the following settings:
1. UriKind = Relative.
2. Prefix the URL with a '/' (eg. /Images/Logo.png).
3. If storing the images in the calling project set the image BuildAction = 'None' and Copy to Output Directory = 'Copy always'
Look for the image in the 'bin' directory. 3. Copy the images to the 'ClientBin' folder of the hosting web-site.
public static ToImage ( this url, UriKind uriKind ) : System.Image
url this The URL path to the image.
uriKind UriKind The kind of URI passed in the 'url' string.
return System.Image

ToImageSource() public static method

Converts the path to a resource into a fully qualified component URI (eg "/assembly;component/Images/MyImage.png") and loads it into a bitmap image which can be used as the 'Source' of an Image.
public static ToImageSource ( this resourcePath ) : BitmapImage
resourcePath this /// The path to the resource from the root of the project.
/// This may, or may not, contain a leading '/' character.
/// For example: "Images/MyImage.png"
///
return BitmapImage

ToImageSource() public static method

Converts the path to a resource into a fully qualified component URI (eg "/assembly;component/Images/MyImage.png") and loads it into a bitmap image which can be used as the 'Source' of an Image.
public static ToImageSource ( this resourcePath, Assembly assembly ) : BitmapImage
resourcePath this /// The path to the resource from the root of the project.
/// This may, or may not, contain a leading '/' character.
/// For example: "Images/MyImage.png"
///
assembly System.Reflection.Assembly The assembly the resource is within.
return BitmapImage

ToImageSource() public static method

Converts the path to a resource into bitmap image which can be used as the 'Source' of an Image.
public static ToImageSource ( this resourcePath, ImageLocation location ) : BitmapImage
resourcePath this /// The path to the resource from the root of the project or the root of the ClientBin (depending on 'location').
///
location ImageLocation Flag indicating whether the image is packaged in the XAP on the client, or is in the ClientBin on the server.
return BitmapImage

ToPathGeometry() public static method

Loads the given geometry data string as a XAML Path..
Don't forget to set the Fill and Stretch properties on the returned object.
public static ToPathGeometry ( this self ) : Path
self this The geometry data.
return System.IO.Path

WriteToProjectFile() public static method

Writes the given string to a file within the executing application's folder.
public static WriteToProjectFile ( this content, string folder, string fileName ) : void
content this The content to write.
folder string The path of the folder (starting at the name of the project folder).
fileName string The name of the file
return void