IsThisAssembly() public method

public IsThisAssembly ( string name ) : bool
name string
return bool
Beispiel #1
0
        public bool IsSuppressUnmanaged(CodeGen codegen)
        {
            string asmname = "";

            BaseTypeRef owner = method_ref.Owner;

            if (owner == null)
            {
                return(false);
            }

            ExternTypeRef etr = owner as ExternTypeRef;

            if (etr != null)
            {
                ExternAssembly ea = etr.ExternRef as ExternAssembly;
                if (ea != null)
                {
                    asmname = ea.Name;
                }
            }

            return(owner.FullName == "System.Security.SuppressUnmanagedCodeSecurityAttribute" &&
                   (asmname == "mscorlib" || codegen.IsThisAssembly("mscorlib")));
        }
Beispiel #2
0
                        public bool Run ()
                        {
                                if (il_file_list.Count == 0)
                                        Usage ();
                                if (output_file == null)
                                        output_file = CreateOutputFilename ();
                                try {
                                        codegen = new CodeGen (output_file, target == Target.Dll, debugging_info);
                                        foreach (string file_path in il_file_list) {
                                                Report.FilePath = file_path;
                                                ProcessFile (file_path);
                                        }
                                        if (scan_only)
                                                return true;

                                        if (Report.ErrorCount > 0)
                                                return false;

                                        if (target != Target.Dll && !codegen.HasEntryPoint)
                                                Report.Error ("No entry point found.");

					// if we have a key and aren't assembling a netmodule
					if ((keyname != null) && !codegen.IsThisAssembly (null)) {
						LoadKey ();
						// this overrides any attribute or .publickey directive in the source
						codegen.ThisAssembly.SetPublicKey (sn.PublicKey);
					}

                                        try {
                                                codegen.Write ();
                                        } catch {
                                                File.Delete (output_file);
                                                throw;
                                        }
                                } catch (ILAsmException e) {
                                        Error (e.ToString ());
                                        return false;
                                } catch (PEAPI.PEFileException pe) {
                                        Error ("Error : " + pe.Message);
                                        return false;
                                } 

                                try {
					if (sn != null) {
						Report.Message ("Signing assembly with the specified strongname keypair");
						return Sign (output_file);
					}
                                } catch {
                                        return false;
                                }

                                return true;
                        }
Beispiel #3
0
                public bool IsSuppressUnmanaged (CodeGen codegen)
                {
			string asmname = "";
			
			BaseTypeRef owner = method_ref.Owner;
			if (owner == null)
				return false;
				
			ExternTypeRef etr = owner as ExternTypeRef;
			if (etr != null) {
				ExternAssembly ea = etr.ExternRef as ExternAssembly;
				if (ea != null)
					asmname = ea.Name;
			}	

                       	return (owner.FullName == "System.Security.SuppressUnmanagedCodeSecurityAttribute" 
				&& (asmname == "mscorlib" || codegen.IsThisAssembly ("mscorlib")) );
                }
Beispiel #4
0
            public bool Run()
            {
                if (il_file_list.Count == 0)
                {
                    Usage();
                }
                if (output_file == null)
                {
                    output_file = CreateOutputFilename();
                }
                try {
                    codegen = new CodeGen(output_file, target == Target.Dll, debugging_info, noautoinherit);
                    foreach (string file_path in il_file_list)
                    {
                        Report.FilePath = file_path;
                        ProcessFile(file_path);
                    }
                    if (scan_only)
                    {
                        return(true);
                    }

                    if (Report.ErrorCount > 0)
                    {
                        return(false);
                    }

                    if (target != Target.Dll && !codegen.HasEntryPoint)
                    {
                        Report.Error("No entry point found.");
                    }

                    // if we have a key and aren't assembling a netmodule
                    if ((keyname != null) && !codegen.IsThisAssembly(null))
                    {
                        LoadKey();
                        // this overrides any attribute or .publickey directive in the source
                        codegen.ThisAssembly.SetPublicKey(sn.PublicKey);
                    }

                    try {
                        codegen.Write();
                    } catch {
                        File.Delete(output_file);
                        throw;
                    }
                } catch (ILAsmException e) {
                    Error(e.ToString());
                    return(false);
                } catch (PEAPI.PEFileException pe) {
                    Error("Error : " + pe.Message);
                    return(false);
                }

                try {
                    if (sn != null)
                    {
                        Report.Message("Signing assembly with the specified strongname keypair");
                        return(Sign(output_file));
                    }
                } catch {
                    return(false);
                }

                return(true);
            }