Mon Sep 16 19:02:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Mon, 16 Sep 2002 17:07:27 +0000 (17:07 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Mon, 16 Sep 2002 17:07:27 +0000 (17:07 -0000)
* AssemblyBuilder.c: special case some custom attributes.

svn path=/trunk/mcs/; revision=7514

mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
mcs/class/corlib/System.Reflection.Emit/ChangeLog

index 8bc264e8029c6d84190f61084cd299da18277901..71990fb4d69744bc7db3d4aed66983eeb41d7649 100755 (executable)
@@ -34,6 +34,13 @@ namespace System.Reflection.Emit {
                private string dir;
                private CustomAttributeBuilder[] cattrs;
                private MonoResource[] resources;
+               string keyfile;
+               string version;
+               string culture;
+               uint algid;
+               uint flags;
+               PEFileKinds pekind = PEFileKinds.Dll;
+               bool delay_sign;
                internal Type corlib_object_type = typeof (System.Object);
                internal Type corlib_value_type = typeof (System.ValueType);
                internal Type corlib_enum_type = typeof (System.Enum);
@@ -267,15 +274,55 @@ namespace System.Reflection.Emit {
 
                public void SetEntryPoint (MethodInfo entryMethod)
                {
-                       entry_point = entryMethod;
+                       SetEntryPoint (entryMethod, PEFileKinds.ConsoleApplication);
                }
 
                public void SetEntryPoint (MethodInfo entryMethod, PEFileKinds fileKind)
                {
                        entry_point = entryMethod;
+                       pekind = fileKind;
                }
 
                public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+                       string attrname = customBuilder.Ctor.ReflectedType.FullName;
+                       byte[] data;
+                       int len, pos;
+                       if (attrname == "System.Reflection.AssemblyVersionAttribute") {
+                               data = customBuilder.Data;
+                               pos = 2;
+                               len = CustomAttributeBuilder.decode_len (data, pos, out pos);
+                               version = CustomAttributeBuilder.string_from_bytes (data, pos, len);
+                               return;
+                       } else if (attrname == "System.Reflection.AssemblyKeyFileAttribute") {
+                               data = customBuilder.Data;
+                               pos = 2;
+                               len = CustomAttributeBuilder.decode_len (data, pos, out pos);
+                               keyfile = CustomAttributeBuilder.string_from_bytes (data, pos, len);
+                       } else if (attrname == "System.Reflection.AssemblyCultureAttribute") {
+                               data = customBuilder.Data;
+                               pos = 2;
+                               len = CustomAttributeBuilder.decode_len (data, pos, out pos);
+                               culture = CustomAttributeBuilder.string_from_bytes (data, pos, len);
+                       } else if (attrname == "System.Reflection.AssemblyAlgorithmIdAttribute") {
+                               data = customBuilder.Data;
+                               pos = 2;
+                               algid = (uint)data [pos];
+                               algid |= ((uint)data [pos + 1]) << 8;
+                               algid |= ((uint)data [pos + 2]) << 16;
+                               algid |= ((uint)data [pos + 3]) << 24;
+                       } else if (attrname == "System.Reflection.AssemblyFlagsAttribute") {
+                               data = customBuilder.Data;
+                               pos = 2;
+                               flags = (uint)data [pos];
+                               flags |= ((uint)data [pos + 1]) << 8;
+                               flags |= ((uint)data [pos + 2]) << 16;
+                               flags |= ((uint)data [pos + 3]) << 24;
+                               return;
+                       } else if (attrname == "System.Reflection.AssemblyDelaySignAttribute") {
+                               data = customBuilder.Data;
+                               pos = 2;
+                               delay_sign = data [2] != 0;
+                       }
                        if (cattrs != null) {
                                CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
                                cattrs.CopyTo (new_array, 0);
index 5ea73419b83320d1090a95d9440a68218c531f07..5ae4f5ed3ed79748eca9a95d90d0e3ccdf700fec 100644 (file)
@@ -1,3 +1,8 @@
+
+Mon Sep 16 19:02:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+       * AssemblyBuilder.c: special case some custom attributes.
+
 2002-09-12  Dick Porter  <dick@ximian.com>
 
        * TypeBuilder.cs: Say _which_ Type has already been created