+ this.corlib_enum_type = corlib_enum_type;
+ }
+
+ internal void SetCorlibTypeBuilders (Type corlib_object_type, Type corlib_value_type, Type corlib_enum_type, Type corlib_void_type)
+ {
+ SetCorlibTypeBuilders (corlib_object_type, corlib_value_type, corlib_enum_type);
+ this.corlib_void_type = corlib_void_type;
+ }
+
+ private Exception not_supported () {
+ // Strange message but this is what MS.NET prints...
+ return new NotSupportedException ("The invoked member is not supported in a dynamic module.");
+ }
+
+ private void check_name_and_filename (string name, string fileName,
+ bool fileNeedsToExists) {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (fileName == null)
+ throw new ArgumentNullException ("fileName");
+ if (name == "")
+ throw new ArgumentException ("name cannot be empty", "name");
+ if (fileName == "")
+ throw new ArgumentException ("fileName cannot be empty", "fileName");
+ if (Path.GetFileName (fileName) != fileName)
+ throw new ArgumentException ("fileName '" + fileName + "' must not include a path.");
+
+ // Resource files are created/searched under the assembly storage
+ // directory
+ string fullFileName = fileName;
+ if (dir != null)
+ fullFileName = Path.Combine (dir, fileName);
+
+ if (fileNeedsToExists && !File.Exists (fullFileName))
+ throw new FileNotFoundException ("Could not find file '" + fileName + "'");
+
+ if (resources != null) {
+ for (int i = 0; i < resources.Length; ++i) {
+ if (resources [i].filename == fullFileName)
+ throw new ArgumentException ("Duplicate file name '" + fileName + "'");
+ if (resources [i].name == name)
+ throw new ArgumentException ("Duplicate name '" + name + "'");
+ }
+ }
+
+ if (modules != null) {
+ for (int i = 0; i < modules.Length; ++i) {
+ // Use fileName instead of fullFileName here
+ if (!modules [i].IsTransient () && (modules [i].FileName == fileName))
+ throw new ArgumentException ("Duplicate file name '" + fileName + "'");
+ if (modules [i].Name == name)
+ throw new ArgumentException ("Duplicate name '" + name + "'");
+ }
+ }
+ }
+
+ private String create_assembly_version (String version) {
+ String[] parts = version.Split ('.');
+ int[] ver = new int [4] { 0, 0, 0, 0 };
+
+ if ((parts.Length < 0) || (parts.Length > 4))
+ throw new ArgumentException ("The version specified '" + version + "' is invalid");
+
+ for (int i = 0; i < parts.Length; ++i) {
+ if (parts [i] == "*") {
+ DateTime now = DateTime.Now;
+
+ if (i == 2) {
+ ver [2] = (now - new DateTime (2000, 1, 1)).Days;
+ if (parts.Length == 3)
+ ver [3] = (now.Second + (now.Minute * 60) + (now.Hour * 3600)) / 2;
+ }
+ else
+ if (i == 3)
+ ver [3] = (now.Second + (now.Minute * 60) + (now.Hour * 3600)) / 2;
+ else
+ throw new ArgumentException ("The version specified '" + version + "' is invalid");
+ }
+ else {
+ try {
+ ver [i] = Int32.Parse (parts [i]);
+ }
+ catch (FormatException) {
+ throw new ArgumentException ("The version specified '" + version + "' is invalid");
+ }
+ }
+ }
+
+ return ver [0] + "." + ver [1] + "." + ver [2] + "." + ver [3];