示例#1
0
 /// <summary>
 /// Adds the new folder to the setup project
 /// with the given parameters
 /// </summary>
 public override void Execute()
 {
     try
     {
         IVsdDeployable       deployable   = (IVsdDeployable)SetupProject.Object;
         IVsdCollectionSubset plugins      = deployable.GetPlugIns();
         IVsdFolderPlugIn     folderPlugin = plugins.Item("Folder") as IVsdFolderPlugIn;
         if (folderPlugin != null)
         {
             vsdFolder =
                 (IVsdCustomFolder)DteHelper.CoCreateInstance(
                     this.Site,
                     typeof(VsdCustomFolderClass),
                     typeof(IVsdCustomFolder));
             vsdFolder.Name            = FolderName;
             vsdFolder.Property_2      = this.Property;
             vsdFolder.DefaultLocation = this.DefaultLocation;
             folderPlugin.Items.Add(vsdFolder);
         }
     }
     catch (Exception)
     {
         vsdFolder = null;
         throw;
     }
 }
示例#2
0
 /// <summary>
 /// Removes the folder that was created by the
 /// execution of the action
 /// </summary>
 public override void Undo()
 {
     if (vsdFolder != null)
     {
         IVsdDeployable       deployable   = (IVsdDeployable)SetupProject.Object;
         IVsdCollectionSubset plugins      = deployable.GetPlugIns();
         IVsdFolderPlugIn     folderPlugin = plugins.Item("Folder") as IVsdFolderPlugIn;
         if (folderPlugin != null)
         {
             folderPlugin.Items.RemoveObject(vsdFolder);
             vsdFolder = null;
         }
     }
 }