예제 #1
0
 /// <summary>
 /// Enables a feature from the specified package name.
 /// </summary>
 /// <param name="session">A valid DISM Session. The DISM Session must be associated with an image. You can associate a session with an image by using the DismOpenSession Function.</param>
 /// <param name="featureName">The name of the feature that is being enabled. To enable more than one feature, separate each feature name with a semicolon.</param>
 /// <param name="packageName">The name of the package that contains the feature.</param>
 /// <param name="limitAccess">Specifies whether Windows Update (WU) should be contacted as a source location for downloading files if none are found in other specified locations. Before checking WU, DISM will check for the files in the SourcePaths provided and in any locations specified in the registry by group policy. If the files required to enable the feature are still present on the computer, this flag is ignored.</param>
 /// <param name="enableAll">Specifies whether to enable all dependencies of the feature. If the specified feature or any one of its dependencies cannot be enabled, none of them will be changed from their existing state.</param>
 /// <param name="sourcePaths">A list of source locations to check for files needed to enable the feature.</param>
 /// <param name="progressCallback">A progress callback method to invoke when progress is made.</param>
 /// <param name="userData">Optional user data to pass to the DismProgressCallback method.</param>
 /// <exception cref="DismException">When a failure occurs.</exception>
 /// <exception cref="OperationCanceledException">When the user requested the operation be canceled.</exception>
 /// <exception cref="DismRebootRequiredException">When the operation requires a reboot to complete.</exception>
 public static void EnableFeatureByPackageName(DismSession session, string featureName, string packageName, bool limitAccess, bool enableAll, List <string> sourcePaths, Microsoft.Dism.DismProgressCallback progressCallback, object userData)
 {
     DismApi.EnableFeature(session, featureName, packageName, DismPackageIdentifier.Name, limitAccess, enableAll, sourcePaths, progressCallback, userData);
 }