예제 #1
0
        internal ulong GetSharedSize(DefinitionAppId appId)
        {
            ArrayList deployAppIds = new ArrayList();

            deployAppIds.Add((object)appId);
            using (this.AcquireStoreReaderLock())
                return(this._compStore.GetSharedSize(deployAppIds));
        }
 private void Activate(DefinitionAppId appId, AssemblyManifest appManifest, string activationParameter, bool useActivationParameter)
 {
     using (ActivationContext context = ActivationContext.CreatePartialActivationContext(appId.ToApplicationIdentity()))
     {
         InternalActivationContextHelper.PrepareForExecution(context);
         this._subStore.ActivateApplication(appId, activationParameter, useActivationParameter);
     }
 }
예제 #3
0
 public SubscriptionStateInternal(SubscriptionState subState)
 {
     this.IsInstalled             = subState.IsInstalled;
     this.IsShellVisible          = subState.IsShellVisible;
     this.CurrentBind             = subState.CurrentBind;
     this.PreviousBind            = subState.PreviousBind;
     this.PendingBind             = subState.PreviousBind;
     this.PendingDeployment       = subState.PendingDeployment;
     this.ExcludedDeployment      = subState.ExcludedDeployment;
     this.DeploymentProviderUri   = subState.DeploymentProviderUri;
     this.MinimumRequiredVersion  = subState.MinimumRequiredVersion;
     this.LastCheckTime           = subState.LastCheckTime;
     this.UpdateSkippedDeployment = subState.UpdateSkippedDeployment;
     this.UpdateSkipTime          = subState.UpdateSkipTime;
     this.appType = subState.appType;
 }
 public SubscriptionStateInternal(SubscriptionState subState)
 {
     this.IsInstalled = subState.IsInstalled;
     this.IsShellVisible = subState.IsShellVisible;
     this.CurrentBind = subState.CurrentBind;
     this.PreviousBind = subState.PreviousBind;
     this.PendingBind = subState.PreviousBind;
     this.PendingDeployment = subState.PendingDeployment;
     this.ExcludedDeployment = subState.ExcludedDeployment;
     this.DeploymentProviderUri = subState.DeploymentProviderUri;
     this.MinimumRequiredVersion = subState.MinimumRequiredVersion;
     this.LastCheckTime = subState.LastCheckTime;
     this.UpdateSkippedDeployment = subState.UpdateSkippedDeployment;
     this.UpdateSkipTime = subState.UpdateSkipTime;
     this.appType = subState.appType;
 }
예제 #5
0
        private ApplicationDeployment(string fullAppId)
        {
            if (fullAppId.Length > 0x10000)
            {
                throw new InvalidDeploymentException(Resources.GetString("Ex_AppIdTooLong"));
            }
            try
            {
                this._fullAppId = new DefinitionAppId(fullAppId);
            }
            catch (COMException exception)
            {
                throw new InvalidDeploymentException(string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_SubAppIdNotValid"), new object[] { fullAppId }), exception);
            }
            catch (SEHException exception2)
            {
                throw new InvalidDeploymentException(string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_SubAppIdNotValid"), new object[] { fullAppId }), exception2);
            }
            DefinitionIdentity deploymentIdentity = this._fullAppId.DeploymentIdentity;

            this._currentVersion = deploymentIdentity.Version;
            DefinitionIdentity subId = deploymentIdentity.ToSubscriptionId();

            this._subStore = SubscriptionStore.CurrentUser;
            this._subState = this._subStore.GetSubscriptionState(subId);
            if (!this._subState.IsInstalled)
            {
                throw new InvalidDeploymentException(Resources.GetString("Ex_SubNotInstalled"));
            }
            if (!this._fullAppId.Equals(this._subState.CurrentBind))
            {
                throw new InvalidDeploymentException(Resources.GetString("Ex_AppIdNotMatchInstalled"));
            }
            Uri uri = new Uri(this._fullAppId.Codebase);

            if (uri.IsFile)
            {
                this.accessPermission = new FileIOPermission(FileIOPermissionAccess.Read, uri.LocalPath);
            }
            else
            {
                this.accessPermission = new WebPermission(NetworkAccess.Connect, this._fullAppId.Codebase);
            }
            this.accessPermission.Demand();
            this._events        = new EventHandlerList();
            this.asyncOperation = AsyncOperationManager.CreateOperation(null);
        }
예제 #6
0
        public bool CheckAndReferenceApplication(SubscriptionState subState, DefinitionAppId appId, long transactionId)
        {
            DefinitionIdentity deploymentIdentity  = appId.DeploymentIdentity;
            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((object)subState.CurrentBind))
            {
                return(appId.Equals((object)subState.PreviousBind));
            }
            return(true);
        }
예제 #7
0
 public void Reset()
 {
     this.IsInstalled                 = this.IsShellVisible = false;
     this.CurrentBind                 = this.PreviousBind = this.PendingBind = (DefinitionAppId)null;
     this.ExcludedDeployment          = this.PendingDeployment = (DefinitionIdentity)null;
     this.DeploymentProviderUri       = (Uri)null;
     this.MinimumRequiredVersion      = (Version)null;
     this.LastCheckTime               = DateTime.MinValue;
     this.UpdateSkippedDeployment     = (DefinitionIdentity)null;
     this.UpdateSkipTime              = DateTime.MinValue;
     this.CurrentDeployment           = (DefinitionIdentity)null;
     this.RollbackDeployment          = (DefinitionIdentity)null;
     this.CurrentDeploymentManifest   = (AssemblyManifest)null;
     this.CurrentDeploymentSourceUri  = (Uri)null;
     this.CurrentApplication          = (DefinitionIdentity)null;
     this.CurrentApplicationManifest  = (AssemblyManifest)null;
     this.CurrentApplicationSourceUri = (Uri)null;
     this.PreviousApplication         = (DefinitionIdentity)null;
     this.PreviousApplicationManifest = (AssemblyManifest)null;
     this.appType = AppType.None;
 }
 public void Reset()
 {
     this.IsInstalled = this.IsShellVisible = false;
     this.CurrentBind = this.PreviousBind = (DefinitionAppId) (this.PendingBind = null);
     this.ExcludedDeployment = (DefinitionIdentity) (this.PendingDeployment = null);
     this.DeploymentProviderUri = null;
     this.MinimumRequiredVersion = null;
     this.LastCheckTime = DateTime.MinValue;
     this.UpdateSkippedDeployment = null;
     this.UpdateSkipTime = DateTime.MinValue;
     this.CurrentDeployment = null;
     this.RollbackDeployment = null;
     this.CurrentDeploymentManifest = null;
     this.CurrentDeploymentSourceUri = null;
     this.CurrentApplication = null;
     this.CurrentApplicationManifest = null;
     this.CurrentApplicationSourceUri = null;
     this.PreviousApplication = null;
     this.PreviousApplicationManifest = null;
     this.appType = AppType.None;
 }
예제 #9
0
 public CommitApplicationParams(CommitApplicationParams src)
 {
     this.AppId                = src.AppId;
     this.CommitApp            = src.CommitApp;
     this.AppManifest          = src.AppManifest;
     this.AppSourceUri         = src.AppSourceUri;
     this.AppManifestPath      = src.AppManifestPath;
     this.AppPayloadPath       = src.AppPayloadPath;
     this.AppGroup             = src.AppGroup;
     this.CommitDeploy         = src.CommitDeploy;
     this.DeployManifest       = src.DeployManifest;
     this.DeploySourceUri      = src.DeploySourceUri;
     this.DeployManifestPath   = src.DeployManifestPath;
     this.TimeStamp            = src.TimeStamp;
     this.IsConfirmed          = src.IsConfirmed;
     this.IsUpdate             = src.IsUpdate;
     this.IsRequiredUpdate     = src.IsRequiredUpdate;
     this.IsUpdateInPKTGroup   = src.IsUpdateInPKTGroup;
     this.IsFullTrustRequested = src.IsFullTrustRequested;
     this.appType              = src.appType;
     this.Trust                = src.Trust;
 }
 public CommitApplicationParams(CommitApplicationParams src)
 {
     this.TimeStamp = DateTime.MinValue;
     this.AppId = src.AppId;
     this.CommitApp = src.CommitApp;
     this.AppManifest = src.AppManifest;
     this.AppSourceUri = src.AppSourceUri;
     this.AppManifestPath = src.AppManifestPath;
     this.AppPayloadPath = src.AppPayloadPath;
     this.AppGroup = src.AppGroup;
     this.CommitDeploy = src.CommitDeploy;
     this.DeployManifest = src.DeployManifest;
     this.DeploySourceUri = src.DeploySourceUri;
     this.DeployManifestPath = src.DeployManifestPath;
     this.TimeStamp = src.TimeStamp;
     this.IsConfirmed = src.IsConfirmed;
     this.IsUpdate = src.IsUpdate;
     this.IsRequiredUpdate = src.IsRequiredUpdate;
     this.IsUpdateInPKTGroup = src.IsUpdateInPKTGroup;
     this.IsFullTrustRequested = src.IsFullTrustRequested;
     this.appType = src.appType;
     this.Trust = src.Trust;
 }
 internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, ActivationDescription activationDescription, string logFilePath, Logger.LogIdentity log) : base(e.Error, e.Cancelled, e.UserState)
 {
     this._applicationIdentity = (e.ActivationContext != null) ? e.ActivationContext.Identity : null;
     Logger.AddInternalState(log, "Creating GetManifestCompletedEventArgs.");
     string text = this._applicationIdentity.ToString();
     DefinitionAppId id = new DefinitionAppId(text);
     this._subId = id.DeploymentIdentity.ToSubscriptionId();
     this._logFilePath = logFilePath;
     this._isCached = e.IsCached;
     this._name = e.FriendlyName;
     this._actContext = e.ActivationContext;
     Logger.AddInternalState(log, "Application identity=" + text);
     Logger.AddInternalState(log, "Subscription identity=" + ((this._subId != null) ? this._subId.ToString() : "null"));
     Logger.AddInternalState(log, "IsCached=" + this._isCached.ToString());
     if (this._isCached)
     {
         this._rawDeploymentManifest = e.ActivationContext.DeploymentManifestBytes;
         this._rawApplicationManifest = e.ActivationContext.ApplicationManifestBytes;
     }
     this._activationDescription = activationDescription;
     this._version = this._activationDescription.AppId.DeploymentIdentity.Version;
     this._support = this._activationDescription.DeployManifest.Description.SupportUri;
 }
        internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, ActivationDescription activationDescription, string logFilePath, Logger.LogIdentity log) : base(e.Error, e.Cancelled, e.UserState)
        {
            this._applicationIdentity = (e.ActivationContext != null) ? e.ActivationContext.Identity : null;
            Logger.AddInternalState(log, "Creating GetManifestCompletedEventArgs.");
            string          text = this._applicationIdentity.ToString();
            DefinitionAppId id   = new DefinitionAppId(text);

            this._subId       = id.DeploymentIdentity.ToSubscriptionId();
            this._logFilePath = logFilePath;
            this._isCached    = e.IsCached;
            this._name        = e.FriendlyName;
            this._actContext  = e.ActivationContext;
            Logger.AddInternalState(log, "Application identity=" + text);
            Logger.AddInternalState(log, "Subscription identity=" + ((this._subId != null) ? this._subId.ToString() : "null"));
            Logger.AddInternalState(log, "IsCached=" + this._isCached.ToString());
            if (this._isCached)
            {
                this._rawDeploymentManifest  = e.ActivationContext.DeploymentManifestBytes;
                this._rawApplicationManifest = e.ActivationContext.ApplicationManifestBytes;
            }
            this._activationDescription = activationDescription;
            this._version = this._activationDescription.AppId.DeploymentIdentity.Version;
            this._support = this._activationDescription.DeployManifest.Description.SupportUri;
        }
예제 #13
0
 internal Store.IPathLock LockApplicationPath(DefinitionAppId definitionAppId)
 {
     using (this.AcquireStoreReaderLock())
         return(this._compStore.LockApplicationPath(definitionAppId));
 }
예제 #14
0
 public bool CheckGroupInstalled(SubscriptionState subState, DefinitionAppId appId, AssemblyManifest appManifest, string groupName)
 {
     using (this.AcquireSubscriptionReaderLock(subState))
         return(this._compStore.CheckGroupInstalled(appId, appManifest, groupName));
 }
예제 #15
0
 public void ActivateApplication(DefinitionAppId appId, string activationParameter, bool useActivationParameter)
 {
     using (this.AcquireStoreReaderLock())
         this._compStore.ActivateApplication(appId, activationParameter, useActivationParameter);
 }
 private ApplicationDeployment(string fullAppId)
 {
     if (fullAppId.Length > 0x10000)
     {
         throw new InvalidDeploymentException(Resources.GetString("Ex_AppIdTooLong"));
     }
     try
     {
         this._fullAppId = new DefinitionAppId(fullAppId);
     }
     catch (COMException exception)
     {
         throw new InvalidDeploymentException(string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_SubAppIdNotValid"), new object[] { fullAppId }), exception);
     }
     catch (SEHException exception2)
     {
         throw new InvalidDeploymentException(string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_SubAppIdNotValid"), new object[] { fullAppId }), exception2);
     }
     DefinitionIdentity deploymentIdentity = this._fullAppId.DeploymentIdentity;
     this._currentVersion = deploymentIdentity.Version;
     DefinitionIdentity subId = deploymentIdentity.ToSubscriptionId();
     this._subStore = SubscriptionStore.CurrentUser;
     this._subState = this._subStore.GetSubscriptionState(subId);
     if (!this._subState.IsInstalled)
     {
         throw new InvalidDeploymentException(Resources.GetString("Ex_SubNotInstalled"));
     }
     if (!this._fullAppId.Equals(this._subState.CurrentBind))
     {
         throw new InvalidDeploymentException(Resources.GetString("Ex_AppIdNotMatchInstalled"));
     }
     Uri uri = new Uri(this._fullAppId.Codebase);
     if (uri.IsFile)
     {
         this.accessPermission = new FileIOPermission(FileIOPermissionAccess.Read, uri.LocalPath);
     }
     else
     {
         this.accessPermission = new WebPermission(NetworkAccess.Connect, this._fullAppId.Codebase);
     }
     this.accessPermission.Demand();
     this._events = new EventHandlerList();
     this.asyncOperation = AsyncOperationManager.CreateOperation(null);
 }
예제 #17
0
 private static ActivationContext ConstructActivationContextFromStore(DefinitionAppId defAppId)
 {
     return(ActivationContext.CreatePartialActivationContext(defAppId.ToApplicationIdentity()));
 }
예제 #18
0
 private bool BindCore(bool blocking, ref TempFile tempDeploy, ref TempDirectory tempAppDir, ref FileStream refTransaction, ref string productName)
 {
     try
     {
         long   num;
         Uri    uri2;
         string str2;
         if (this._deploySource == null)
         {
             return(this.BindCoreWithAppId(blocking, ref refTransaction, ref productName));
         }
         bool             flag         = false;
         AssemblyManifest manifest     = null;
         string           manifestPath = null;
         Uri sourceUri = this._deploySource;
         this._state = DeploymentProgressState.DownloadingDeploymentInformation;
         Logger.AddInternalState(this._log, "Internal state=" + this._state);
         manifest     = DownloadManager.DownloadDeploymentManifest(this._subStore, ref sourceUri, out tempDeploy, blocking ? null : this, this._downloadOptions);
         manifestPath = tempDeploy.Path;
         System.Deployment.Application.ActivationDescription actDesc = new System.Deployment.Application.ActivationDescription();
         actDesc.SetDeploymentManifest(manifest, sourceUri, manifestPath);
         Logger.SetDeploymentManifest(this._log, manifest);
         actDesc.IsUpdate = this._isupdate;
         if (actDesc.DeployManifest.Deployment == null)
         {
             throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_NotDeploymentOrShortcut"));
         }
         if (!blocking && this._cancellationPending)
         {
             return(true);
         }
         refTransaction = this._subStore.AcquireReferenceTransaction(out num);
         SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(actDesc.DeployManifest);
         if (((actDesc.DeployManifest.Deployment.Install && (actDesc.DeployManifest.Deployment.ProviderCodebaseUri == null)) && ((subscriptionState != null) && (subscriptionState.DeploymentProviderUri != null))) && !subscriptionState.DeploymentProviderUri.Equals(sourceUri))
         {
             throw new DeploymentException(ExceptionTypes.DeploymentUriDifferent, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DeploymentUriDifferentExText"), new object[] { actDesc.DeployManifest.Description.FilteredProduct, sourceUri.AbsoluteUri, subscriptionState.DeploymentProviderUri.AbsoluteUri }));
         }
         DefinitionAppId appId = null;
         try
         {
             appId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[] { actDesc.DeployManifest.Identity, new DefinitionIdentity(actDesc.DeployManifest.MainDependentAssembly.Identity) });
         }
         catch (COMException exception)
         {
             throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), exception);
         }
         catch (SEHException exception2)
         {
             throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), exception2);
         }
         Logger.AddInternalState(this._log, "expectedAppId=" + appId.ToString());
         flag = this._subStore.CheckAndReferenceApplication(subscriptionState, appId, num);
         if (flag && appId.Equals(subscriptionState.CurrentBind))
         {
             Logger.AddInternalState(this._log, "Application is found in store and it is the CurrentBind. Binding with appid.");
             this._bindAppId = appId;
             return(this.BindCoreWithAppId(blocking, ref refTransaction, ref productName));
         }
         if (flag)
         {
             Logger.AddInternalState(this._log, "Application is found in store but it is not the CurrentBind.");
         }
         else
         {
             Logger.AddInternalState(this._log, "Application is not found in store.");
         }
         if (!blocking && this._cancellationPending)
         {
             return(true);
         }
         this._state = DeploymentProgressState.DownloadingApplicationInformation;
         Logger.AddInternalState(this._log, "Internal state=" + this._state);
         tempAppDir = this._subStore.AcquireTempDirectory();
         AssemblyManifest appManifest = DownloadManager.DownloadApplicationManifest(actDesc.DeployManifest, tempAppDir.Path, actDesc.DeploySourceUri, blocking ? null : this, this._downloadOptions, out uri2, out str2);
         AssemblyManifest.ReValidateManifestSignatures(actDesc.DeployManifest, appManifest);
         Logger.SetApplicationManifest(this._log, appManifest);
         Logger.SetApplicationUrl(this._log, uri2);
         actDesc.SetApplicationManifest(appManifest, uri2, str2);
         actDesc.AppId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[] { actDesc.DeployManifest.Identity, actDesc.AppManifest.Identity });
         flag          = this._subStore.CheckAndReferenceApplication(subscriptionState, actDesc.AppId, num);
         if (!blocking && this._cancellationPending)
         {
             return(true);
         }
         Description effectiveDescription = actDesc.EffectiveDescription;
         productName  = effectiveDescription.Product;
         this._cached = flag;
         Logger.AddInternalState(this._log, "_cached=" + this._cached.ToString());
         Logger.AddInternalState(this._log, "_isupdate=" + this._isupdate.ToString());
         this._tempApplicationDirectory = tempAppDir;
         this._tempDeployment           = tempDeploy;
         this._referenceTransaction     = refTransaction;
         this._actCtx  = ConstructActivationContext(actDesc);
         this._actDesc = actDesc;
     }
     catch (Exception exception3)
     {
         this.LogError(Resources.GetString("Ex_FailedToDownloadManifest"), exception3);
         Logger.AddInternalState(this._log, "Exception thrown in  BindCore(): " + exception3.GetType().ToString() + " : " + exception3.Message + "\r\n" + exception3.StackTrace);
         throw;
     }
     return(false);
 }
예제 #19
0
 private bool BindCore(bool blocking, ref TempFile tempDeploy, ref TempDirectory tempAppDir, ref FileStream refTransaction, ref string productName)
 {
     try
     {
         if (this._deploySource == (Uri)null)
         {
             return(this.BindCoreWithAppId(blocking, ref refTransaction, ref productName));
         }
         Uri deploySource = this._deploySource;
         this._state = DeploymentProgressState.DownloadingDeploymentInformation;
         Logger.AddInternalState(this._log, "Internal state=" + (object)this._state);
         AssemblyManifest      assemblyManifest1 = DownloadManager.DownloadDeploymentManifest(this._subStore, ref deploySource, out tempDeploy, blocking ? (IDownloadNotification)null : (IDownloadNotification)this, this._downloadOptions);
         string                path    = tempDeploy.Path;
         ActivationDescription actDesc = new ActivationDescription();
         actDesc.SetDeploymentManifest(assemblyManifest1, deploySource, path);
         Logger.SetDeploymentManifest(this._log, assemblyManifest1);
         actDesc.IsUpdate = this._isupdate;
         if (actDesc.DeployManifest.Deployment == null)
         {
             throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_NotDeploymentOrShortcut"));
         }
         if (!blocking && this._cancellationPending)
         {
             return(true);
         }
         long transactionId;
         refTransaction = this._subStore.AcquireReferenceTransaction(out transactionId);
         SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(actDesc.DeployManifest);
         if (actDesc.DeployManifest.Deployment.Install && actDesc.DeployManifest.Deployment.ProviderCodebaseUri == (Uri)null && (subscriptionState != null && subscriptionState.DeploymentProviderUri != (Uri)null) && !subscriptionState.DeploymentProviderUri.Equals((object)deploySource))
         {
             throw new DeploymentException(ExceptionTypes.DeploymentUriDifferent, string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("Ex_DeploymentUriDifferentExText"), new object[3]
             {
                 (object)actDesc.DeployManifest.Description.FilteredProduct,
                 (object)deploySource.AbsoluteUri,
                 (object)subscriptionState.DeploymentProviderUri.AbsoluteUri
             }));
         }
         DefinitionAppId appId;
         try
         {
             appId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[2]
             {
                 actDesc.DeployManifest.Identity,
                 new DefinitionIdentity(actDesc.DeployManifest.MainDependentAssembly.Identity)
             });
         }
         catch (COMException ex)
         {
             throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), (Exception)ex);
         }
         catch (SEHException ex)
         {
             throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), (Exception)ex);
         }
         Logger.AddInternalState(this._log, "expectedAppId=" + appId.ToString());
         bool flag1 = this._subStore.CheckAndReferenceApplication(subscriptionState, appId, transactionId);
         if (flag1 && appId.Equals((object)subscriptionState.CurrentBind))
         {
             Logger.AddInternalState(this._log, "Application is found in store and it is the CurrentBind. Binding with appid.");
             this._bindAppId = appId;
             return(this.BindCoreWithAppId(blocking, ref refTransaction, ref productName));
         }
         if (flag1)
         {
             Logger.AddInternalState(this._log, "Application is found in store but it is not the CurrentBind.");
         }
         else
         {
             Logger.AddInternalState(this._log, "Application is not found in store.");
         }
         if (!blocking && this._cancellationPending)
         {
             return(true);
         }
         this._state = DeploymentProgressState.DownloadingApplicationInformation;
         Logger.AddInternalState(this._log, "Internal state=" + (object)this._state);
         tempAppDir = this._subStore.AcquireTempDirectory();
         Uri              appSourceUri;
         string           appManifestPath;
         AssemblyManifest assemblyManifest2 = DownloadManager.DownloadApplicationManifest(actDesc.DeployManifest, tempAppDir.Path, actDesc.DeploySourceUri, blocking ? (IDownloadNotification)null : (IDownloadNotification)this, this._downloadOptions, out appSourceUri, out appManifestPath);
         AssemblyManifest.ReValidateManifestSignatures(actDesc.DeployManifest, assemblyManifest2);
         Logger.SetApplicationManifest(this._log, assemblyManifest2);
         Logger.SetApplicationUrl(this._log, appSourceUri);
         actDesc.SetApplicationManifest(assemblyManifest2, appSourceUri, appManifestPath);
         actDesc.AppId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[2]
         {
             actDesc.DeployManifest.Identity,
             actDesc.AppManifest.Identity
         });
         bool flag2 = this._subStore.CheckAndReferenceApplication(subscriptionState, actDesc.AppId, transactionId);
         if (!blocking && this._cancellationPending)
         {
             return(true);
         }
         Description effectiveDescription = actDesc.EffectiveDescription;
         productName  = effectiveDescription.Product;
         this._cached = flag2;
         Logger.AddInternalState(this._log, "_cached=" + this._cached.ToString());
         Logger.AddInternalState(this._log, "_isupdate=" + this._isupdate.ToString());
         this._tempApplicationDirectory = tempAppDir;
         this._tempDeployment           = tempDeploy;
         this._referenceTransaction     = refTransaction;
         this._actCtx  = DeploymentManager.ConstructActivationContext(actDesc);
         this._actDesc = actDesc;
     }
     catch (Exception ex)
     {
         this.LogError(Resources.GetString("Ex_FailedToDownloadManifest"), ex);
         Logger.AddInternalState(this._log, "Exception thrown in  BindCore(): " + ex.GetType().ToString() + " : " + ex.Message + "\r\n" + ex.StackTrace);
         throw;
     }
     return(false);
 }
예제 #20
0
        private static AssemblyManifest DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, out SubscriptionState subState, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
        {
            Logger.AddMethodCall("DownloadDeploymentManifestDirectBypass called.");
            subState = (SubscriptionState)null;
            tempFile = subStore.AcquireTempFile(".application");
            DownloadManager.DownloadManifestAsRawFile(ref sourceUri, tempFile.Path, notification, options, out serverInformation);
            bool             flag1      = false;
            AssemblyManifest deployment = (AssemblyManifest)null;
            DefinitionAppId  appId      = (DefinitionAppId)null;

            try
            {
                deployment = ManifestReader.FromDocumentNoValidation(tempFile.Path);
                DefinitionIdentity identity           = deployment.Identity;
                DefinitionIdentity definitionIdentity = new DefinitionIdentity(deployment.MainDependentAssembly.Identity);
                appId = new DefinitionAppId((sourceUri.Query == null || sourceUri.Query.Length <= 0 ? sourceUri : new Uri(sourceUri.GetLeftPart(UriPartial.Path))).AbsoluteUri, new DefinitionIdentity[2]
                {
                    identity,
                    definitionIdentity
                });
                Logger.AddInternalState("expectedAppId=" + appId.ToString());
            }
            catch (InvalidDeploymentException ex)
            {
                flag1 = true;
            }
            catch (COMException ex)
            {
                flag1 = true;
            }
            catch (SEHException ex)
            {
                flag1 = true;
            }
            catch (IndexOutOfRangeException ex)
            {
                flag1 = true;
            }
            if (!flag1)
            {
                SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment);
                bool flag2 = false;
                long transactionId;
                using (subStore.AcquireReferenceTransaction(out transactionId))
                    flag2 = subStore.CheckAndReferenceApplication(subscriptionState, appId, transactionId);
                if (!flag2 || !appId.Equals((object)subscriptionState.CurrentBind))
                {
                    if (flag2)
                    {
                        Logger.AddInternalState("Application is found in store and but it is not the CurrentBind.");
                    }
                }
                else
                {
                    Logger.AddInternalState("Application is found in store and it is the CurrentBind, bypass validation and further downloads.");
                    subState = subscriptionState;
                    return(subState.CurrentDeploymentManifest);
                }
            }
            else
            {
                Logger.AddInternalState("Application is not found in store.");
            }
            Logger.AddInternalState("Reparse the deployment manifest for validations.");
            AssemblyManifest assemblyManifest = ManifestReader.FromDocument(tempFile.Path, AssemblyManifest.ManifestType.Deployment, sourceUri);

            if (assemblyManifest.Identity.Version == (Version)null)
            {
                throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_DeploymentManifestNoVersion"));
            }
            if (assemblyManifest.Deployment == null)
            {
                throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_InvalidDeploymentManifest"));
            }
            return(assemblyManifest);
        }
 private bool BindCore(bool blocking, ref TempFile tempDeploy, ref TempDirectory tempAppDir, ref FileStream refTransaction, ref string productName)
 {
     try
     {
         long num;
         Uri uri2;
         string str2;
         if (this._deploySource == null)
         {
             return this.BindCoreWithAppId(blocking, ref refTransaction, ref productName);
         }
         bool flag = false;
         AssemblyManifest manifest = null;
         string manifestPath = null;
         Uri sourceUri = this._deploySource;
         this._state = DeploymentProgressState.DownloadingDeploymentInformation;
         Logger.AddInternalState(this._log, "Internal state=" + this._state);
         manifest = DownloadManager.DownloadDeploymentManifest(this._subStore, ref sourceUri, out tempDeploy, blocking ? null : this, this._downloadOptions);
         manifestPath = tempDeploy.Path;
         System.Deployment.Application.ActivationDescription actDesc = new System.Deployment.Application.ActivationDescription();
         actDesc.SetDeploymentManifest(manifest, sourceUri, manifestPath);
         Logger.SetDeploymentManifest(this._log, manifest);
         actDesc.IsUpdate = this._isupdate;
         if (actDesc.DeployManifest.Deployment == null)
         {
             throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_NotDeploymentOrShortcut"));
         }
         if (!blocking && this._cancellationPending)
         {
             return true;
         }
         refTransaction = this._subStore.AcquireReferenceTransaction(out num);
         SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(actDesc.DeployManifest);
         if (((actDesc.DeployManifest.Deployment.Install && (actDesc.DeployManifest.Deployment.ProviderCodebaseUri == null)) && ((subscriptionState != null) && (subscriptionState.DeploymentProviderUri != null))) && !subscriptionState.DeploymentProviderUri.Equals(sourceUri))
         {
             throw new DeploymentException(ExceptionTypes.DeploymentUriDifferent, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DeploymentUriDifferentExText"), new object[] { actDesc.DeployManifest.Description.FilteredProduct, sourceUri.AbsoluteUri, subscriptionState.DeploymentProviderUri.AbsoluteUri }));
         }
         DefinitionAppId appId = null;
         try
         {
             appId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[] { actDesc.DeployManifest.Identity, new DefinitionIdentity(actDesc.DeployManifest.MainDependentAssembly.Identity) });
         }
         catch (COMException exception)
         {
             throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), exception);
         }
         catch (SEHException exception2)
         {
             throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), exception2);
         }
         Logger.AddInternalState(this._log, "expectedAppId=" + appId.ToString());
         flag = this._subStore.CheckAndReferenceApplication(subscriptionState, appId, num);
         if (flag && appId.Equals(subscriptionState.CurrentBind))
         {
             Logger.AddInternalState(this._log, "Application is found in store and it is the CurrentBind. Binding with appid.");
             this._bindAppId = appId;
             return this.BindCoreWithAppId(blocking, ref refTransaction, ref productName);
         }
         if (flag)
         {
             Logger.AddInternalState(this._log, "Application is found in store but it is not the CurrentBind.");
         }
         else
         {
             Logger.AddInternalState(this._log, "Application is not found in store.");
         }
         if (!blocking && this._cancellationPending)
         {
             return true;
         }
         this._state = DeploymentProgressState.DownloadingApplicationInformation;
         Logger.AddInternalState(this._log, "Internal state=" + this._state);
         tempAppDir = this._subStore.AcquireTempDirectory();
         AssemblyManifest appManifest = DownloadManager.DownloadApplicationManifest(actDesc.DeployManifest, tempAppDir.Path, actDesc.DeploySourceUri, blocking ? null : this, this._downloadOptions, out uri2, out str2);
         AssemblyManifest.ReValidateManifestSignatures(actDesc.DeployManifest, appManifest);
         Logger.SetApplicationManifest(this._log, appManifest);
         Logger.SetApplicationUrl(this._log, uri2);
         actDesc.SetApplicationManifest(appManifest, uri2, str2);
         actDesc.AppId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[] { actDesc.DeployManifest.Identity, actDesc.AppManifest.Identity });
         flag = this._subStore.CheckAndReferenceApplication(subscriptionState, actDesc.AppId, num);
         if (!blocking && this._cancellationPending)
         {
             return true;
         }
         Description effectiveDescription = actDesc.EffectiveDescription;
         productName = effectiveDescription.Product;
         this._cached = flag;
         Logger.AddInternalState(this._log, "_cached=" + this._cached.ToString());
         Logger.AddInternalState(this._log, "_isupdate=" + this._isupdate.ToString());
         this._tempApplicationDirectory = tempAppDir;
         this._tempDeployment = tempDeploy;
         this._referenceTransaction = refTransaction;
         this._actCtx = ConstructActivationContext(actDesc);
         this._actDesc = actDesc;
     }
     catch (Exception exception3)
     {
         this.LogError(Resources.GetString("Ex_FailedToDownloadManifest"), exception3);
         Logger.AddInternalState(this._log, "Exception thrown in  BindCore(): " + exception3.GetType().ToString() + " : " + exception3.Message + "\r\n" + exception3.StackTrace);
         throw;
     }
     return false;
 }
 public static void RemoveCachedTrust(DefinitionAppId appId)
 {
     ApplicationSecurityManager.UserApplicationTrusts.Remove(appId.ToApplicationIdentity(), ApplicationVersionMatch.MatchExactVersion);
 }
예제 #23
0
 public static void RemoveCachedTrust(DefinitionAppId appId)
 {
     ApplicationSecurityManager.UserApplicationTrusts.Remove(appId.ToApplicationIdentity(), ApplicationVersionMatch.MatchExactVersion);
 }
 private static AssemblyManifest DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, out SubscriptionState subState, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
 {
     Logger.AddMethodCall("DownloadDeploymentManifestDirectBypass called.");
     subState = null;
     tempFile = subStore.AcquireTempFile(".application");
     DownloadManifestAsRawFile(ref sourceUri, tempFile.Path, notification, options, out serverInformation);
     bool flag = false;
     AssemblyManifest deployment = null;
     DefinitionIdentity identity = null;
     DefinitionIdentity identity2 = null;
     DefinitionAppId appId = null;
     try
     {
         deployment = ManifestReader.FromDocumentNoValidation(tempFile.Path);
         identity = deployment.Identity;
         identity2 = new DefinitionIdentity(deployment.MainDependentAssembly.Identity);
         Uri uri = ((sourceUri.Query != null) && (sourceUri.Query.Length > 0)) ? new Uri(sourceUri.GetLeftPart(UriPartial.Path)) : sourceUri;
         appId = new DefinitionAppId(uri.AbsoluteUri, new DefinitionIdentity[] { identity, identity2 });
         Logger.AddInternalState("expectedAppId=" + appId.ToString());
     }
     catch (InvalidDeploymentException)
     {
         flag = true;
     }
     catch (COMException)
     {
         flag = true;
     }
     catch (SEHException)
     {
         flag = true;
     }
     catch (IndexOutOfRangeException)
     {
         flag = true;
     }
     if (!flag)
     {
         long num;
         SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment);
         bool flag2 = false;
         using (subStore.AcquireReferenceTransaction(out num))
         {
             flag2 = subStore.CheckAndReferenceApplication(subscriptionState, appId, num);
         }
         if (flag2 && appId.Equals(subscriptionState.CurrentBind))
         {
             Logger.AddInternalState("Application is found in store and it is the CurrentBind, bypass validation and further downloads.");
             subState = subscriptionState;
             return subState.CurrentDeploymentManifest;
         }
         flag = true;
         if (flag2)
         {
             Logger.AddInternalState("Application is found in store and but it is not the CurrentBind.");
         }
     }
     else
     {
         Logger.AddInternalState("Application is not found in store.");
     }
     Logger.AddInternalState("Reparse the deployment manifest for validations.");
     AssemblyManifest manifest2 = ManifestReader.FromDocument(tempFile.Path, AssemblyManifest.ManifestType.Deployment, sourceUri);
     if (manifest2.Identity.Version == null)
     {
         throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_DeploymentManifestNoVersion"));
     }
     if (manifest2.Deployment == null)
     {
         throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_InvalidDeploymentManifest"));
     }
     return manifest2;
 }
 internal DeploymentManager(string appId, bool isUpdate, bool isConfirmed, DownloadOptions downloadOptions, AsyncOperation optionalAsyncOp) : this((Uri) null, isUpdate, isConfirmed, downloadOptions, optionalAsyncOp)
 {
     this._bindAppId = new DefinitionAppId(appId);
 }
예제 #26
0
 internal DeploymentManager(string appId, bool isUpdate, bool isConfirmed, DownloadOptions downloadOptions, AsyncOperation optionalAsyncOp) : this((Uri)null, isUpdate, isConfirmed, downloadOptions, optionalAsyncOp)
 {
     this._bindAppId = new DefinitionAppId(appId);
 }
 private static ActivationContext ConstructActivationContextFromStore(DefinitionAppId defAppId)
 {
     return ActivationContext.CreatePartialActivationContext(defAppId.ToApplicationIdentity());
 }