Exemple #1
0
 public static void UpdateSubscriptionShellExposure(SubscriptionState subState)
 {
     using (subState.SubscriptionStore.AcquireStoreWriterLock())
     {
         ShellExposureInformation shellExposureInformation = ShellExposureInformation.CreateShellExposureInformation(subState.SubscriptionId);
         UpdateShortcuts(subState, ref shellExposureInformation);
         UpdateShellExtensions(subState, ref shellExposureInformation);
         UpdateArpEntry(subState, shellExposureInformation);
     }
 }
Exemple #2
0
        internal static void RemovePins(SubscriptionState subState)
        {
            Logger.AddInternalState("Attempting to remove shell pins.");
            ShellExposureInformation information = ShellExposureInformation.CreateShellExposureInformation(subState.SubscriptionId);

            if (information == null)
            {
                Logger.AddInternalState("shellExposureInformation is null.");
            }
            else if (System.IO.File.Exists(information.ApplicationShortcutPath))
            {
                UnpinShortcut(information.ApplicationShortcutPath);
            }
        }
Exemple #3
0
 public static void RemoveSubscriptionShellExposure(SubscriptionState subState)
 {
     using (subState.SubscriptionStore.AcquireStoreWriterLock())
     {
         DefinitionIdentity subscriptionId = subState.SubscriptionId;
         bool flag = false;
         ShellExposureInformation shellExposureInformation = ShellExposureInformation.CreateShellExposureInformation(subscriptionId);
         if (shellExposureInformation == null)
         {
             flag = true;
         }
         else
         {
             for (int i = 1; i <= 2; i++)
             {
                 try
                 {
                     RemoveShortcuts(shellExposureInformation);
                     break;
                 }
                 catch (DeploymentException)
                 {
                     Logger.AddInternalState("Remove shortcut entries Failed: " + shellExposureInformation.ApplicationShortcutPath + "," + shellExposureInformation.SupportShortcutPath + "," + shellExposureInformation.DesktopShortcutPath + "," + shellExposureInformation.ApplicationFolderPath + "," + shellExposureInformation.ApplicationRootFolderPath);
                     if (i >= 2)
                     {
                         throw;
                     }
                     Thread.Sleep(0x3e8);
                 }
             }
         }
         RemoveArpEntry(subscriptionId);
         if (flag)
         {
             throw new DeploymentException(ExceptionTypes.Subscription, Resources.GetString("Ex_ShortcutRemovalFailureDueToInvalidPublisherProduct"));
         }
     }
 }
Exemple #4
0
        private static void UpdateShortcuts(SubscriptionState subState, ref ShellExposureInformation shellExposureInformation)
        {
            string      strA = string.Format("{0}#{1}", subState.DeploymentProviderUri.AbsoluteUri, subState.SubscriptionId.ToString());
            Description effectiveDescription = subState.EffectiveDescription;

            if (shellExposureInformation != null)
            {
                bool flag  = true;
                bool flag2 = true;
                bool flag3 = true;
                bool flag4 = true;
                if (string.Compare(effectiveDescription.FilteredPublisher, shellExposureInformation.AppVendor, StringComparison.Ordinal) == 0)
                {
                    flag = false;
                    if (Utilities.CompareWithNullEqEmpty(effectiveDescription.FilteredSuiteName, shellExposureInformation.AppSuiteName, StringComparison.Ordinal) == 0)
                    {
                        flag2 = false;
                        if (string.Compare(effectiveDescription.FilteredProduct, shellExposureInformation.AppProduct, StringComparison.Ordinal) == 0)
                        {
                            flag3 = false;
                            if (string.Compare(strA, shellExposureInformation.ShortcutAppId, StringComparison.Ordinal) == 0)
                            {
                                flag4 = false;
                            }
                        }
                    }
                }
                if (((!flag && !flag2) && (!flag3 && !flag4)) && System.IO.File.Exists(shellExposureInformation.ApplicationShortcutPath))
                {
                    Logger.AddInternalState("Shortcut folder and files are not updated and application shortcut file already exists: " + shellExposureInformation.ApplicationShortcutPath);
                    return;
                }
                if (flag3)
                {
                    UnpinShortcut(shellExposureInformation.ApplicationShortcutPath);
                    MoveDeleteFile(shellExposureInformation.ApplicationShortcutPath);
                    MoveDeleteFile(shellExposureInformation.SupportShortcutPath);
                    MoveDeleteFile(shellExposureInformation.DesktopShortcutPath);
                    Logger.AddInternalState("Shortcut files deleted:" + shellExposureInformation.ApplicationShortcutPath + "," + shellExposureInformation.SupportShortcutPath + "," + shellExposureInformation.DesktopShortcutPath);
                }
                if (flag2)
                {
                    Logger.AddInternalState("Attempt deleting shortcut folder:" + shellExposureInformation.ApplicationFolderPath);
                    MoveDeleteEmptyFolder(shellExposureInformation.ApplicationFolderPath);
                }
                if (flag)
                {
                    Logger.AddInternalState("Attempt deleting shortcut root folder:" + shellExposureInformation.ApplicationRootFolderPath);
                    MoveDeleteEmptyFolder(shellExposureInformation.ApplicationRootFolderPath);
                }
                if ((flag || flag2) || flag3)
                {
                    shellExposureInformation = ShellExposureInformation.CreateShellExposureInformation(effectiveDescription.FilteredPublisher, effectiveDescription.FilteredSuiteName, effectiveDescription.FilteredProduct, strA);
                }
                else
                {
                    Logger.AddInternalState("Shortcut app id has changed. Old value=" + shellExposureInformation.ShortcutAppId + ",New value=" + strA);
                    shellExposureInformation.ShortcutAppId = strA;
                }
            }
            else
            {
                shellExposureInformation = ShellExposureInformation.CreateShellExposureInformation(effectiveDescription.FilteredPublisher, effectiveDescription.FilteredSuiteName, effectiveDescription.FilteredProduct, strA);
            }
            try
            {
                Logger.AddInternalState("Create the shortcut directory : " + shellExposureInformation.ApplicationFolderPath);
                Directory.CreateDirectory(shellExposureInformation.ApplicationFolderPath);
                GenerateAppShortcut(subState, shellExposureInformation);
                GenerateSupportShortcut(subState, shellExposureInformation);
            }
            catch (Exception)
            {
                RemoveShortcuts(shellExposureInformation);
                throw;
            }
        }