internal static AssemblyManifest FromDocument(string localPath, AssemblyManifest.ManifestType manifestType, Uri sourceUri)
        {
            AssemblyManifest manifest;

            CodeMarker_Singleton.Instance.CodeMarker(CodeMarkerEvent.perfParseBegin);
            Logger.AddMethodCall("ManifestReader.FromDocument(" + localPath + ") called.");
            FileInfo info = new FileInfo(localPath);

            if (info.Length > 0x1000000L)
            {
                throw new DeploymentException(Resources.GetString("Ex_ManifestFileTooLarge"));
            }
            FileStream input = new FileStream(localPath, FileMode.Open, FileAccess.Read);

            try
            {
                XmlReader reader = PolicyKeys.SkipSchemaValidation() ? XmlReader.Create(input) : ManifestValidatingReader.Create(input);
                while (reader.Read())
                {
                }
                Logger.AddInternalState("Schema validation passed.");
                manifest = new AssemblyManifest(input);
                Logger.AddInternalState("Manifest is parsed successfully.");
                if (!PolicyKeys.SkipSemanticValidation())
                {
                    manifest.ValidateSemantics(manifestType);
                }
                Logger.AddInternalState("Semantic validation passed.");
                if (!PolicyKeys.SkipSignatureValidation())
                {
                    input.Position = 0L;
                    manifest.ValidateSignature(input);
                }
                Logger.AddInternalState("Signature validation passed.");
            }
            catch (XmlException exception)
            {
                string message = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_ManifestFromDocument"), new object[] { (sourceUri != null) ? sourceUri.AbsoluteUri : Path.GetFileName(localPath) });
                throw new InvalidDeploymentException(ExceptionTypes.ManifestParse, message, exception);
            }
            catch (XmlSchemaValidationException exception2)
            {
                string str2 = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_ManifestFromDocument"), new object[] { (sourceUri != null) ? sourceUri.AbsoluteUri : Path.GetFileName(localPath) });
                throw new InvalidDeploymentException(ExceptionTypes.ManifestParse, str2, exception2);
            }
            catch (InvalidDeploymentException exception3)
            {
                string str3 = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_ManifestFromDocument"), new object[] { (sourceUri != null) ? sourceUri.AbsoluteUri : Path.GetFileName(localPath) });
                throw new InvalidDeploymentException(ExceptionTypes.ManifestParse, str3, exception3);
            }
            finally
            {
                if (input != null)
                {
                    input.Dispose();
                }
            }
            CodeMarker_Singleton.Instance.CodeMarker(CodeMarkerEvent.perfParseEnd);
            return(manifest);
        }
Пример #2
0
 internal DeploymentManager(Uri deploymentSource, bool isUpdate, bool isConfirmed, DownloadOptions downloadOptions, AsyncOperation optionalAsyncOp)
 {
     this._deploySource          = deploymentSource;
     this._isupdate              = isUpdate;
     this._isConfirmed           = isConfirmed;
     this._downloadOptions       = downloadOptions;
     this._events                = new EventHandlerList();
     this._syncGroupMap          = CollectionsUtil.CreateCaseInsensitiveHashtable();
     this._subStore              = SubscriptionStore.CurrentUser;
     this.bindWorker             = new ThreadStart(this.BindAsyncWorker);
     this.synchronizeWorker      = new ThreadStart(this.SynchronizeAsyncWorker);
     this.synchronizeGroupWorker = new WaitCallback(this.SynchronizeGroupAsyncWorker);
     this.bindCompleted          = new SendOrPostCallback(this.BindAsyncCompleted);
     this.synchronizeCompleted   = new SendOrPostCallback(this.SynchronizeAsyncCompleted);
     this.progressReporter       = new SendOrPostCallback(this.ProgressReporter);
     this.asyncOperation         = optionalAsyncOp != null ? optionalAsyncOp : AsyncOperationManager.CreateOperation((object)null);
     this._log = Logger.StartLogging();
     if (deploymentSource != (Uri)null)
     {
         Logger.SetSubscriptionUrl(this._log, deploymentSource);
     }
     this._assertApplicationReqEvents    = new ManualResetEvent[3];
     this._assertApplicationReqEvents[0] = this._trustNotGrantedEvent;
     this._assertApplicationReqEvents[1] = this._platformRequirementsFailedEvent;
     this._assertApplicationReqEvents[2] = this._trustGrantedEvent;
     this._callerType = DeploymentManager.CallerType.Other;
     PolicyKeys.SkipApplicationDependencyHashCheck();
     PolicyKeys.SkipDeploymentProvider();
     PolicyKeys.SkipSchemaValidation();
     PolicyKeys.SkipSemanticValidation();
     PolicyKeys.SkipSignatureValidation();
 }
Пример #3
0
        internal static AssemblyManifest FromDocument(string localPath, AssemblyManifest.ManifestType manifestType, Uri sourceUri)
        {
            CodeMarker_Singleton.Instance.CodeMarker(7302);
            Logger.AddMethodCall("ManifestReader.FromDocument(" + localPath + ") called.");
            if (new FileInfo(localPath).Length > 16777216L)
            {
                throw new DeploymentException(Resources.GetString("Ex_ManifestFileTooLarge"));
            }
            AssemblyManifest assemblyManifest;

            using (FileStream fileStream = new FileStream(localPath, FileMode.Open, FileAccess.Read))
            {
                try
                {
                    XmlReader xmlReader = PolicyKeys.SkipSchemaValidation() ? XmlReader.Create((Stream)fileStream, new XmlReaderSettings()
                    {
                        DtdProcessing = DtdProcessing.Prohibit,
                        XmlResolver   = (XmlResolver)null
                    }) : ManifestValidatingReader.Create((Stream)fileStream);
                    do
                    {
                        ;
                    }while (xmlReader.Read());
                    Logger.AddInternalState("Schema validation passed.");
                    assemblyManifest = new AssemblyManifest(fileStream);
                    Logger.AddInternalState("Manifest is parsed successfully.");
                    if (!PolicyKeys.SkipSemanticValidation())
                    {
                        assemblyManifest.ValidateSemantics(manifestType);
                    }
                    Logger.AddInternalState("Semantic validation passed.");
                    if (!PolicyKeys.SkipSignatureValidation())
                    {
                        fileStream.Position = 0L;
                        assemblyManifest.ValidateSignature((Stream)fileStream);
                    }
                    Logger.AddInternalState("Signature validation passed.");
                }
                catch (XmlException ex)
                {
                    throw new InvalidDeploymentException(ExceptionTypes.ManifestParse, string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("Ex_ManifestFromDocument"), new object[1]
                    {
                        (object)(sourceUri != (Uri)null ? sourceUri.AbsoluteUri : Path.GetFileName(localPath))
                    }), (Exception)ex);
                }
                catch (XmlSchemaValidationException ex)
                {
                    throw new InvalidDeploymentException(ExceptionTypes.ManifestParse, string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("Ex_ManifestFromDocument"), new object[1]
                    {
                        (object)(sourceUri != (Uri)null ? sourceUri.AbsoluteUri : Path.GetFileName(localPath))
                    }), (Exception)ex);
                }
                catch (InvalidDeploymentException ex)
                {
                    throw new InvalidDeploymentException(ExceptionTypes.ManifestParse, string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("Ex_ManifestFromDocument"), new object[1]
                    {
                        (object)(sourceUri != (Uri)null ? sourceUri.AbsoluteUri : Path.GetFileName(localPath))
                    }), (Exception)ex);
                }
            }
            CodeMarker_Singleton.Instance.CodeMarker(7303);
            return(assemblyManifest);
        }