コード例 #1
0
        public override AssemblyName GetName(bool copiedName)
        {
            string?codeBase = GetCodeBase(copiedName);

            var an = new AssemblyName(GetSimpleName(),
                                      GetPublicKey(),
                                      null, // public key token
                                      GetVersion(),
                                      GetLocale(),
                                      GetHashAlgorithm(),
                                      AssemblyVersionCompatibility.SameMachine,
                                      codeBase,
                                      GetFlags() | AssemblyNameFlags.PublicKey,
                                      null); // strong name key pair

            Module?manifestModule = ManifestModule;

            if (manifestModule != null)
            {
                if (manifestModule.MDStreamVersion > 0x10000)
                {
                    manifestModule.GetPEKind(out PortableExecutableKinds pek, out ImageFileMachine ifm);
                    an.SetProcArchIndex(pek, ifm);
                }
            }
            return(an);
        }
コード例 #2
0
        // If the assembly is copied before it is loaded, the codebase will be set to the
        // actual file loaded if copiedName is true. If it is false, then the original code base
        // is returned.
        public override AssemblyName GetName(bool copiedName)
        {
            string?codeBase = GetCodeBase();

            var an = new AssemblyName(GetSimpleName(),
                                      GetPublicKey(),
                                      null, // public key token
                                      GetVersion(),
                                      GetLocale(),
                                      GetFlags() | AssemblyNameFlags.PublicKey);

#pragma warning disable IL3000 // System.Reflection.AssemblyName.CodeBase' always returns an empty string for assemblies embedded in a single-file app.
            an.CodeBase = codeBase;
#pragma warning restore IL3000

#pragma warning disable SYSLIB0037 // AssemblyName.HashAlgorithm is obsolete
            an.HashAlgorithm = GetHashAlgorithm();
#pragma warning restore SYSLIB0037

            Module manifestModule = ManifestModule;
            if (manifestModule.MDStreamVersion > 0x10000)
            {
                manifestModule.GetPEKind(out PortableExecutableKinds pek, out ImageFileMachine ifm);
                an.SetProcArchIndex(pek, ifm);
            }
            return(an);
        }
コード例 #3
0
ファイル: RuntimeAssembly.cs プロジェクト: mikem8361/runtime
        // If the assembly is copied before it is loaded, the codebase will be set to the
        // actual file loaded if copiedName is true. If it is false, then the original code base
        // is returned.
        public override AssemblyName GetName(bool copiedName)
        {
            var an = new AssemblyName();

            an.Name        = GetSimpleName();
            an.Version     = GetVersion();
            an.CultureInfo = GetLocale();

            an.SetPublicKey(GetPublicKey());

            an.RawFlags = GetFlags() | AssemblyNameFlags.PublicKey;

#pragma warning disable IL3000, SYSLIB0044 // System.Reflection.AssemblyName.CodeBase' always returns an empty string for assemblies embedded in a single-file app.
                                           // AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete. Using them for loading an assembly is not supported.
            an.CodeBase = GetCodeBase();
#pragma warning restore IL3000, SYSLIB0044

#pragma warning disable SYSLIB0037 // AssemblyName.HashAlgorithm is obsolete
            an.HashAlgorithm = GetHashAlgorithm();
#pragma warning restore SYSLIB0037

            Module manifestModule = ManifestModule;
            if (manifestModule.MDStreamVersion > 0x10000)
            {
                manifestModule.GetPEKind(out PortableExecutableKinds pek, out ImageFileMachine ifm);
                an.SetProcArchIndex(pek, ifm);
            }
            return(an);
        }
コード例 #4
0
        public override AssemblyName GetName(bool copiedName)
        {
            AssemblyName name     = new AssemblyName();
            string       codeBase = this.GetCodeBase(copiedName);

            this.VerifyCodeBaseDiscovery(codeBase);
            name.Init(this.GetSimpleName(), this.GetPublicKey(), null, this.GetVersion(), this.GetLocale(), this.GetHashAlgorithm(), AssemblyVersionCompatibility.SameMachine, codeBase, this.GetFlags() | AssemblyNameFlags.PublicKey, null);
            Module manifestModule = this.ManifestModule;

            if ((manifestModule != null) && (manifestModule.MDStreamVersion > 0x10000))
            {
                PortableExecutableKinds kinds;
                ImageFileMachine        machine;
                this.ManifestModule.GetPEKind(out kinds, out machine);
                name.SetProcArchIndex(kinds, machine);
            }
            return(name);
        }
コード例 #5
0
ファイル: Assembly.cs プロジェクト: afrog33k/csnative
        public override AssemblyName GetName(bool copiedName)
        {
            AssemblyName an = new AssemblyName();

            String codeBase = GetCodeBase(copiedName);
            VerifyCodeBaseDiscovery(codeBase);

            an.Init(GetSimpleName(), 
                    GetPublicKey(),
                    null, // public key token
                    GetVersion(),
                    GetLocale(),
                    GetHashAlgorithm(),
                    AssemblyVersionCompatibility.SameMachine,
                    codeBase,
                    GetFlags() | AssemblyNameFlags.PublicKey,
                    null); // strong name key pair

            PortableExecutableKinds pek;
            ImageFileMachine ifm;
        
            Module manifestModule = ManifestModule;
            if (manifestModule != null)
            {
                if (manifestModule.MDStreamVersion > 0x10000)
                {
                    ManifestModule.GetPEKind(out pek, out ifm);
                    an.SetProcArchIndex(pek,ifm);
                }
            }
            return an;
        }
 public override AssemblyName GetName(bool copiedName)
 {
     AssemblyName name = new AssemblyName();
     string codeBase = this.GetCodeBase(copiedName);
     this.VerifyCodeBaseDiscovery(codeBase);
     name.Init(this.GetSimpleName(), this.GetPublicKey(), null, this.GetVersion(), this.GetLocale(), this.GetHashAlgorithm(), AssemblyVersionCompatibility.SameMachine, codeBase, this.GetFlags() | AssemblyNameFlags.PublicKey, null);
     Module manifestModule = this.ManifestModule;
     if ((manifestModule != null) && (manifestModule.MDStreamVersion > 0x10000))
     {
         PortableExecutableKinds kinds;
         ImageFileMachine machine;
         this.ManifestModule.GetPEKind(out kinds, out machine);
         name.SetProcArchIndex(kinds, machine);
     }
     return name;
 }