Class Extensions
Extensions methods.
Inheritance
Inherited Members
Namespace: Unify.Framework.Installer.Wix
Assembly: Unify.Framework.Installer.Wix.dll
Syntax
public static class Extensions
Methods
Add<T>(Array, T)
Adds/combines given System.Array object with the specified item.
Declaration
public static T[] Add<T>(this Array obj, T item)
Parameters
Type | Name | Description |
---|---|---|
System.Array | obj | The instance of the System.Array. |
T | item | The item to be added. |
Returns
Type | Description |
---|---|
T[] | Combined System.Array object. |
Type Parameters
Name | Description |
---|---|
T | The type of the elements of |
AddElement(XContainer, XElement)
Adds the element to a given XML element. It is a Fluent version of System.Xml.Linq.XContainer.Add(System.Object[]).
Declaration
public static XElement AddElement(this XContainer obj, XElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.Linq.XContainer | obj | The instance of the System.Xml.Linq.XElement. |
System.Xml.Linq.XElement | element | Element to add. |
Returns
Type | Description |
---|---|
System.Xml.Linq.XElement | Added System.Xml.Linq.XElement. |
AllElements(XElement, String)
Flattened "view" of all element with a given name.
Declaration
public static XElement[] AllElements(this XElement element, string elementName)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.Linq.XElement | element | The element to be searched. |
System.String | elementName | The element name. |
Returns
Type | Description |
---|---|
System.Xml.Linq.XElement[] | The elements matching the name. |
BuildWixDirectory(DirectoryInfo, String)
Recursively build wix directories from given directory.
Declaration
public static WixDirectory BuildWixDirectory(this DirectoryInfo directory, string rootDirectoryName = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.DirectoryInfo | directory | The directory to be built from. |
System.String | rootDirectoryName | The name of the root directory. Use |
Returns
Type | Description |
---|---|
WixDirectory | A wix directory structure. |
Combine<T>(List<T>, List<T>)
Combines given System.Collections.Generic.List<T> items with items of another System.Collections.Generic.List<T>.
Declaration
public static List<T> Combine<T>(this List<T> obj, List<T> items)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<T> | obj | A System.Collections.Generic.List<T> whose elements to combine. |
System.Collections.Generic.List<T> | items | Another instance of System.Collections.Generic.List<T> whose elements to combine with |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<T> | A combined System.Collections.Generic.List<T>. |
Type Parameters
Name | Description |
---|---|
T | The type of the elements of |
Expand(String)
Replaces all Wix# predefined string constants in the Wix# directory path with their WiX equivalents.
Processed string can be used as an WixId for referencing from other Wix# components.
Declaration
public static string Expand(this string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The Wix# directory path. |
Returns
Type | Description |
---|---|
System.String | Replacement result. |
ExpandCommandPath(String)
Expands a command path.
Declaration
public static string ExpandCommandPath(this string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path to be expanded. |
Returns
Type | Description |
---|---|
System.String | The returned, expanded path. |
ExpandDirectory(String)
Expands a directory string.
Declaration
public static string ExpandDirectory(this string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path to be expanded. |
Returns
Type | Description |
---|---|
System.String | The returned, expanded path. |
Format(String, Object[])
Formats the specified string.
Declaration
public static string Format(this string obj, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.String | obj | The string to format. |
System.Object[] | args | The formatting arguments. |
Returns
Type | Description |
---|---|
System.String | The formatted string. |
GetLeftIndent(String)
Returns all leading white-space characters.
Declaration
public static int GetLeftIndent(this string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | The string to analyse. |
Returns
Type | Description |
---|---|
System.Int32 | Total count of leading white-space characters |
GetNamespacedElement(String)
Creates an System.Xml.Linq.XElement using the given elementName
.
Declaration
public static XElement GetNamespacedElement(this string elementName)
Parameters
Type | Name | Description |
---|---|---|
System.String | elementName | The name of the element, that may contain a namespace. |
Returns
Type | Description |
---|---|
System.Xml.Linq.XElement | An System.Xml.Linq.XElement including the given namespace. |
GetWType(Object)
Gets WiX compatible type name of the CLR System.Object.
This method should be used to generate string value of the RegistryValue.Type
attribute.
Declaration
public static string GetWType(this object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The instance of the System.Object. |
Returns
Type | Description |
---|---|
System.String | The WiX compatible type name. |
GetYesNoString(Boolean)
Gets the WiX representation YesNoType from a System.Boolean.
Declaration
public static string GetYesNoString(this bool value)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | value | The value being converted. |
Returns
Type | Description |
---|---|
System.String | The WiX YesNoType. |
IsEmpty(String)
Determines whether the given string is empty.
Declaration
public static bool IsEmpty(this string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | The string to analyse. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsNullOrEmpty(String)
Fluent version of the System.String.IsNullOrEmpty(System.String) for analysing the string value
for being null
or empty.
Declaration
public static bool IsNullOrEmpty(this string obj)
Parameters
Type | Name | Description |
---|---|---|
System.String | obj | A System.String whose value to analyse. |
Returns
Type | Description |
---|---|
System.Boolean | true if the value parameter is null or an empty string (""); otherwise, false. |
LastCharacters(String, Int32)
Takes the last maxLength
characters of value
.
Declaration
public static string LastCharacters(this string value, int maxLength)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The string to be reduced in length. |
System.Int32 | maxLength | The maximum length of the string. |
Returns
Type | Description |
---|---|
System.String | The last number of characters if greater than a certain length. |
Select(XContainer, String)
Selects from the given element the first child element matching the specified path (e.g. Select("Product/Package")
).
Declaration
public static XElement Select(this XContainer element, string path)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.Linq.XContainer | element | The element to be searched. |
System.String | path | The path. |
Returns
Type | Description |
---|---|
System.Xml.Linq.XElement | The element matching the path. |
SelectOrCreate(XContainer, String)
Selects from the given element child element matching the specified path.
If the child element is not found it creates new element matching the path.
Declaration
public static XElement SelectOrCreate(this XContainer element, string path)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.Linq.XContainer | element | The element to be searched. |
System.String | path | The path. |
Returns
Type | Description |
---|---|
System.Xml.Linq.XElement | The element matching the path. |
ToFullPath(String)
Converts the given string path into the full path.
Declaration
public static string ToFullPath(this string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | The string path. |
Returns
Type | Description |
---|---|
System.String | The full string path |
ToMajorMinorString(Version)
Generates string representation with major and minor version parts.
Declaration
public static string ToMajorMinorString(this Version version)
Parameters
Type | Name | Description |
---|---|---|
System.Version | version | The instance of the System.Version. |
Returns
Type | Description |
---|---|
System.String | Version string. |
ToNoRevisionString(Version)
Generates string representation without revision part.
Declaration
public static string ToNoRevisionString(this Version ver)
Parameters
Type | Name | Description |
---|---|---|
System.Version | ver | The instance of the System.Version. |
Returns
Type | Description |
---|---|
System.String | System.String |
ToPublishedDirID(String)
Replaces all Wix# predefined string constants in the Wix# directory path with their WiX equivalents. Also it converts the result string into uppercase (MSI "publishing" model).
Processed string can be used as an WixId for referencing from other Wix# components and setting the
corresponding path from MsiExec.exe
command line.
Declaration
public static string ToPublishedDirID(this string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The Wix# directory path. |
Returns
Type | Description |
---|---|
System.String | Replacement/conversion result. |
ToWString(RegistryHive)
Gets WiX compatible string representation (e.g. HKCR, HKLM).
Declaration
public static string ToWString(this RegistryHive value)
Parameters
Type | Name | Description |
---|---|---|
RegistryHive | value | The Microsoft.Win32.RegistryHive value to convert. |
Returns
Type | Description |
---|---|
System.String | WiX compatible string representation. |