예제 #1
0
        public DependentAssembly(AssemblyReferenceEntry assemblyReferenceEntry)
        {
            AssemblyReferenceDependentAssemblyEntry dependentAssembly = assemblyReferenceEntry.DependentAssembly;

            this._size     = dependentAssembly.Size;
            this._codebase = dependentAssembly.Codebase;
            this._group    = dependentAssembly.Group;
            bool     flag         = false;
            ISection hashElements = dependentAssembly.HashElements;
            uint     celt         = hashElements != null ? hashElements.Count : 0U;

            if (celt > 0U)
            {
                uint celtFetched = 0;
                IHashElementEntry[] hashElementEntryArray = new IHashElementEntry[(int)celt];
                Marshal.ThrowExceptionForHR(((System.Deployment.Internal.Isolation.IEnumUnknown)hashElements._NewEnum).Next(celt, (object[])hashElementEntryArray, ref celtFetched));
                if ((int)celtFetched != (int)celt)
                {
                    throw new InvalidDeploymentException(ExceptionTypes.Manifest, Resources.GetString("Ex_IsoEnumFetchNotEqualToCount"));
                }
                for (uint index = 0; index < celt; ++index)
                {
                    HashElementEntry allData = hashElementEntryArray[(int)index].AllData;
                    if (allData.DigestValueSize > 0U)
                    {
                        byte[] numArray = new byte[(int)allData.DigestValueSize];
                        Marshal.Copy(allData.DigestValue, numArray, 0, (int)allData.DigestValueSize);
                        this._hashCollection.AddHash(numArray, (CMS_HASH_DIGESTMETHOD)allData.DigestMethod, (CMS_HASH_TRANSFORM)allData.Transform);
                        flag = true;
                    }
                }
            }
            if (!flag && dependentAssembly.HashValueSize > 0U)
            {
                byte[] numArray = new byte[(int)dependentAssembly.HashValueSize];
                Marshal.Copy(dependentAssembly.HashValue, numArray, 0, (int)dependentAssembly.HashValueSize);
                this._hashCollection.AddHash(numArray, (CMS_HASH_DIGESTMETHOD)dependentAssembly.HashAlgorithm, CMS_HASH_TRANSFORM.CMS_HASH_TRANSFORM_IDENTITY);
            }
            this._preRequisite = (dependentAssembly.Flags & 4U) > 0U;
            this._optional     = (assemblyReferenceEntry.Flags & 1U) > 0U;
            this._visible      = (dependentAssembly.Flags & 2U) > 0U;
            this._resourceFallbackCultureInternal = (dependentAssembly.Flags & 8U) > 0U;
            this._resourceFallbackCulture         = dependentAssembly.ResourceFallbackCulture;
            this._description = dependentAssembly.Description;
            this._supportUrl  = AssemblyManifest.UriFromMetadataEntry(dependentAssembly.SupportUrl, "Ex_DependencySupportUrlNotValid");
            this._identity    = new System.Deployment.Application.ReferenceIdentity(assemblyReferenceEntry.ReferenceIdentity);
            this._codebaseFS  = System.Deployment.Application.UriHelper.NormalizePathDirectorySeparators(this._codebase);
        }
예제 #2
0
        public File(FileEntry fileEntry)
        {
            this._name     = fileEntry.Name;
            this._loadFrom = fileEntry.LoadFrom;
            this._size     = fileEntry.Size;
            this._group    = fileEntry.Group;
            this._optional = (fileEntry.Flags & 1U) > 0U;
            this._isData   = (fileEntry.WritableType & 2U) > 0U;
            bool     flag         = false;
            ISection hashElements = fileEntry.HashElements;
            uint     celt         = hashElements != null ? hashElements.Count : 0U;

            if (celt > 0U)
            {
                uint celtFetched = 0;
                IHashElementEntry[] hashElementEntryArray = new IHashElementEntry[(int)celt];
                Marshal.ThrowExceptionForHR(((System.Deployment.Internal.Isolation.IEnumUnknown)hashElements._NewEnum).Next(celt, (object[])hashElementEntryArray, ref celtFetched));
                if ((int)celtFetched != (int)celt)
                {
                    throw new InvalidDeploymentException(ExceptionTypes.Manifest, Resources.GetString("Ex_IsoEnumFetchNotEqualToCount"));
                }
                for (uint index = 0; index < celt; ++index)
                {
                    HashElementEntry allData = hashElementEntryArray[(int)index].AllData;
                    if (allData.DigestValueSize > 0U)
                    {
                        byte[] numArray = new byte[(int)allData.DigestValueSize];
                        Marshal.Copy(allData.DigestValue, numArray, 0, (int)allData.DigestValueSize);
                        this._hashCollection.AddHash(numArray, (CMS_HASH_DIGESTMETHOD)allData.DigestMethod, (CMS_HASH_TRANSFORM)allData.Transform);
                        flag = true;
                    }
                }
            }
            if (!flag && fileEntry.HashValueSize > 0U)
            {
                byte[] numArray = new byte[(int)fileEntry.HashValueSize];
                Marshal.Copy(fileEntry.HashValue, numArray, 0, (int)fileEntry.HashValueSize);
                this._hashCollection.AddHash(numArray, (CMS_HASH_DIGESTMETHOD)fileEntry.HashAlgorithm, CMS_HASH_TRANSFORM.CMS_HASH_TRANSFORM_IDENTITY);
            }
            this._nameFS = System.Deployment.Application.UriHelper.NormalizePathDirectorySeparators(this._name);
        }