public AssemblyManifest(Stream stream)
 {
     this._manifestSourceFormat = System.Deployment.Application.Manifest.ManifestSourceFormat.Unknown;
     this.LoadCMSFromStream(stream);
     this._manifestSourceFormat = System.Deployment.Application.Manifest.ManifestSourceFormat.Stream;
     this._sizeInBytes = (ulong) stream.Length;
 }
 public AssemblyManifest(FileStream fileStream)
 {
     this._manifestSourceFormat = System.Deployment.Application.Manifest.ManifestSourceFormat.Unknown;
     this.LoadCMSFromStream(fileStream);
     this._rawXmlFilePath = fileStream.Name;
     this._manifestSourceFormat = System.Deployment.Application.Manifest.ManifestSourceFormat.XmlFile;
     this._sizeInBytes = (ulong) fileStream.Length;
 }
 public AssemblyManifest(System.Deployment.Internal.Isolation.Manifest.ICMS cms)
 {
     this._manifestSourceFormat = System.Deployment.Application.Manifest.ManifestSourceFormat.Unknown;
     if (cms == null)
     {
         throw new ArgumentNullException("cms");
     }
     this._cms = cms;
 }
 public AssemblyManifest(string filePath)
 {
     this._manifestSourceFormat = System.Deployment.Application.Manifest.ManifestSourceFormat.Unknown;
     string extension = Path.GetExtension(filePath);
     StringComparison invariantCultureIgnoreCase = StringComparison.InvariantCultureIgnoreCase;
     if (extension.Equals(".application", invariantCultureIgnoreCase) || extension.Equals(".manifest", invariantCultureIgnoreCase))
     {
         this.LoadFromRawXmlFile(filePath);
     }
     else if (extension.Equals(".dll", invariantCultureIgnoreCase) || extension.Equals(".exe", invariantCultureIgnoreCase))
     {
         this.LoadFromInternalManifestFile(filePath);
     }
     else
     {
         this.LoadFromUnknownFormatFile(filePath);
     }
 }
 private void LoadFromRawXmlFile(string filePath)
 {
     using (FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
     {
         this.LoadCMSFromStream(stream);
         this._rawXmlFilePath = filePath;
         this._manifestSourceFormat = System.Deployment.Application.Manifest.ManifestSourceFormat.XmlFile;
         this._sizeInBytes = (ulong) stream.Length;
     }
 }
 private bool LoadFromPEResources(string filePath)
 {
     byte[] manifestFromPEResources = null;
     try
     {
         manifestFromPEResources = SystemUtils.GetManifestFromPEResources(filePath);
     }
     catch (Win32Exception exception)
     {
         ManifestLoadExceptionHelper(exception, filePath);
     }
     if (manifestFromPEResources != null)
     {
         using (MemoryStream stream = new MemoryStream(manifestFromPEResources))
         {
             this.LoadCMSFromStream(stream);
         }
         this._id1Identity = (System.Deployment.Application.DefinitionIdentity) this.Identity.Clone();
         this._id1RequestedExecutionLevel = this.RequestedExecutionLevel;
         Logger.AddInternalState("_id1Identity = " + ((this._id1Identity == null) ? "null" : this._id1Identity.ToString()));
         this._manifestSourceFormat = System.Deployment.Application.Manifest.ManifestSourceFormat.ID_1;
         return true;
     }
     Logger.AddInternalState("File does not contain ID_1 manifest.");
     return false;
 }
 private bool LoadFromCompLibAssembly(string filePath)
 {
     bool flag;
     try
     {
         using (AssemblyMetaDataImport import = new AssemblyMetaDataImport(filePath))
         {
             AssemblyName name = import.Name;
             this._identity = SystemUtils.GetDefinitionIdentityFromManagedAssembly(filePath);
             this._complibIdentity = (System.Deployment.Application.DefinitionIdentity) this.Identity.Clone();
             AssemblyModule[] files = import.Files;
             AssemblyReference[] references = import.References;
             System.Deployment.Application.Manifest.File[] fileArray = new System.Deployment.Application.Manifest.File[files.Length + 1];
             fileArray[0] = new System.Deployment.Application.Manifest.File(Path.GetFileName(filePath), 0L);
             for (int i = 0; i < files.Length; i++)
             {
                 fileArray[i + 1] = new System.Deployment.Application.Manifest.File(files[i].Name, files[i].Hash, 0L);
             }
             this._files = fileArray;
             DependentAssembly[] assemblyArray = new DependentAssembly[references.Length];
             for (int j = 0; j < references.Length; j++)
             {
                 assemblyArray[j] = new DependentAssembly(new System.Deployment.Application.ReferenceIdentity(references[j].Name.ToString()));
             }
             this._dependentAssemblies = assemblyArray;
             this._manifestSourceFormat = System.Deployment.Application.Manifest.ManifestSourceFormat.CompLib;
             flag = true;
         }
     }
     catch (BadImageFormatException)
     {
         flag = false;
     }
     catch (COMException)
     {
         flag = false;
     }
     catch (SEHException)
     {
         flag = false;
     }
     catch (IOException)
     {
         flag = false;
     }
     return flag;
 }