public void ActivateApplication(System.Deployment.Application.DefinitionAppId appId, string activationParameter, bool useActivationParameter)
 {
     using (this.AcquireStoreReaderLock())
     {
         this._compStore.ActivateApplication(appId, activationParameter, useActivationParameter);
     }
 }
 public bool CheckGroupInstalled(SubscriptionState subState, System.Deployment.Application.DefinitionAppId appId, AssemblyManifest appManifest, string groupName)
 {
     using (this.AcquireSubscriptionReaderLock(subState))
     {
         return(this._compStore.CheckGroupInstalled(appId, appManifest, groupName));
     }
 }
        internal ulong GetSharedSize(System.Deployment.Application.DefinitionAppId appId)
        {
            ArrayList deployAppIds = new ArrayList();

            deployAppIds.Add(appId);
            using (this.AcquireStoreReaderLock())
            {
                return(this._compStore.GetSharedSize(deployAppIds));
            }
        }
 public bool CheckAndReferenceApplication(SubscriptionState subState, System.Deployment.Application.DefinitionAppId appId, long transactionId)
 {
     System.Deployment.Application.DefinitionIdentity deploymentIdentity  = appId.DeploymentIdentity;
     System.Deployment.Application.DefinitionIdentity applicationIdentity = appId.ApplicationIdentity;
     if (!subState.IsInstalled || !this.IsAssemblyInstalled(deploymentIdentity))
     {
         return(false);
     }
     if (!this.IsAssemblyInstalled(applicationIdentity))
     {
         throw new DeploymentException(ExceptionTypes.Subscription, Resources.GetString("Ex_IllegalApplicationId"));
     }
     if (!appId.Equals(subState.CurrentBind))
     {
         return(appId.Equals(subState.PreviousBind));
     }
     return(true);
 }
 internal System.Deployment.Internal.Isolation.Store.IPathLock LockApplicationPath(System.Deployment.Application.DefinitionAppId definitionAppId)
 {
     using (this.AcquireStoreReaderLock())
     {
         return(this._compStore.LockApplicationPath(definitionAppId));
     }
 }
 protected void AnalyzeTransactionOperation(System.Deployment.Internal.Isolation.StoreTransactionOperation operation, uint dispositionValue, int hresult)
 {
     string str = "";
     try
     {
         if (operation.Operation == System.Deployment.Internal.Isolation.StoreTransactionOperationType.StageComponent)
         {
             System.Deployment.Internal.Isolation.StoreOperationStageComponent component = (System.Deployment.Internal.Isolation.StoreOperationStageComponent) Marshal.PtrToStructure(operation.Data.DataPtr, typeof(System.Deployment.Internal.Isolation.StoreOperationStageComponent));
             System.Deployment.Internal.Isolation.StoreOperationStageComponent.Disposition disposition = (System.Deployment.Internal.Isolation.StoreOperationStageComponent.Disposition) dispositionValue;
             str = disposition.ToString();
             this._message = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionStageComponent"), new object[] { component.GetType().ToString(), str, hresult, Path.GetFileName(component.ManifestPath) });
             if (disposition == System.Deployment.Internal.Isolation.StoreOperationStageComponent.Disposition.Failed)
             {
                 this._failureMessage = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionStageComponentFailure"), new object[] { Path.GetFileName(component.ManifestPath) });
                 this._failed = true;
             }
         }
         else if (operation.Operation == System.Deployment.Internal.Isolation.StoreTransactionOperationType.PinDeployment)
         {
             System.Deployment.Internal.Isolation.StoreOperationPinDeployment deployment = (System.Deployment.Internal.Isolation.StoreOperationPinDeployment) Marshal.PtrToStructure(operation.Data.DataPtr, typeof(System.Deployment.Internal.Isolation.StoreOperationPinDeployment));
             System.Deployment.Internal.Isolation.StoreOperationPinDeployment.Disposition disposition2 = (System.Deployment.Internal.Isolation.StoreOperationPinDeployment.Disposition) dispositionValue;
             str = disposition2.ToString();
             System.Deployment.Application.DefinitionAppId id = new System.Deployment.Application.DefinitionAppId(deployment.Application);
             this._message = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionPinDeployment"), new object[] { deployment.GetType().ToString(), str, hresult, id.ToString() });
             if (disposition2 == System.Deployment.Internal.Isolation.StoreOperationPinDeployment.Disposition.Failed)
             {
                 this._failureMessage = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionPinDeploymentFailure"), new object[] { id.ToString() });
                 this._failed = true;
             }
         }
         else if (operation.Operation == System.Deployment.Internal.Isolation.StoreTransactionOperationType.UnpinDeployment)
         {
             System.Deployment.Internal.Isolation.StoreOperationUnpinDeployment deployment2 = (System.Deployment.Internal.Isolation.StoreOperationUnpinDeployment) Marshal.PtrToStructure(operation.Data.DataPtr, typeof(System.Deployment.Internal.Isolation.StoreOperationUnpinDeployment));
             System.Deployment.Internal.Isolation.StoreOperationUnpinDeployment.Disposition disposition3 = (System.Deployment.Internal.Isolation.StoreOperationUnpinDeployment.Disposition) dispositionValue;
             str = disposition3.ToString();
             System.Deployment.Application.DefinitionAppId id2 = new System.Deployment.Application.DefinitionAppId(deployment2.Application);
             this._message = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionUnPinDeployment"), new object[] { deployment2.GetType().ToString(), str, hresult, id2.ToString() });
             if (disposition3 == System.Deployment.Internal.Isolation.StoreOperationUnpinDeployment.Disposition.Failed)
             {
                 this._failureMessage = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionUnPinDeploymentFailure"), new object[] { id2.ToString() });
                 this._failed = true;
             }
         }
         else if (operation.Operation == System.Deployment.Internal.Isolation.StoreTransactionOperationType.InstallDeployment)
         {
             System.Deployment.Internal.Isolation.StoreOperationInstallDeployment deployment3 = (System.Deployment.Internal.Isolation.StoreOperationInstallDeployment) Marshal.PtrToStructure(operation.Data.DataPtr, typeof(System.Deployment.Internal.Isolation.StoreOperationInstallDeployment));
             System.Deployment.Internal.Isolation.StoreOperationInstallDeployment.Disposition disposition4 = (System.Deployment.Internal.Isolation.StoreOperationInstallDeployment.Disposition) dispositionValue;
             str = disposition4.ToString();
             System.Deployment.Application.DefinitionAppId id3 = new System.Deployment.Application.DefinitionAppId(deployment3.Application);
             this._message = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionInstallDeployment"), new object[] { deployment3.GetType().ToString(), str, hresult, id3.ToString() });
             if (disposition4 == System.Deployment.Internal.Isolation.StoreOperationInstallDeployment.Disposition.Failed)
             {
                 this._failureMessage = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionInstallDeploymentFailure"), new object[] { id3.ToString() });
                 this._failed = true;
             }
         }
         else if (operation.Operation == System.Deployment.Internal.Isolation.StoreTransactionOperationType.UninstallDeployment)
         {
             System.Deployment.Internal.Isolation.StoreOperationUninstallDeployment deployment4 = (System.Deployment.Internal.Isolation.StoreOperationUninstallDeployment) Marshal.PtrToStructure(operation.Data.DataPtr, typeof(System.Deployment.Internal.Isolation.StoreOperationUninstallDeployment));
             System.Deployment.Internal.Isolation.StoreOperationUninstallDeployment.Disposition disposition5 = (System.Deployment.Internal.Isolation.StoreOperationUninstallDeployment.Disposition) dispositionValue;
             str = disposition5.ToString();
             System.Deployment.Application.DefinitionAppId id4 = new System.Deployment.Application.DefinitionAppId(deployment4.Application);
             this._message = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionUninstallDeployment"), new object[] { deployment4.GetType().ToString(), str, hresult, id4.ToString() });
             if (disposition5 == System.Deployment.Internal.Isolation.StoreOperationUninstallDeployment.Disposition.Failed)
             {
                 this._failureMessage = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionUninstallDeploymentFailure"), new object[] { id4.ToString() });
                 this._failed = true;
             }
         }
         else if (operation.Operation == System.Deployment.Internal.Isolation.StoreTransactionOperationType.SetDeploymentMetadata)
         {
             System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata metadata = (System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata) Marshal.PtrToStructure(operation.Data.DataPtr, typeof(System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata));
             System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata.Disposition disposition6 = (System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata.Disposition) dispositionValue;
             str = disposition6.ToString();
             this._message = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionSetDeploymentMetadata"), new object[] { metadata.GetType().ToString(), str, hresult });
             if (disposition6 == System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata.Disposition.Failed)
             {
                 this._failureMessage = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionSetDeploymentMetadataFailure"), new object[0]);
                 this._failed = true;
             }
         }
         else if (operation.Operation == System.Deployment.Internal.Isolation.StoreTransactionOperationType.StageComponentFile)
         {
             System.Deployment.Internal.Isolation.StoreOperationStageComponentFile file = (System.Deployment.Internal.Isolation.StoreOperationStageComponentFile) Marshal.PtrToStructure(operation.Data.DataPtr, typeof(System.Deployment.Internal.Isolation.StoreOperationStageComponentFile));
             System.Deployment.Internal.Isolation.StoreOperationStageComponentFile.Disposition disposition7 = (System.Deployment.Internal.Isolation.StoreOperationStageComponentFile.Disposition) dispositionValue;
             str = disposition7.ToString();
             this._message = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionStageComponentFile"), new object[] { file.GetType().ToString(), str, hresult, file.ComponentRelativePath });
             if (disposition7 == System.Deployment.Internal.Isolation.StoreOperationStageComponentFile.Disposition.Failed)
             {
                 this._failureMessage = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionStageComponentFileFailure"), new object[] { file.ComponentRelativePath });
                 this._failed = true;
             }
         }
         else
         {
             this._message = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_TransactionUnknownOperation"), new object[] { operation.Operation.GetType().ToString(), (uint) operation.Operation, hresult });
         }
     }
     catch (FormatException)
     {
     }
     catch (ArgumentException)
     {
     }
 }
 private void PrepareSetSubscriptionProperties(StoreTransactionContext storeTxn, SubscriptionState subState, SubscriptionStateInternal newState)
 {
     Logger.AddInternalState("Changing Subscription Properties:");
     Logger.AddInternalState("Old subscription state = " + subState.ToString());
     Logger.AddInternalState("New subscription state = " + newState.ToString());
     SubscriptionStateVariable[] variableArray = new SubscriptionStateVariable[] { new SubscriptionStateVariable("IsShellVisible", newState.IsShellVisible, subState.IsShellVisible), new SubscriptionStateVariable("PreviousBind", newState.PreviousBind, subState.PreviousBind), new SubscriptionStateVariable("PendingBind", newState.PendingBind, subState.PendingBind), new SubscriptionStateVariable("ExcludedDeployment", newState.ExcludedDeployment, subState.ExcludedDeployment), new SubscriptionStateVariable("PendingDeployment", newState.PendingDeployment, subState.PendingDeployment), new SubscriptionStateVariable("DeploymentProviderUri", newState.DeploymentProviderUri, subState.DeploymentProviderUri), new SubscriptionStateVariable("MinimumRequiredVersion", newState.MinimumRequiredVersion, subState.MinimumRequiredVersion), new SubscriptionStateVariable("LastCheckTime", newState.LastCheckTime, subState.LastCheckTime), new SubscriptionStateVariable("UpdateSkippedDeployment", newState.UpdateSkippedDeployment, subState.UpdateSkippedDeployment), new SubscriptionStateVariable("UpdateSkipTime", newState.UpdateSkipTime, subState.UpdateSkipTime), new SubscriptionStateVariable("AppType", (ushort) newState.appType, (ushort) subState.appType), new SubscriptionStateVariable("CurrentBind", newState.CurrentBind, subState.CurrentBind) };
     ArrayList list = new ArrayList();
     foreach (SubscriptionStateVariable variable in variableArray)
     {
         if ((!subState.IsInstalled || !variable.IsUnchanged) || !newState.IsInstalled)
         {
             list.Add(new System.Deployment.Internal.Isolation.StoreOperationMetadataProperty(Constants.DeploymentPropertySet, variable.PropertyName, newState.IsInstalled ? ToPropertyString(variable.NewValue) : null));
         }
     }
     if (list.Count > 0)
     {
         System.Deployment.Internal.Isolation.StoreOperationMetadataProperty[] setProperties = (System.Deployment.Internal.Isolation.StoreOperationMetadataProperty[]) list.ToArray(typeof(System.Deployment.Internal.Isolation.StoreOperationMetadataProperty));
         System.Deployment.Application.DefinitionAppId id = new System.Deployment.Application.DefinitionAppId(new System.Deployment.Application.DefinitionIdentity[] { subState.SubscriptionId });
         storeTxn.Add(new System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata(id.ComPointer, this.InstallReference, setProperties));
     }
 }
 private bool IsSubscriptionInstalled(System.Deployment.Application.DefinitionIdentity subId)
 {
     System.Deployment.Application.DefinitionAppId appId = new System.Deployment.Application.DefinitionAppId(new System.Deployment.Application.DefinitionIdentity[] { subId });
     try
     {
         return (this.GetPropertyDefinitionAppId(appId, "CurrentBind") != null);
     }
     catch (DeploymentException)
     {
         return false;
     }
 }
 public SubscriptionStateInternal GetSubscriptionStateInternal(System.Deployment.Application.DefinitionIdentity subId)
 {
     SubscriptionStateInternal internal2 = new SubscriptionStateInternal {
         IsInstalled = this.IsSubscriptionInstalled(subId)
     };
     if (internal2.IsInstalled)
     {
         System.Deployment.Application.DefinitionAppId appId = new System.Deployment.Application.DefinitionAppId(new System.Deployment.Application.DefinitionIdentity[] { subId });
         internal2.IsShellVisible = this.GetPropertyBoolean(appId, "IsShellVisible");
         internal2.CurrentBind = this.GetPropertyDefinitionAppId(appId, "CurrentBind");
         internal2.PreviousBind = this.GetPropertyDefinitionAppId(appId, "PreviousBind");
         internal2.PendingBind = this.GetPropertyDefinitionAppId(appId, "PendingBind");
         internal2.ExcludedDeployment = this.GetPropertyDefinitionIdentity(appId, "ExcludedDeployment");
         internal2.PendingDeployment = this.GetPropertyDefinitionIdentity(appId, "PendingDeployment");
         internal2.DeploymentProviderUri = this.GetPropertyUri(appId, "DeploymentProviderUri");
         internal2.MinimumRequiredVersion = this.GetPropertyVersion(appId, "MinimumRequiredVersion");
         internal2.LastCheckTime = this.GetPropertyDateTime(appId, "LastCheckTime");
         internal2.UpdateSkippedDeployment = this.GetPropertyDefinitionIdentity(appId, "UpdateSkippedDeployment");
         internal2.UpdateSkipTime = this.GetPropertyDateTime(appId, "UpdateSkipTime");
         internal2.appType = this.GetPropertyAppType(appId, "AppType");
         if (internal2.CurrentBind == null)
         {
             throw new InvalidDeploymentException(Resources.GetString("Ex_NoCurrentBind"));
         }
         internal2.CurrentDeployment = internal2.CurrentBind.DeploymentIdentity;
         internal2.CurrentDeploymentManifest = this.GetAssemblyManifest(internal2.CurrentDeployment);
         internal2.CurrentDeploymentSourceUri = this.GetPropertyUri(internal2.CurrentBind, "DeploymentSourceUri");
         internal2.CurrentApplication = internal2.CurrentBind.ApplicationIdentity;
         internal2.CurrentApplicationManifest = this.GetAssemblyManifest(internal2.CurrentBind.ApplicationIdentity);
         internal2.CurrentApplicationSourceUri = this.GetPropertyUri(internal2.CurrentBind, "ApplicationSourceUri");
         System.Deployment.Application.DefinitionIdentity identity = (internal2.PreviousBind != null) ? internal2.PreviousBind.DeploymentIdentity : null;
         internal2.RollbackDeployment = ((identity != null) && ((internal2.MinimumRequiredVersion == null) || (identity.Version >= internal2.MinimumRequiredVersion))) ? identity : null;
         if (internal2.PreviousBind == null)
         {
             return internal2;
         }
         try
         {
             internal2.PreviousApplication = internal2.PreviousBind.ApplicationIdentity;
             internal2.PreviousApplicationManifest = this.GetAssemblyManifest(internal2.PreviousBind.ApplicationIdentity);
         }
         catch (Exception exception)
         {
             if (ExceptionUtility.IsHardException(exception))
             {
                 throw;
             }
             Logger.AddInternalState("Exception thrown for GetAssemblyManifest in GetSubscriptionStateInternal: " + exception.GetType().ToString() + ":" + exception.Message);
             internal2.PreviousBind = null;
             internal2.RollbackDeployment = null;
             internal2.PreviousApplication = null;
             internal2.PreviousApplicationManifest = null;
         }
     }
     return internal2;
 }