Пример #1
0
        private bool BindCoreWithAppId(bool blocking, ref FileStream refTransaction, ref string productName)
        {
            SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(this._bindAppId.DeploymentIdentity.ToSubscriptionId());

            if (!subscriptionState.IsInstalled)
            {
                throw new InvalidDeploymentException(Resources.GetString("Ex_BindAppIdNotInstalled"));
            }
            if (!this._bindAppId.Equals((object)subscriptionState.CurrentBind))
            {
                throw new InvalidDeploymentException(Resources.GetString("Ex_BindAppIdNotCurrrent"));
            }
            if (!blocking && this._cancellationPending)
            {
                return(true);
            }
            long transactionId;

            refTransaction = this._subStore.AcquireReferenceTransaction(out transactionId);
            bool flag = this._subStore.CheckAndReferenceApplication(subscriptionState, this._bindAppId, transactionId);
            ActivationDescription activationDescription = new ActivationDescription();

            activationDescription.SetDeploymentManifest(subscriptionState.CurrentDeploymentManifest, subscriptionState.CurrentDeploymentSourceUri, (string)null);
            Logger.SetDeploymentManifest(this._log, subscriptionState.CurrentDeploymentManifest);
            activationDescription.IsUpdate = this._isupdate;
            activationDescription.SetApplicationManifest(subscriptionState.CurrentApplicationManifest, subscriptionState.CurrentApplicationSourceUri, (string)null);
            Logger.SetApplicationManifest(this._log, subscriptionState.CurrentApplicationManifest);
            Logger.SetApplicationUrl(this._log, subscriptionState.CurrentApplicationSourceUri);
            activationDescription.AppId = new DefinitionAppId(activationDescription.ToAppCodebase(), new DefinitionIdentity[2]
            {
                activationDescription.DeployManifest.Identity,
                activationDescription.AppManifest.Identity
            });
            if (!blocking && this._cancellationPending)
            {
                return(true);
            }
            Description effectiveDescription = subscriptionState.EffectiveDescription;

            productName  = effectiveDescription.Product;
            this._cached = flag;
            Logger.AddInternalState(this._log, "_cached=" + this._cached.ToString());
            Logger.AddInternalState(this._log, "_isupdate=" + this._isupdate.ToString());
            this._referenceTransaction = refTransaction;
            this._actCtx  = DeploymentManager.ConstructActivationContextFromStore(activationDescription.AppId);
            this._actDesc = activationDescription;
            return(false);
        }
Пример #2
0
 private bool SynchronizeCore(bool blocking)
 {
     try
     {
         AssemblyManifest  deployManifest    = this._actDesc.DeployManifest;
         SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(deployManifest);
         this._subStore.CheckDeploymentSubscriptionState(subscriptionState, deployManifest);
         this._subStore.CheckCustomUXFlag(subscriptionState, this._actDesc.AppManifest);
         if (this._actDesc.DeployManifestPath != null)
         {
             this._actDesc.CommitDeploy = true;
             this._actDesc.IsConfirmed  = this._isConfirmed;
             this._actDesc.TimeStamp    = DateTime.UtcNow;
         }
         else
         {
             this._actDesc.CommitDeploy = false;
         }
         if (!blocking && this._cancellationPending)
         {
             return(true);
         }
         if (!this._cached)
         {
             Logger.AddInternalState(this._log, "Application is not cached.");
             bool flag1 = false;
             if (this._actDesc.appType != AppType.CustomHostSpecified)
             {
                 if (this._actDesc.Trust != null)
                 {
                     bool flag2 = this._actDesc.Trust.DefaultGrantSet.PermissionSet.IsUnrestricted();
                     Logger.AddInternalState(this._log, "fullTrust=" + flag2.ToString());
                     if (!flag2 && this._actDesc.AppManifest.FileAssociations.Length != 0)
                     {
                         throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_FileExtensionNotSupported"));
                     }
                     bool flag3 = !this._actDesc.DeployManifest.Deployment.Install;
                     if (!flag2 & flag3)
                     {
                         Logger.AddInternalState(this._log, "Application is semi-trust and online. Size limits will be checked during download.");
                         if (this._downloadOptions == null)
                         {
                             this._downloadOptions = new DownloadOptions();
                         }
                         this._downloadOptions.EnforceSizeLimit = true;
                         this._downloadOptions.SizeLimit        = this._subStore.GetSizeLimitInBytesForSemiTrustApps();
                         this._downloadOptions.Size             = this._actDesc.DeployManifest.SizeInBytes + this._actDesc.AppManifest.SizeInBytes;
                     }
                 }
                 else
                 {
                     flag1 = true;
                 }
             }
             DownloadManager.DownloadDependencies(subscriptionState, this._actDesc.DeployManifest, this._actDesc.AppManifest, this._actDesc.AppSourceUri, this._tempApplicationDirectory.Path, (string)null, blocking ? (IDownloadNotification)null : (IDownloadNotification)this, this._downloadOptions);
             if (!blocking && this._cancellationPending)
             {
                 return(true);
             }
             this.WaitForAssertApplicationRequirements();
             if (flag1)
             {
                 this.CheckSizeLimit();
             }
             this._actDesc.CommitApp      = true;
             this._actDesc.AppPayloadPath = this._tempApplicationDirectory.Path;
         }
         else
         {
             Logger.AddInternalState(this._log, "Application is cached.");
             this.WaitForAssertApplicationRequirements();
         }
         if (this._actDesc.CommitDeploy || this._actDesc.CommitApp)
         {
             this._subStore.CommitApplication(ref subscriptionState, (CommitApplicationParams)this._actDesc);
             Logger.AddInternalState(this._log, "Application is successfully committed to the store.");
         }
         if (this._tempApplicationDirectory != null)
         {
             this._tempApplicationDirectory.Dispose();
             this._tempApplicationDirectory = (TempDirectory)null;
         }
         if (this._tempDeployment != null)
         {
             this._tempDeployment.Dispose();
             this._tempDeployment = (TempFile)null;
         }
         if (this._referenceTransaction != null)
         {
             this._referenceTransaction.Close();
             this._referenceTransaction = (FileStream)null;
         }
         Logger.AddInternalState(this._log, "Refreshing ActivationContext from store.");
         ActivationContext actCtx = this._actCtx;
         this._actCtx = DeploymentManager.ConstructActivationContextFromStore(this._actDesc.AppId);
         actCtx.Dispose();
         this._cached = true;
     }
     catch (Exception ex)
     {
         this.LogError(Resources.GetString("Ex_DownloadApplicationFailed"), ex);
         Logger.AddInternalState(this._log, "Exception thrown in  SynchronizeCore(): " + ex.GetType().ToString() + " : " + ex.Message + "\r\n" + ex.StackTrace);
         throw;
     }
     return(false);
 }