Beispiel #1
0
 public static void RemoveSubscriptionShellExposure(SubscriptionState subState)
 {
     using (subState.SubscriptionStore.AcquireStoreWriterLock())
     {
         DefinitionIdentity subscriptionId = subState.SubscriptionId;
         bool flag = false;
         ShellExposure.ShellExposureInformation exposureInformation = ShellExposure.ShellExposureInformation.CreateShellExposureInformation(subscriptionId);
         if (exposureInformation == null)
         {
             flag = true;
         }
         else
         {
             for (int index = 1; index <= 2; ++index)
             {
                 try
                 {
                     ShellExposure.RemoveShortcuts(exposureInformation);
                     break;
                 }
                 catch (DeploymentException ex)
                 {
                     Logger.AddInternalState("Remove shortcut entries Failed: " + exposureInformation.ApplicationShortcutPath + "," + exposureInformation.SupportShortcutPath + "," + exposureInformation.DesktopShortcutPath + "," + exposureInformation.ApplicationFolderPath + "," + exposureInformation.ApplicationRootFolderPath);
                     if (index < 2)
                     {
                         Thread.Sleep(1000);
                     }
                     else if (!(ex.InnerException is UnauthorizedAccessException))
                     {
                         throw;
                     }
                 }
             }
         }
         ShellExposure.RemoveArpEntry(subscriptionId);
         if (flag)
         {
             throw new DeploymentException(ExceptionTypes.Subscription, Resources.GetString("Ex_ShortcutRemovalFailureDueToInvalidPublisherProduct"));
         }
     }
 }