Skip to main content

ResourceCollection Class

Allows reading and editing of resource data in a Win32 PE file.

Methods

MethodDescription
Add(item)Adds a new item to the collection.
Clear()Removes all resources from the collection.
Contains(item)Tests if the collection contains an item.
CopyTo(array, arrayIndex)Copies the collection into an array.
Find(resFile)Locates all resources in a file, including all resource types and languages. For each located resource, a «see T:WixToolset.Dtf.Resources.Resource» instance (or subclass) is added to the collection.
Find(resFile, type)Locates all resources in a file of a given type, including all languages. For each located resource, a «see T:WixToolset.Dtf.Resources.Resource» instance (or subclass) is added to the collection.
Find(resFile, type, name)Locates all resources in a file of a given type and language. For each located resource, a «see T:WixToolset.Dtf.Resources.Resource» instance (or subclass) is added to the collection.
GetEnumerator()Gets an enumerator over all resources in the collection.
IndexOf(item)Gets the index of an item in the collection.
Insert(index, item)Inserts a item into the collection.
Load(file)For all resources in the collection, loads their data from a resource file.
Remove(item)Removes an item to the collection.
Save(file)For all resources in the collection, saves their data to a resource file.

Properties

PropertyDescription
CountGets the number of resources in the collection.
ItemGets or sets the element at the specified index.

Remarks

To use this class:

  • Create a new ResourceCollection
  • Locate resources for the collection by calling one of the «see M:WixToolset.Dtf.Resources.ResourceCollection.Find(System.String)» methods
  • Load data of one or more «see T:WixToolset.Dtf.Resources.Resource» s from a file by calling the «see M:WixToolset.Dtf.Resources.ResourceCollection.Load(System.String)» method of the Resource class, or load them all at once (more efficient) with the «see M:WixToolset.Dtf.Resources.ResourceCollection.Load(System.String)» method of the ResourceCollection.
  • Read and/or edit data of the individual Resource objects using the methods on that class.
  • Save data of one or more «see T:WixToolset.Dtf.Resources.Resource» s to a file by calling the «see M:WixToolset.Dtf.Resources.ResourceCollection.Save(System.String)» method of the Resource class, or save them all at once (more efficient) with the «see M:WixToolset.Dtf.Resources.ResourceCollection.Save(System.String)» method of the ResourceCollection.

WixToolset.Dtf.Resources.dll version 5.0.0-rc.2+dbb148c20d2490cf85f3f62f7d59f8dbc5c1a2c5

Add(item) Method

Adds a new item to the collection.

Declaration

public void Add(
Resource item
)

Parameters

ParameterTypeDescription
itemResourceThe Resource to add.

Clear() Method

Removes all resources from the collection.

Declaration

public void Clear()

Contains(item) Method

Tests if the collection contains an item.

Declaration

public bool Contains(
Resource item
)

Parameters

ParameterTypeDescription
itemResourceThe Resource to search for.

Return value

bool true if the item is found; false otherwise

CopyTo(array, arrayIndex) Method

Copies the collection into an array.

Declaration

public void CopyTo(
Resource[] array,
int arrayIndex
)

Parameters

ParameterTypeDescription
arrayResource[]The array to copy into.
arrayIndexintThe starting index in the destination array.

Find(resFile) Method

Locates all resources in a file, including all resource types and languages. For each located resource, a «see T:WixToolset.Dtf.Resources.Resource» instance (or subclass) is added to the collection.

Declaration

public void Find(
string resFile
)

Parameters

ParameterTypeDescription
resFilestringThe file to be searched for resources.

Exceptions

ExceptionDescription
T:System.IO.IOExceptionresources could not be read from the file

Find(resFile, type) Method

Locates all resources in a file of a given type, including all languages. For each located resource, a «see T:WixToolset.Dtf.Resources.Resource» instance (or subclass) is added to the collection.

Declaration

public void Find(
string resFile,
ResourceType type
)

Parameters

ParameterTypeDescription
resFilestringThe file to be searched for resources.
typeResourceTypeThe type of resource to search for; may be one of the ResourceType constants or a user-defined type.

Exceptions

ExceptionDescription
T:System.IO.IOExceptionresources could not be read from the file

Find(resFile, type, name) Method

Locates all resources in a file of a given type and language. For each located resource, a «see T:WixToolset.Dtf.Resources.Resource» instance (or subclass) is added to the collection.

Declaration

public void Find(
string resFile,
ResourceType type,
string name
)

Parameters

ParameterTypeDescription
resFilestringThe file to be searched for resources.
typeResourceTypeThe type of resource to search for; may be one of the ResourceType constants or a user-defined type.
namestringThe name of the resource to search for.

Exceptions

ExceptionDescription
T:System.IO.IOExceptionresources could not be read from the file

GetEnumerator() Method

Gets an enumerator over all resources in the collection.

Declaration

public IEnumerator<WixToolset.Dtf.Resources.Resource> GetEnumerator()

IndexOf(item) Method

Gets the index of an item in the collection.

Declaration

public int IndexOf(
Resource item
)

Parameters

ParameterTypeDescription
itemResourceThe Resource to search for.

Return value

int The index of the item, or -1 if not found.

Insert(index, item) Method

Inserts a item into the collection.

Declaration

public void Insert(
int index,
Resource item
)

Parameters

ParameterTypeDescription
indexintThe insertion index.
itemResourceThe Resource to insert.

Load(file) Method

For all resources in the collection, loads their data from a resource file.

Declaration

public void Load(
string file
)

Parameters

ParameterTypeDescription
filestringThe file from which resources are loaded.

Remove(item) Method

Removes an item to the collection.

Declaration

public bool Remove(
Resource item
)

Parameters

ParameterTypeDescription
itemResourceThe Resource to remove.

Save(file) Method

For all resources in the collection, saves their data to a resource file.

Declaration

public void Save(
string file
)

Parameters

ParameterTypeDescription
filestringThe file to which resources are saved.

Count Property

Gets the number of resources in the collection.

Declaration

public int Count { get; set; } 

Item Property

Gets or sets the element at the specified index.

Declaration

public Resource Item { get; set; }