Represents a Windows image (.wim) file. Namespace: Microsoft.ComponentStudio.ComponentPlatformInterface
Assembly: Microsoft.ComponentStudio.ComponentPlatformInterface (in microsoft.componentstudio.componentplatforminterface.dll)

Usage

Visual Basic
Dim wimInfo1 As WimInfo

Syntax

Visual Basic
NotInheritable Public Class WimInfo
C#
public sealed class WimInfo
C++
public ref class WimInfo sealed
J#
public final class WimInfo
JScript
public class WimInfo

Example

In this example, you find all of the .wim files in a specific directory and create a catalog for each image in the .wim file.

noteNote:
To run this example, change the name and the path of the current directory as needed.
noteNote:
The CreateCatalog method must be run under system administrator account with elevated privilege; otherwise, it throws InvalidOperationException.
// Wiminfo.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.ComponentStudio.ComponentPlatformInterface;

namespace CreateCatalogs
{
	class CreateCatalog
	{
		static void Main(string[] args)
		{
			// Define the current directory:
			string currentdir = @"C:\myWorkingFolder";

			// Get a list of .wim files in the current directory:
			string[] wimfiles = Directory.GetFiles(
				currentdir, @"*.wim");
				Console.WriteLine(
				"Number of .wim files in current directory: {0} ",
				wimfiles.Length);

			// Create loop for each .wim file:
			foreach (string wimfile in wimfiles)
			{
				// Write current directory and .wim file to 
				// the console:
				String wimpath = wimfile;
				Console.WriteLine(wimpath);

				// Create a new Cpi instance:
				WimInfo wimInfo = Cpi.Instance.OpenWim(wimpath);

				// Create loop for each image in the .wim file:
				foreach (OfflineImageInfo imageInfo in wimInfo.Images)
				{
					// Write Windows images to the console:
					Console.WriteLine(imageInfo.ImageName);
			}
				foreach (OfflineImageInfo imageInfo in wimInfo.Images)
				{
					Console.WriteLine("Creating catalog for: " +
					 imageInfo.ImageName);
					 // Create catalog:
					 imageInfo.CreateCatalog();
			}
		}
	}
}
}

/* Output:
Number of .wim files in current directory: 1
C:\myWorkingFolder\install.wim
Windows Vista ULTIMATE
Windows Vista BUSINESS
Windows Vista BUSINESSN
Windows Vista ENTERPRISE
Windows Vista HOMEBASICN
Windows Vista HOMEPREMIUM
Windows Vista STARTER
Creating catalog for: Windows Vista ULTIMATE
Creating catalog for: Windows Vista BUSINESS
Creating catalog for: Windows Vista BUSINESSN
Creating catalog for: Windows Vista ENTERPRISE
Creating catalog for: Windows Vista HOMEBASICN
Creating catalog for: Windows Vista HOMEPREMIUM
Creating catalog for: Windows Vista STARTER
*/

Inheritance Hierarchy

System.Object
  Microsoft.ComponentStudio.ComponentPlatformInterface.WimInfo

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Vista, and Windows 2000

Target Platforms

See Also