Assembly: Microsoft.ComponentStudio.ComponentPlatformInterface (in microsoft.componentstudio.componentplatforminterface.dll)
Usage
Visual Basic |
---|
Dim offlineImageInfo1 As New OfflineImageInfo() |
Syntax
Visual Basic |
---|
MustInherit Public Class OfflineImageInfo |
C# |
---|
public abstract class OfflineImageInfo |
C++ |
---|
public ref class OfflineImageInfo abstract |
J# |
---|
public abstract class OfflineImageInfo |
JScript |
---|
public abstract class OfflineImageInfo |
Example
In the following example, you define the path and the name of the Windows imaging file on the hard disk. You then retrieve and display several properties of the offline image. You also display the component items in this image.
Note: |
---|
To run this example, you must change the value of the variable
wimPath to the folder name that contains the .wim file
on your computer. |
// OfflineImageInfo.cs using System; using System.IO; using System.Collections.Generic; using System.Text; using Microsoft.ComponentStudio.ComponentPlatformInterface; namespace MyNameSpace { public class MyClass { static void Main() { // Define the .wim file path: string wimPath = @"C:\myWorkingFolder\install.wim"; // Create a Cpi instance: Cpi n = Cpi.Instance; // Check if the catalog file exists, if not // create one: WimInfo wimInfo = n.OpenWim(wimPath); wimInfo.Images[0].CreateCatalog(); // Open the offline image: OfflineImage image = n.OpenOfflineImage(wimInfo.Images[0]); // Display properties: Console.WriteLine("The image file:\t{0}", image.ToString()); Console.WriteLine("The image name:\t{0}", image.Name); Console.WriteLine("The catalog path:\t{0}", wimInfo.Images[0].CatalogPath); Console.WriteLine("The catalog extension:\t{0}", OfflineImageInfo.CatalogExtension); Console.WriteLine("The Windows directory name:\t{0}", wimInfo.Images[0].WindowsDirectoryName); Console.WriteLine( "The Windows System directory name:\t{0}", wimInfo.Images[0].WindowsSystemDirectoryName); Console.WriteLine("The image ID:\t{0}", wimInfo.Images[0].ImageId); Console.WriteLine("The component settings:\t{0}", image.ComponentSettings); Console.WriteLine("The component settings hash code:\t{0}", image.ComponentSettings.GetHashCode()); Console.WriteLine("The component settings count:\t{0}", image.ComponentSettings.Count); for (int i = 0; i <= image.ComponentSettings.Count - 1; i++) Console.WriteLine("The component item #{0}:\t{1}", i, image.ComponentSettings.GetItemByIndex(i)); } } } /* Output: The image file: Microsoft.ComponentStudio.ComponentPlatformInterface.OfflineImag eImpl The image name: Windows Vista ULTIMATE The catalog path: C:\myWorkingFolder\install_Windows Vista ULTIMATE.clg The catalog extension: .clg The Windows directory name: Windows The Windows System directory name: System32 The image ID: WIM:C:/MYWORKINGFOLDER/INSTALL.WIM#WINDOWS VISTA ULTIMATE The component settings: Microsoft.ComponentStudio.ComponentPlatformInterface.Rea dOnlyKeyedCollection`2[Microsoft.ComponentStudio.ComponentPlatformInterface.Iden tity,Microsoft.ComponentStudio.ComponentPlatformInterface.ComponentSetting] The component settings hash code: 46832420 The component settings count: 32 The component item #0: Microsoft-Windows-Audio-AudioCore The component item #1: Microsoft-Windows-BrowserService The component item #2: Microsoft-Windows-Deployment The component item #3: Microsoft-Windows-DNS-Client The component item #4: Microsoft-Windows-Dot3svc The component item #5: Microsoft-Windows-ehome-reg-inf The component item #6: Microsoft-Windows-Fax-Service The component item #7: Microsoft-Windows-feclient The component item #8: Microsoft-Windows-IE-ClientNetworkProtocolImplementation The component item #9: Microsoft-Windows-IE-InternetExplorer The component item #10: Microsoft-Windows-International-Core The component item #11: Microsoft-Windows-NDIS The component item #12: Microsoft-Windows-PnpCustomizationsNonWinPE The component item #13: Microsoft-Windows-PnpCustomizationsWinPE The component item #14: Microsoft-Windows-PnpSysprep The component item #15: Microsoft-Windows-RemoteAssistance-Exe The component item #16: Microsoft-Windows-Security-Licensing-SLC The component item #17: Microsoft-Windows-Security-Licensing-SLCC The component item #18: Microsoft-Windows-SecurityCenter-ControlPanel The component item #19: Microsoft-Windows-Setup The component item #20: Microsoft-Windows-Shell-Setup The component item #21: Microsoft-Windows-shwebsvc The component item #22: Microsoft-Windows-SMBServer The component item #23: Microsoft-Windows-SQMApi The component item #24: Microsoft-Windows-TCPIP The component item #25: Microsoft-Windows-TerminalServices-LocalSessionManager The component item #26: Microsoft-Windows-TerminalServices-RDP-WinStationExtensi ons The component item #27: Microsoft-Windows-UnattendedJoin The component item #28: Microsoft-Windows-WDF-Kernel Library The component item #29: Microsoft-Windows-WindowsUpdateClient-Core The component item #30: Microsoft-Windows-WorkstationService The component item #31: Networking-MPSSVC-Svc */ |
Remarks
There is a lot of overhead involved in opening an offline Windows image to obtain an instance of OfflineImage. For example, opening the image requires that a catalog (.clg) file matching the Windows image is present.
This class provides a quick way to view the basic information about an offline image without incurring a lot of overhead. It also provides methods to validate and generate the catalog file of the image.
Inheritance Hierarchy
System.Object
Microsoft.ComponentStudio.ComponentPlatformInterface.OfflineImageInfo
Microsoft.ComponentStudio.ComponentPlatformInterface.OfflineImageInfo
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.