Skip to content

ResourceCollection Class

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

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.
PropertyDescription
CountGets the number of resources in the collection.
ItemGets or sets the element at the specified index.

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+41e11442b2ca93e444b60213b5ae99dcbab787d8

Adds a new item to the collection.

public void Add(
Resource item
)
ParameterTypeDescription
itemResourceThe Resource to add.

Removes all resources from the collection.

public void Clear()

Tests if the collection contains an item.

public bool Contains(
Resource item
)
ParameterTypeDescription
itemResourceThe Resource to search for.

bool true if the item is found; false otherwise

Copies the collection into an array.

public void CopyTo(
Resource[] array,
int arrayIndex
)
ParameterTypeDescription
arrayResource[]The array to copy into.
arrayIndexintThe starting index in the destination array.

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.

public void Find(
string resFile
)
ParameterTypeDescription
resFilestringThe file to be searched for resources.
ExceptionDescription
T:System.IO.IOExceptionresources could not be read from the file

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.

public void Find(
string resFile,
ResourceType type
)
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.
ExceptionDescription
T:System.IO.IOExceptionresources could not be read from the file

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.

public void Find(
string resFile,
ResourceType type,
string name
)
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.
ExceptionDescription
T:System.IO.IOExceptionresources could not be read from the file

Gets an enumerator over all resources in the collection.

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

Gets the index of an item in the collection.

public int IndexOf(
Resource item
)
ParameterTypeDescription
itemResourceThe Resource to search for.

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

Inserts a item into the collection.

public void Insert(
int index,
Resource item
)
ParameterTypeDescription
indexintThe insertion index.
itemResourceThe Resource to insert.

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

public void Load(
string file
)
ParameterTypeDescription
filestringThe file from which resources are loaded.

Removes an item to the collection.

public bool Remove(
Resource item
)
ParameterTypeDescription
itemResourceThe Resource to remove.

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

public void Save(
string file
)
ParameterTypeDescription
filestringThe file to which resources are saved.

Gets the number of resources in the collection.

public int Count { get; set; }

Gets or sets the element at the specified index.

public Resource Item { get; set; }