Rename the mobile_static profile to aot_only
[mono.git] / mcs / class / System / Test / System.Diagnostics / FileVersionInfoTest.cs
1 //
2 // FileVersionInfoTest.cs - NUnit Test Cases for System.Diagnostics.FileVersionInfo
3 //
4 // Authors:
5 //   Gert Driesen <drieseng@users.sourceforge.net>
6 //
7 // (c) 2008 Gert Driesen
8 // 
9
10 using System;
11 using System.IO;
12 using System.Diagnostics;
13 using System.Globalization;
14 using System.Reflection;
15 #if !MONOTOUCH
16 using System.Reflection.Emit;
17 #endif
18 using System.Text;
19
20 using NUnit.Framework;
21
22 namespace MonoTests.System.Diagnostics
23 {
24         [TestFixture]
25         public class FileVersionInfoTest
26         {
27                 private string tempDir;
28
29                 [SetUp]
30                 public void SetUp ()
31                 {
32                         tempDir = Path.Combine (Path.GetTempPath (), Environment.UserName);
33                         tempDir = Path.Combine (tempDir, "MonoTests.System.Diagnostics.AppDomainTest");
34                         if (!Directory.Exists (tempDir))
35                                 Directory.CreateDirectory (tempDir);
36                 }
37
38                 [TearDown]
39                 public void TearDown ()
40                 {
41                         Directory.Delete (tempDir, true);
42                 }
43
44                 [Test]
45                 public void GetVersionInfo_FileName_DoesNotExist ()
46                 {
47                         try {
48                                 FileVersionInfo.GetVersionInfo ("shouldnoteverexist.tmp");
49                                 Assert.Fail ("#1");
50                         } catch (FileNotFoundException ex) {
51                                 Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
52                                 Assert.IsNull (ex.FileName, "#3");
53                                 Assert.IsNull (ex.InnerException, "#4");
54                                 Assert.AreEqual ("shouldnoteverexist.tmp", ex.Message, "#5");
55                         }
56                 }
57
58                 [Test]
59                 public void GetVersionInfo_FileName_Null ()
60                 {
61                         try {
62                                 FileVersionInfo.GetVersionInfo ((string) null);
63                                 Assert.Fail ("#1");
64                         } catch (ArgumentNullException ex) {
65                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
66                                 Assert.IsNull (ex.InnerException, "#3");
67                                 Assert.IsNotNull (ex.Message, "#4");
68                                 Assert.AreEqual ("path", ex.ParamName, "#5");
69                         }
70                 }
71
72                 [Test]
73                 public void GetVersionInfo_TextFile ()
74                 {
75                         string file = Path.Combine (tempDir, "lib.dll");
76
77                         using (StreamWriter sw = new StreamWriter (file, false, Encoding.UTF8)) {
78                                 sw.WriteLine ("WHATEVER");
79                         }
80
81                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (file);
82                         Assert.IsNull (fvi.Comments, "#1");
83                         Assert.IsNull (fvi.CompanyName, "#2");
84                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
85                         Assert.IsNull (fvi.FileDescription, "#4");
86                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
87                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
88                         Assert.AreEqual (file, fvi.FileName, "#7");
89                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
90                         Assert.IsNull (fvi.FileVersion, "#9");
91                         Assert.IsNull (fvi.InternalName, "#10");
92                         Assert.IsFalse (fvi.IsDebug, "#11");
93                         Assert.IsFalse (fvi.IsPatched, "#12");
94                         Assert.IsFalse (fvi.IsPreRelease, "#13");
95                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
96                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
97                         Assert.IsNull (fvi.Language, "#16");
98                         Assert.IsNull (fvi.LegalCopyright, "#17");
99                         Assert.IsNull (fvi.LegalTrademarks, "#18");
100                         Assert.IsNull (fvi.OriginalFilename, "#19");
101                         Assert.IsNull (fvi.PrivateBuild, "#20");
102                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
103                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
104                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
105                         Assert.IsNull (fvi.ProductName, "#24");
106                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
107                         Assert.IsNull (fvi.ProductVersion, "#26");
108                         Assert.IsNull (fvi.SpecialBuild, "#27");
109                 }
110
111 #if !MONOTOUCH && !FULL_AOT_RUNTIME
112                 [Test]
113                 public void GetVersionInfo_NoNativeResources ()
114                 {
115                         AssemblyName aname = new AssemblyName ();
116                         aname.CultureInfo = new CultureInfo ("nl-BE");
117                         aname.Name = "lib";
118                         aname.Version = new Version (3, 5, 7, 9);
119
120                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
121                                 aname, AssemblyBuilderAccess.RunAndSave,
122                                 tempDir);
123
124                         // CompanyName
125                         Type attrType = typeof (AssemblyCompanyAttribute);
126                         ConstructorInfo ci = attrType.GetConstructor (
127                                 new Type [] { typeof (String) });
128                         CustomAttributeBuilder cab =
129                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
130                         ab.SetCustomAttribute (cab);
131
132                         // Comments
133                         attrType = typeof (AssemblyDescriptionAttribute);
134                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
135                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
136                         ab.SetCustomAttribute (cab);
137
138                         // ProductName
139                         attrType = typeof (AssemblyProductAttribute);
140                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
141                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
142                         ab.SetCustomAttribute (cab);
143
144                         // LegalCopyright
145                         attrType = typeof (AssemblyCopyrightAttribute);
146                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
147                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
148                         ab.SetCustomAttribute (cab);
149
150                         // LegalTrademarks
151                         attrType = typeof (AssemblyTrademarkAttribute);
152                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
153                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
154                         ab.SetCustomAttribute (cab);
155
156                         // AssemblyVersion
157                         attrType = typeof (AssemblyVersionAttribute);
158                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
159                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
160                         ab.SetCustomAttribute (cab);
161
162                         // AssemblyFileVersion
163                         attrType = typeof (AssemblyFileVersionAttribute);
164                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
165                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
166                         ab.SetCustomAttribute (cab);
167
168                         // AssemblyInformationalVersion
169                         attrType = typeof (AssemblyInformationalVersionAttribute);
170                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
171                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
172                         ab.SetCustomAttribute (cab);
173
174                         // AssemblyCulture
175                         attrType = typeof (AssemblyCultureAttribute);
176                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
177                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
178                         ab.SetCustomAttribute (cab);
179
180                         ab.Save ("lib.dll");
181
182                         string assemblyFile = Path.Combine (tempDir, "lib.dll");
183
184                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
185                         Assert.IsNull (fvi.Comments, "#1");
186                         Assert.IsNull (fvi.CompanyName, "#2");
187                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
188                         Assert.IsNull (fvi.FileDescription, "#4");
189                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
190                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
191                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
192                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
193                         Assert.IsNull (fvi.FileVersion, "#9");
194                         Assert.IsNull (fvi.InternalName, "#10");
195                         Assert.IsFalse (fvi.IsDebug, "#11");
196                         Assert.IsFalse (fvi.IsPatched, "#12");
197                         Assert.IsFalse (fvi.IsPreRelease, "#13");
198                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
199                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
200                         Assert.IsNull (fvi.Language, "#16");
201                         Assert.IsNull (fvi.LegalCopyright, "#17");
202                         Assert.IsNull (fvi.LegalTrademarks, "#18");
203                         Assert.IsNull (fvi.OriginalFilename, "#19");
204                         Assert.IsNull (fvi.PrivateBuild, "#20");
205                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
206                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
207                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
208                         Assert.IsNull (fvi.ProductName, "#24");
209                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
210                         Assert.IsNull (fvi.ProductVersion, "#26");
211                         Assert.IsNull (fvi.SpecialBuild, "#27");
212                 }
213
214                 [Test] // DefineUnmanagedResource (String)
215                 public void DefineUnmanagedResource1a ()
216                 {
217                         string resFile = Path.Combine (tempDir, "version.res");
218
219                         using (FileStream fs = File.OpenWrite (resFile)) {
220                                 fs.Write (version_res1, 0, version_res1.Length);
221                         }
222
223                         AssemblyName aname = new AssemblyName ();
224                         aname.CultureInfo = new CultureInfo ("nl-BE");
225                         aname.Name = "lib3a";
226                         aname.Version = new Version (8, 5, 4, 2);
227
228                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
229                                 aname, AssemblyBuilderAccess.RunAndSave, tempDir);
230
231                         ab.DefineUnmanagedResource (resFile);
232                         ab.Save ("lib3a.dll");
233
234                         string assemblyFile = Path.Combine (tempDir, "lib3a.dll");
235
236                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
237                         Assert.AreEqual ("N Comment", fvi.Comments, "#1");
238                         Assert.AreEqual ("N Mono Team", fvi.CompanyName, "#2");
239                         Assert.AreEqual (1, fvi.FileBuildPart, "#3");
240                         Assert.AreEqual ("N File Description", fvi.FileDescription, "#4");
241                         Assert.AreEqual (6, fvi.FileMajorPart, "#5");
242                         Assert.AreEqual (9, fvi.FileMinorPart, "#6");
243                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
244                         Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
245                         Assert.AreEqual ("N 1.2.3.4", fvi.FileVersion, "#9");
246                         Assert.AreEqual ("N lib3", fvi.InternalName, "#10");
247                         Assert.IsFalse (fvi.IsDebug, "#11");
248                         Assert.IsFalse (fvi.IsPatched, "#12");
249                         Assert.IsFalse (fvi.IsPreRelease, "#13");
250                         Assert.IsTrue (fvi.IsPrivateBuild, "#14");
251                         Assert.IsTrue (fvi.IsSpecialBuild, "#15");
252                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
253                         Assert.AreEqual ("N Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
254                         Assert.AreEqual ("N Registered to All", fvi.LegalTrademarks, "#18");
255                         Assert.AreEqual ("N lib3.dll", fvi.OriginalFilename, "#19");
256                         Assert.AreEqual ("N PRIV", fvi.PrivateBuild, "#20");
257                         Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
258                         Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
259                         Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
260                         Assert.AreEqual ("N Mono Runtime", fvi.ProductName, "#24");
261                         Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
262                         Assert.AreEqual ("N 4,2,1,7", fvi.ProductVersion, "#26");
263                         Assert.AreEqual ("N SPEC", fvi.SpecialBuild, "#27");
264                 }
265
266                 [Test] // DefineUnmanagedResource (String)
267                 public void DefineUnmanagedResource1b ()
268                 {
269                         string resFile = Path.Combine (tempDir, "version.res");
270
271                         using (FileStream fs = File.OpenWrite (resFile)) {
272                                 fs.Write (version_res1, 0, version_res1.Length);
273                         }
274
275                         AssemblyName aname = new AssemblyName ();
276                         aname.CultureInfo = new CultureInfo ("nl-BE");
277                         aname.Name = "lib3b";
278                         aname.Version = new Version (9, 0, 3, 0);
279
280                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
281                                 aname, AssemblyBuilderAccess.RunAndSave,
282                                 tempDir);
283
284                         // CompanyName
285                         Type attrType = typeof (AssemblyCompanyAttribute);
286                         ConstructorInfo ci = attrType.GetConstructor (
287                                 new Type [] { typeof (String) });
288                         CustomAttributeBuilder cab =
289                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
290                         ab.SetCustomAttribute (cab);
291
292                         // Comments
293                         attrType = typeof (AssemblyDescriptionAttribute);
294                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
295                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
296                         ab.SetCustomAttribute (cab);
297
298                         // ProductName
299                         attrType = typeof (AssemblyProductAttribute);
300                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
301                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
302                         ab.SetCustomAttribute (cab);
303
304                         // LegalCopyright
305                         attrType = typeof (AssemblyCopyrightAttribute);
306                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
307                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
308                         ab.SetCustomAttribute (cab);
309
310                         // LegalTrademarks
311                         attrType = typeof (AssemblyTrademarkAttribute);
312                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
313                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
314                         ab.SetCustomAttribute (cab);
315
316                         // AssemblyVersion
317                         attrType = typeof (AssemblyVersionAttribute);
318                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
319                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
320                         ab.SetCustomAttribute (cab);
321
322                         // AssemblyFileVersion
323                         attrType = typeof (AssemblyFileVersionAttribute);
324                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
325                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
326                         ab.SetCustomAttribute (cab);
327
328                         // AssemblyInformationalVersion
329                         attrType = typeof (AssemblyInformationalVersionAttribute);
330                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
331                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
332                         ab.SetCustomAttribute (cab);
333
334                         // AssemblyCulture
335                         attrType = typeof (AssemblyCultureAttribute);
336                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
337                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
338                         ab.SetCustomAttribute (cab);
339
340                         ab.DefineUnmanagedResource (resFile);
341                         ab.Save ("lib3b.dll");
342
343                         string assemblyFile = Path.Combine (tempDir, "lib3b.dll");
344
345                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
346                         Assert.AreEqual ("N Comment", fvi.Comments, "#1");
347                         Assert.AreEqual ("N Mono Team", fvi.CompanyName, "#2");
348                         Assert.AreEqual (1, fvi.FileBuildPart, "#3");
349                         Assert.AreEqual ("N File Description", fvi.FileDescription, "#4");
350                         Assert.AreEqual (6, fvi.FileMajorPart, "#5");
351                         Assert.AreEqual (9, fvi.FileMinorPart, "#6");
352                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
353                         Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
354                         Assert.AreEqual ("N 1.2.3.4", fvi.FileVersion, "#9");
355                         Assert.AreEqual ("N lib3", fvi.InternalName, "#10");
356                         Assert.IsFalse (fvi.IsDebug, "#11");
357                         Assert.IsFalse (fvi.IsPatched, "#12");
358                         Assert.IsFalse (fvi.IsPreRelease, "#13");
359                         Assert.IsTrue (fvi.IsPrivateBuild, "#14");
360                         Assert.IsTrue (fvi.IsSpecialBuild, "#15");
361                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
362                         Assert.AreEqual ("N Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
363                         Assert.AreEqual ("N Registered to All", fvi.LegalTrademarks, "#18");
364                         Assert.AreEqual ("N lib3.dll", fvi.OriginalFilename, "#19");
365                         Assert.AreEqual ("N PRIV", fvi.PrivateBuild, "#20");
366                         Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
367                         Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
368                         Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
369                         Assert.AreEqual ("N Mono Runtime", fvi.ProductName, "#24");
370                         Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
371                         Assert.AreEqual ("N 4,2,1,7", fvi.ProductVersion, "#26");
372                         Assert.AreEqual ("N SPEC", fvi.SpecialBuild, "#27");
373                 }
374
375                 [Test] // DefineUnmanagedResource (String)
376                 public void DefineUnmanagedResource1c ()
377                 {
378                         string resFile = Path.Combine (tempDir, "version.res");
379
380                         using (FileStream fs = File.OpenWrite (resFile)) {
381                                 fs.Write (version_res2, 0, version_res2.Length);
382                         }
383
384                         AssemblyName aname = new AssemblyName ();
385                         aname.CultureInfo = new CultureInfo ("nl-BE");
386                         aname.Name = "lib3c";
387                         aname.Version = new Version (3, 5, 7, 9);
388
389                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
390                                 aname, AssemblyBuilderAccess.RunAndSave, tempDir);
391
392                         ab.DefineUnmanagedResource (resFile);
393                         ab.Save ("lib3c.dll");
394
395                         string assemblyFile = Path.Combine (tempDir, "lib3c.dll");
396
397                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
398                         Assert.AreEqual (string.Empty, fvi.Comments, "#1");
399                         Assert.AreEqual (string.Empty, fvi.CompanyName, "#2");
400                         Assert.AreEqual (1, fvi.FileBuildPart, "#3");
401                         Assert.AreEqual (string.Empty, fvi.FileDescription, "#4");
402                         Assert.AreEqual (6, fvi.FileMajorPart, "#5");
403                         Assert.AreEqual (9, fvi.FileMinorPart, "#6");
404                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
405                         Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
406                         Assert.AreEqual (string.Empty, fvi.FileVersion, "#9");
407                         Assert.AreEqual (string.Empty, fvi.InternalName, "#10");
408                         Assert.IsFalse (fvi.IsDebug, "#11");
409                         Assert.IsFalse (fvi.IsPatched, "#12");
410                         Assert.IsFalse (fvi.IsPreRelease, "#13");
411                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
412                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
413                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
414                         Assert.AreEqual (string.Empty, fvi.LegalCopyright, "#17");
415                         Assert.AreEqual (string.Empty, fvi.LegalTrademarks, "#18");
416                         Assert.AreEqual (string.Empty, fvi.OriginalFilename, "#19");
417                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
418                         Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
419                         Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
420                         Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
421                         Assert.AreEqual (string.Empty, fvi.ProductName, "#24");
422                         Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
423                         Assert.AreEqual (string.Empty, fvi.ProductVersion, "#26");
424                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
425                 }
426
427                 [Test] // DefineUnmanagedResource (String)
428                 public void DefineUnmanagedResource1d ()
429                 {
430                         string resFile = Path.Combine (tempDir, "version.res");
431
432                         using (FileStream fs = File.OpenWrite (resFile)) {
433                                 fs.Write (version_res2, 0, version_res2.Length);
434                         }
435
436                         AssemblyName aname = new AssemblyName ();
437                         aname.CultureInfo = new CultureInfo ("nl-BE");
438                         aname.Name = "lib3d";
439                         aname.Version = new Version (3, 5, 7, 9);
440
441                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
442                                 aname, AssemblyBuilderAccess.RunAndSave, tempDir);
443
444                         // CompanyName
445                         Type attrType = typeof (AssemblyCompanyAttribute);
446                         ConstructorInfo ci = attrType.GetConstructor (
447                                 new Type [] { typeof (String) });
448                         CustomAttributeBuilder cab =
449                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
450                         ab.SetCustomAttribute (cab);
451
452                         // Comments
453                         attrType = typeof (AssemblyDescriptionAttribute);
454                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
455                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
456                         ab.SetCustomAttribute (cab);
457
458                         // ProductName
459                         attrType = typeof (AssemblyProductAttribute);
460                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
461                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
462                         ab.SetCustomAttribute (cab);
463
464                         // LegalCopyright
465                         attrType = typeof (AssemblyCopyrightAttribute);
466                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
467                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
468                         ab.SetCustomAttribute (cab);
469
470                         // LegalTrademarks
471                         attrType = typeof (AssemblyTrademarkAttribute);
472                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
473                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
474                         ab.SetCustomAttribute (cab);
475
476                         // AssemblyVersion
477                         attrType = typeof (AssemblyVersionAttribute);
478                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
479                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
480                         ab.SetCustomAttribute (cab);
481
482                         // AssemblyFileVersion
483                         attrType = typeof (AssemblyFileVersionAttribute);
484                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
485                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
486                         ab.SetCustomAttribute (cab);
487
488                         // AssemblyInformationalVersion
489                         attrType = typeof (AssemblyInformationalVersionAttribute);
490                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
491                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
492                         ab.SetCustomAttribute (cab);
493
494                         // AssemblyCulture
495                         attrType = typeof (AssemblyCultureAttribute);
496                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
497                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
498                         ab.SetCustomAttribute (cab);
499
500                         ab.DefineUnmanagedResource (resFile);
501                         ab.Save ("lib3d.dll");
502
503                         string assemblyFile = Path.Combine (tempDir, "lib3d.dll");
504
505                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
506                         Assert.AreEqual (string.Empty, fvi.Comments, "#1");
507                         Assert.AreEqual (string.Empty, fvi.CompanyName, "#2");
508                         Assert.AreEqual (1, fvi.FileBuildPart, "#3");
509                         Assert.AreEqual (string.Empty, fvi.FileDescription, "#4");
510                         Assert.AreEqual (6, fvi.FileMajorPart, "#5");
511                         Assert.AreEqual (9, fvi.FileMinorPart, "#6");
512                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
513                         Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
514                         Assert.AreEqual (string.Empty, fvi.FileVersion, "#9");
515                         Assert.AreEqual (string.Empty, fvi.InternalName, "#10");
516                         Assert.IsFalse (fvi.IsDebug, "#11");
517                         Assert.IsFalse (fvi.IsPatched, "#12");
518                         Assert.IsFalse (fvi.IsPreRelease, "#13");
519                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
520                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
521                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
522                         Assert.AreEqual (string.Empty, fvi.LegalCopyright, "#17");
523                         Assert.AreEqual (string.Empty, fvi.LegalTrademarks, "#18");
524                         Assert.AreEqual (string.Empty, fvi.OriginalFilename, "#19");
525                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
526                         Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
527                         Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
528                         Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
529                         Assert.AreEqual (string.Empty, fvi.ProductName, "#24");
530                         Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
531                         Assert.AreEqual (string.Empty, fvi.ProductVersion, "#26");
532                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
533                 }
534
535                 [Test] // DefineUnmanagedResource (String)
536                 public void DefineUnmanagedResource1e ()
537                 {
538                         string resFile = Path.Combine (tempDir, "version.res");
539
540                         using (FileStream fs = File.OpenWrite (resFile)) {
541                                 fs.Write (version_res3, 0, version_res3.Length);
542                         }
543
544                         AssemblyName aname = new AssemblyName ();
545                         aname.CultureInfo = new CultureInfo ("nl-BE");
546                         aname.Name = "lib3e";
547                         aname.Version = new Version (3, 5, 7, 9);
548
549                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
550                                 aname, AssemblyBuilderAccess.RunAndSave, tempDir);
551
552                         ab.DefineUnmanagedResource (resFile);
553                         ab.Save ("lib3e.dll");
554
555                         string assemblyFile = Path.Combine (tempDir, "lib3e.dll");
556
557                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
558                         Assert.AreEqual (string.Empty, fvi.Comments, "#1");
559                         Assert.AreEqual (string.Empty, fvi.CompanyName, "#2");
560                         Assert.AreEqual (1, fvi.FileBuildPart, "#3");
561                         Assert.AreEqual (string.Empty, fvi.FileDescription, "#4");
562                         Assert.AreEqual (6, fvi.FileMajorPart, "#5");
563                         Assert.AreEqual (9, fvi.FileMinorPart, "#6");
564                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
565                         Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
566                         Assert.AreEqual (string.Empty, fvi.FileVersion, "#9");
567                         Assert.AreEqual (string.Empty, fvi.InternalName, "#10");
568                         Assert.IsFalse (fvi.IsDebug, "#11");
569                         Assert.IsFalse (fvi.IsPatched, "#12");
570                         Assert.IsFalse (fvi.IsPreRelease, "#13");
571                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
572                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
573                         //Assert.AreEqual ("English (United States)", fvi.Language, "#16");
574                         Assert.AreEqual (string.Empty, fvi.LegalCopyright, "#17");
575                         Assert.AreEqual (string.Empty, fvi.LegalTrademarks, "#18");
576                         Assert.AreEqual (string.Empty, fvi.OriginalFilename, "#19");
577                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
578                         Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
579                         Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
580                         Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
581                         Assert.AreEqual (string.Empty, fvi.ProductName, "#24");
582                         Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
583                         Assert.AreEqual (string.Empty, fvi.ProductVersion, "#26");
584                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
585                 }
586
587                 [Test] // DefineUnmanagedResource (String)
588                 public void DefineUnmanagedResource1f ()
589                 {
590                         string resFile = Path.Combine (tempDir, "version.res");
591
592                         using (FileStream fs = File.OpenWrite (resFile)) {
593                                 fs.Write (version_res3, 0, version_res3.Length);
594                         }
595
596                         AssemblyName aname = new AssemblyName ();
597                         aname.CultureInfo = new CultureInfo ("nl-BE");
598                         aname.Name = "lib3f";
599                         aname.Version = new Version (3, 5, 7, 9);
600
601                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
602                                 aname, AssemblyBuilderAccess.RunAndSave, tempDir);
603
604                         // CompanyName
605                         Type attrType = typeof (AssemblyCompanyAttribute);
606                         ConstructorInfo ci = attrType.GetConstructor (
607                                 new Type [] { typeof (String) });
608                         CustomAttributeBuilder cab =
609                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
610                         ab.SetCustomAttribute (cab);
611
612                         // Comments
613                         attrType = typeof (AssemblyDescriptionAttribute);
614                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
615                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
616                         ab.SetCustomAttribute (cab);
617
618                         // ProductName
619                         attrType = typeof (AssemblyProductAttribute);
620                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
621                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
622                         ab.SetCustomAttribute (cab);
623
624                         // LegalCopyright
625                         attrType = typeof (AssemblyCopyrightAttribute);
626                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
627                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
628                         ab.SetCustomAttribute (cab);
629
630                         // LegalTrademarks
631                         attrType = typeof (AssemblyTrademarkAttribute);
632                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
633                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
634                         ab.SetCustomAttribute (cab);
635
636                         // AssemblyVersion
637                         attrType = typeof (AssemblyVersionAttribute);
638                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
639                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
640                         ab.SetCustomAttribute (cab);
641
642                         // AssemblyFileVersion
643                         attrType = typeof (AssemblyFileVersionAttribute);
644                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
645                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
646                         ab.SetCustomAttribute (cab);
647
648                         // AssemblyInformationalVersion
649                         attrType = typeof (AssemblyInformationalVersionAttribute);
650                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
651                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
652                         ab.SetCustomAttribute (cab);
653
654                         // AssemblyCulture
655                         attrType = typeof (AssemblyCultureAttribute);
656                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
657                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
658                         ab.SetCustomAttribute (cab);
659
660                         ab.DefineUnmanagedResource (resFile);
661                         ab.Save ("lib3f.dll");
662
663                         string assemblyFile = Path.Combine (tempDir, "lib3f.dll");
664
665                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
666                         Assert.AreEqual (string.Empty, fvi.Comments, "#1");
667                         Assert.AreEqual (string.Empty, fvi.CompanyName, "#2");
668                         Assert.AreEqual (1, fvi.FileBuildPart, "#3");
669                         Assert.AreEqual (string.Empty, fvi.FileDescription, "#4");
670                         Assert.AreEqual (6, fvi.FileMajorPart, "#5");
671                         Assert.AreEqual (9, fvi.FileMinorPart, "#6");
672                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
673                         Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
674                         Assert.AreEqual (string.Empty, fvi.FileVersion, "#9");
675                         Assert.AreEqual (string.Empty, fvi.InternalName, "#10");
676                         Assert.IsFalse (fvi.IsDebug, "#11");
677                         Assert.IsFalse (fvi.IsPatched, "#12");
678                         Assert.IsFalse (fvi.IsPreRelease, "#13");
679                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
680                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
681                         //Assert.AreEqual ("English (United States)", fvi.Language, "#16");
682                         Assert.AreEqual (string.Empty, fvi.LegalCopyright, "#17");
683                         Assert.AreEqual (string.Empty, fvi.LegalTrademarks, "#18");
684                         Assert.AreEqual (string.Empty, fvi.OriginalFilename, "#19");
685                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
686                         Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
687                         Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
688                         Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
689                         Assert.AreEqual (string.Empty, fvi.ProductName, "#24");
690                         Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
691                         Assert.AreEqual (string.Empty, fvi.ProductVersion, "#26");
692                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
693                 }
694
695                 [Test] // DefineUnmanagedResource (String)
696                 public void DefineUnmanagedResource1g ()
697                 {
698                         string resFile = Path.Combine (tempDir, "version.res");
699
700                         using (FileStream fs = File.OpenWrite (resFile)) {
701                                 fs.Write (version_res4, 0, version_res4.Length);
702                         }
703
704                         AssemblyName aname = new AssemblyName ();
705                         aname.CultureInfo = new CultureInfo ("nl-BE");
706                         aname.Name = "lib3g";
707                         aname.Version = new Version (3, 5, 7, 9);
708
709                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
710                                 aname, AssemblyBuilderAccess.RunAndSave, tempDir);
711
712                         ab.DefineUnmanagedResource (resFile);
713                         ab.Save ("lib3g.dll");
714
715                         string assemblyFile = Path.Combine (tempDir, "lib3g.dll");
716
717                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
718                         Assert.IsNull (fvi.Comments, "#1");
719                         Assert.IsNull (fvi.CompanyName, "#2");
720                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
721                         Assert.IsNull (fvi.FileDescription, "#4");
722                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
723                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
724                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
725                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
726                         Assert.IsNull (fvi.FileVersion, "#9");
727                         Assert.IsNull (fvi.InternalName, "#10");
728                         Assert.IsFalse (fvi.IsDebug, "#11");
729                         Assert.IsFalse (fvi.IsPatched, "#12");
730                         Assert.IsFalse (fvi.IsPreRelease, "#13");
731                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
732                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
733                         Assert.IsNull (fvi.Language, "#16");
734                         Assert.IsNull (fvi.LegalCopyright, "#17");
735                         Assert.IsNull (fvi.LegalTrademarks, "#18");
736                         Assert.IsNull (fvi.OriginalFilename, "#19");
737                         Assert.IsNull (fvi.PrivateBuild, "#20");
738                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
739                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
740                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
741                         Assert.IsNull (fvi.ProductName, "#24");
742                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
743                         Assert.IsNull (fvi.ProductVersion, "#26");
744                         Assert.IsNull (fvi.SpecialBuild, "#27");
745                 }
746
747                 [Test] // DefineUnmanagedResource (String)
748                 public void DefineUnmanagedResource1h ()
749                 {
750                         string resFile = Path.Combine (tempDir, "version.res");
751
752                         using (FileStream fs = File.OpenWrite (resFile)) {
753                                 fs.Write (version_res4, 0, version_res4.Length);
754                         }
755
756                         AssemblyName aname = new AssemblyName ();
757                         aname.CultureInfo = new CultureInfo ("nl-BE");
758                         aname.Name = "lib3h";
759                         aname.Version = new Version (3, 5, 7, 9);
760
761                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
762                                 aname, AssemblyBuilderAccess.RunAndSave, tempDir);
763
764                         // CompanyName
765                         Type attrType = typeof (AssemblyCompanyAttribute);
766                         ConstructorInfo ci = attrType.GetConstructor (
767                                 new Type [] { typeof (String) });
768                         CustomAttributeBuilder cab =
769                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
770                         ab.SetCustomAttribute (cab);
771
772                         // Comments
773                         attrType = typeof (AssemblyDescriptionAttribute);
774                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
775                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
776                         ab.SetCustomAttribute (cab);
777
778                         // ProductName
779                         attrType = typeof (AssemblyProductAttribute);
780                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
781                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
782                         ab.SetCustomAttribute (cab);
783
784                         // LegalCopyright
785                         attrType = typeof (AssemblyCopyrightAttribute);
786                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
787                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
788                         ab.SetCustomAttribute (cab);
789
790                         // LegalTrademarks
791                         attrType = typeof (AssemblyTrademarkAttribute);
792                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
793                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
794                         ab.SetCustomAttribute (cab);
795
796                         // AssemblyVersion
797                         attrType = typeof (AssemblyVersionAttribute);
798                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
799                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
800                         ab.SetCustomAttribute (cab);
801
802                         // AssemblyFileVersion
803                         attrType = typeof (AssemblyFileVersionAttribute);
804                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
805                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
806                         ab.SetCustomAttribute (cab);
807
808                         // AssemblyInformationalVersion
809                         attrType = typeof (AssemblyInformationalVersionAttribute);
810                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
811                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
812                         ab.SetCustomAttribute (cab);
813
814                         // AssemblyCulture
815                         attrType = typeof (AssemblyCultureAttribute);
816                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
817                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
818                         ab.SetCustomAttribute (cab);
819
820                         ab.DefineUnmanagedResource (resFile);
821                         ab.Save ("lib3h.dll");
822
823                         string assemblyFile = Path.Combine (tempDir, "lib3h.dll");
824
825                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
826                         Assert.IsNull (fvi.Comments, "#1");
827                         Assert.IsNull (fvi.CompanyName, "#2");
828                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
829                         Assert.IsNull (fvi.FileDescription, "#4");
830                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
831                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
832                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
833                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
834                         Assert.IsNull (fvi.FileVersion, "#9");
835                         Assert.IsNull (fvi.InternalName, "#10");
836                         Assert.IsFalse (fvi.IsDebug, "#11");
837                         Assert.IsFalse (fvi.IsPatched, "#12");
838                         Assert.IsFalse (fvi.IsPreRelease, "#13");
839                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
840                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
841                         Assert.IsNull (fvi.Language, "#16");
842                         Assert.IsNull (fvi.LegalCopyright, "#17");
843                         Assert.IsNull (fvi.LegalTrademarks, "#18");
844                         Assert.IsNull (fvi.OriginalFilename, "#19");
845                         Assert.IsNull (fvi.PrivateBuild, "#20");
846                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
847                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
848                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
849                         Assert.IsNull (fvi.ProductName, "#24");
850                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
851                         Assert.IsNull (fvi.ProductVersion, "#26");
852                         Assert.IsNull (fvi.SpecialBuild, "#27");
853                 }
854
855                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
856                 public void DefineVersionInfoResource1a ()
857                 {
858                         AssemblyName aname = new AssemblyName ();
859                         aname.Name = "lib1a";
860
861                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
862                                 aname, AssemblyBuilderAccess.RunAndSave,
863                                 tempDir);
864                         ab.DefineVersionInfoResource ("BBB", "1.3.2.4", "CCC", "DDD", "EEE");
865                         ab.Save ("lib1a.dll");
866
867                         string assemblyFile = Path.Combine (tempDir, "lib1a.dll");
868
869                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
870                         Assert.AreEqual (" ", fvi.Comments, "#1");
871                         Assert.AreEqual ("CCC", fvi.CompanyName, "#2");
872                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
873                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
874                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
875                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
876                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
877                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
878                         Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
879                         Assert.AreEqual ("lib1a", fvi.InternalName, "#10");
880                         Assert.IsFalse (fvi.IsDebug, "#11");
881                         Assert.IsFalse (fvi.IsPatched, "#12");
882                         Assert.IsFalse (fvi.IsPreRelease, "#13");
883                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
884                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
885                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
886                         Assert.AreEqual ("DDD", fvi.LegalCopyright, "#17");
887                         Assert.AreEqual ("EEE", fvi.LegalTrademarks, "#18");
888                         Assert.AreEqual ("lib1a.dll", fvi.OriginalFilename, "#19");
889                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
890                         Assert.AreEqual (2, fvi.ProductBuildPart, "#21");
891                         Assert.AreEqual (1, fvi.ProductMajorPart, "#22");
892                         Assert.AreEqual (3, fvi.ProductMinorPart, "#23");
893                         Assert.AreEqual ("BBB", fvi.ProductName, "#24");
894                         Assert.AreEqual (4, fvi.ProductPrivatePart, "#25");
895                         Assert.AreEqual ("1.3.2.4", fvi.ProductVersion, "#26");
896                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
897                 }
898
899                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
900                 public void DefineVersionInfoResource1b ()
901                 {
902                         AssemblyName aname = new AssemblyName ();
903                         aname.Name = "lib1b";
904
905                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
906                                 aname, AssemblyBuilderAccess.RunAndSave,
907                                 tempDir);
908                         ab.DefineVersionInfoResource (null, null, null, null, null);
909                         ab.Save ("lib1b.dll");
910
911                         string assemblyFile = Path.Combine (tempDir, "lib1b.dll");
912
913                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
914                         Assert.AreEqual (" ", fvi.Comments, "#1");
915                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
916                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
917                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
918                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
919                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
920                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
921                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
922                         Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
923                         Assert.AreEqual ("lib1b", fvi.InternalName, "#10");
924                         Assert.IsFalse (fvi.IsDebug, "#11");
925                         Assert.IsFalse (fvi.IsPatched, "#12");
926                         Assert.IsFalse (fvi.IsPreRelease, "#13");
927                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
928                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
929                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
930                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
931                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
932                         Assert.AreEqual ("lib1b.dll", fvi.OriginalFilename, "#19");
933                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
934                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
935                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
936                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
937                         Assert.AreEqual (" ", fvi.ProductName, "#24");
938                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
939                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
940                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
941                 }
942
943                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
944                 public void DefineVersionInfoResource1c ()
945                 {
946                         AssemblyName aname = new AssemblyName ();
947                         aname.Name = "lib1c";
948
949                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
950                                 aname, AssemblyBuilderAccess.RunAndSave,
951                                 tempDir);
952
953                         // CompanyName
954                         Type attrType = typeof (AssemblyCompanyAttribute);
955                         ConstructorInfo ci = attrType.GetConstructor (
956                                 new Type [] { typeof (String) });
957                         CustomAttributeBuilder cab =
958                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
959                         ab.SetCustomAttribute (cab);
960
961                         // Comments
962                         attrType = typeof (AssemblyDescriptionAttribute);
963                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
964                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
965                         ab.SetCustomAttribute (cab);
966
967                         // ProductName
968                         attrType = typeof (AssemblyProductAttribute);
969                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
970                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
971                         ab.SetCustomAttribute (cab);
972
973                         // LegalCopyright
974                         attrType = typeof (AssemblyCopyrightAttribute);
975                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
976                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
977                         ab.SetCustomAttribute (cab);
978
979                         // LegalTrademarks
980                         attrType = typeof (AssemblyTrademarkAttribute);
981                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
982                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
983                         ab.SetCustomAttribute (cab);
984
985                         // AssemblyVersion
986                         attrType = typeof (AssemblyVersionAttribute);
987                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
988                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
989                         ab.SetCustomAttribute (cab);
990
991                         // AssemblyFileVersion
992                         attrType = typeof (AssemblyFileVersionAttribute);
993                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
994                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
995                         ab.SetCustomAttribute (cab);
996
997                         // AssemblyInformationalVersion
998                         attrType = typeof (AssemblyInformationalVersionAttribute);
999                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1000                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
1001                         ab.SetCustomAttribute (cab);
1002
1003                         // AssemblyCulture
1004                         attrType = typeof (AssemblyCultureAttribute);
1005                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1006                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
1007                         ab.SetCustomAttribute (cab);
1008
1009                         ab.DefineVersionInfoResource ("AAA", "3.9.2", "BBB", "CCC", "DDD");
1010                         ab.Save ("lib1c.dll");
1011
1012                         string assemblyFile = Path.Combine (tempDir, "lib1c.dll");
1013
1014                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1015                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
1016                         Assert.AreEqual ("BBB", fvi.CompanyName, "#2");
1017                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
1018                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1019                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
1020                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
1021                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1022                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
1023                         Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
1024                         Assert.AreEqual ("lib1c", fvi.InternalName, "#10");
1025                         Assert.IsFalse (fvi.IsDebug, "#11");
1026                         Assert.IsFalse (fvi.IsPatched, "#12");
1027                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1028                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1029                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1030                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
1031                         Assert.AreEqual ("CCC", fvi.LegalCopyright, "#17");
1032                         Assert.AreEqual ("DDD", fvi.LegalTrademarks, "#18");
1033                         Assert.AreEqual ("lib1c.dll", fvi.OriginalFilename, "#19");
1034                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1035                         Assert.AreEqual (2, fvi.ProductBuildPart, "#21");
1036                         Assert.AreEqual (3, fvi.ProductMajorPart, "#22");
1037                         Assert.AreEqual (9, fvi.ProductMinorPart, "#23");
1038                         Assert.AreEqual ("AAA", fvi.ProductName, "#24");
1039                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1040                         Assert.AreEqual ("3.9.2", fvi.ProductVersion, "#26");
1041                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1042                 }
1043
1044                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
1045                 public void DefineVersionInfoResource1d ()
1046                 {
1047                         AssemblyName aname = new AssemblyName ();
1048                         aname.Name = "lib1d";
1049
1050                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1051                                 aname, AssemblyBuilderAccess.RunAndSave,
1052                                 tempDir);
1053
1054                         // CompanyName
1055                         Type attrType = typeof (AssemblyCompanyAttribute);
1056                         ConstructorInfo ci = attrType.GetConstructor (
1057                                 new Type [] { typeof (String) });
1058                         CustomAttributeBuilder cab =
1059                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
1060                         ab.SetCustomAttribute (cab);
1061
1062                         // Comments
1063                         attrType = typeof (AssemblyDescriptionAttribute);
1064                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1065                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
1066                         ab.SetCustomAttribute (cab);
1067
1068                         // ProductName
1069                         attrType = typeof (AssemblyProductAttribute);
1070                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1071                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
1072                         ab.SetCustomAttribute (cab);
1073
1074                         // LegalCopyright
1075                         attrType = typeof (AssemblyCopyrightAttribute);
1076                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1077                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
1078                         ab.SetCustomAttribute (cab);
1079
1080                         // LegalTrademarks
1081                         attrType = typeof (AssemblyTrademarkAttribute);
1082                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1083                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
1084                         ab.SetCustomAttribute (cab);
1085
1086                         // AssemblyVersion
1087                         attrType = typeof (AssemblyVersionAttribute);
1088                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1089                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
1090                         ab.SetCustomAttribute (cab);
1091
1092                         // AssemblyFileVersion
1093                         attrType = typeof (AssemblyFileVersionAttribute);
1094                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1095                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
1096                         ab.SetCustomAttribute (cab);
1097
1098                         // AssemblyInformationalVersion
1099                         attrType = typeof (AssemblyInformationalVersionAttribute);
1100                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1101                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
1102                         ab.SetCustomAttribute (cab);
1103
1104                         // AssemblyCulture
1105                         attrType = typeof (AssemblyCultureAttribute);
1106                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1107                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
1108                         ab.SetCustomAttribute (cab);
1109
1110                         ab.DefineVersionInfoResource (null, null, null, null, null);
1111                         ab.Save ("lib1d.dll");
1112
1113                         string assemblyFile = Path.Combine (tempDir, "lib1d.dll");
1114
1115                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1116                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
1117                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
1118                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
1119                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1120                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
1121                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
1122                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1123                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
1124                         Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
1125                         Assert.AreEqual ("lib1d", fvi.InternalName, "#10");
1126                         Assert.IsFalse (fvi.IsDebug, "#11");
1127                         Assert.IsFalse (fvi.IsPatched, "#12");
1128                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1129                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1130                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1131                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
1132                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
1133                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
1134                         Assert.AreEqual ("lib1d.dll", fvi.OriginalFilename, "#19");
1135                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1136                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
1137                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
1138                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
1139                         Assert.AreEqual (" ", fvi.ProductName, "#24");
1140                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1141                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
1142                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1143                 }
1144
1145                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
1146                 public void DefineVersionInfoResource1e ()
1147                 {
1148                         AssemblyName aname = new AssemblyName ();
1149                         aname.CultureInfo = new CultureInfo ("nl-BE");
1150                         aname.Name = "lib1e";
1151                         aname.Version = new Version (5, 4, 7, 8);
1152
1153                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1154                                 aname, AssemblyBuilderAccess.RunAndSave,
1155                                 tempDir);
1156                         ab.DefineVersionInfoResource ("BBB", "1.3.2.4", "CCC", "DDD", "EEE");
1157                         ab.Save ("lib1e.dll");
1158
1159                         string assemblyFile = Path.Combine (tempDir, "lib1e.dll");
1160
1161                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1162                         Assert.AreEqual (" ", fvi.Comments, "#1");
1163                         Assert.AreEqual ("CCC", fvi.CompanyName, "#2");
1164                         Assert.AreEqual (7, fvi.FileBuildPart, "#3");
1165                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1166                         Assert.AreEqual (5, fvi.FileMajorPart, "#5");
1167                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
1168                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1169                         Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
1170                         Assert.AreEqual ("5.4.7.8", fvi.FileVersion, "#9");
1171                         Assert.AreEqual ("lib1e", fvi.InternalName, "#10");
1172                         Assert.IsFalse (fvi.IsDebug, "#11");
1173                         Assert.IsFalse (fvi.IsPatched, "#12");
1174                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1175                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1176                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1177                         //Assert.AreEqual ("Dutch (Belgium)", fvi.Language, "#16");
1178                         Assert.AreEqual ("DDD", fvi.LegalCopyright, "#17");
1179                         Assert.AreEqual ("EEE", fvi.LegalTrademarks, "#18");
1180                         Assert.AreEqual ("lib1e.dll", fvi.OriginalFilename, "#19");
1181                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1182                         Assert.AreEqual (2, fvi.ProductBuildPart, "#21");
1183                         Assert.AreEqual (1, fvi.ProductMajorPart, "#22");
1184                         Assert.AreEqual (3, fvi.ProductMinorPart, "#23");
1185                         Assert.AreEqual ("BBB", fvi.ProductName, "#24");
1186                         Assert.AreEqual (4, fvi.ProductPrivatePart, "#25");
1187                         Assert.AreEqual ("1.3.2.4", fvi.ProductVersion, "#26");
1188                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1189                 }
1190
1191                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
1192                 public void DefineVersionInfoResource1f ()
1193                 {
1194                         AssemblyName aname = new AssemblyName ();
1195                         aname.CultureInfo = new CultureInfo ("nl");
1196                         aname.Name = "lib1f";
1197                         aname.Version = new Version (5, 4, 7, 8);
1198
1199                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1200                                 aname, AssemblyBuilderAccess.RunAndSave,
1201                                 tempDir);
1202                         ab.DefineVersionInfoResource (null, null, null, null, null);
1203                         ab.Save ("lib1f.dll");
1204
1205                         string assemblyFile = Path.Combine (tempDir, "lib1f.dll");
1206
1207                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1208                         Assert.AreEqual (" ", fvi.Comments, "#1");
1209                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
1210                         Assert.AreEqual (7, fvi.FileBuildPart, "#3");
1211                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1212                         Assert.AreEqual (5, fvi.FileMajorPart, "#5");
1213                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
1214                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1215                         Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
1216                         Assert.AreEqual ("5.4.7.8", fvi.FileVersion, "#9");
1217                         Assert.AreEqual ("lib1f", fvi.InternalName, "#10");
1218                         Assert.IsFalse (fvi.IsDebug, "#11");
1219                         Assert.IsFalse (fvi.IsPatched, "#12");
1220                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1221                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1222                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1223                         //Assert.AreEqual ("Dutch (Netherlands)", fvi.Language, "#16");
1224                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
1225                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
1226                         Assert.AreEqual ("lib1f.dll", fvi.OriginalFilename, "#19");
1227                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1228                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
1229                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
1230                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
1231                         Assert.AreEqual (" ", fvi.ProductName, "#24");
1232                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1233                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
1234                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1235                 }
1236
1237                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
1238                 public void DefineVersionInfoResource1g ()
1239                 {
1240                         AssemblyName aname = new AssemblyName ();
1241                         aname.CultureInfo = new CultureInfo ("nl-BE");
1242                         aname.Name = "lib1g";
1243                         aname.Version = new Version (5, 4, 7);
1244
1245                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1246                                 aname, AssemblyBuilderAccess.RunAndSave,
1247                                 tempDir);
1248
1249                         // CompanyName
1250                         Type attrType = typeof (AssemblyCompanyAttribute);
1251                         ConstructorInfo ci = attrType.GetConstructor (
1252                                 new Type [] { typeof (String) });
1253                         CustomAttributeBuilder cab =
1254                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
1255                         ab.SetCustomAttribute (cab);
1256
1257                         // Comments
1258                         attrType = typeof (AssemblyDescriptionAttribute);
1259                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1260                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
1261                         ab.SetCustomAttribute (cab);
1262
1263                         // ProductName
1264                         attrType = typeof (AssemblyProductAttribute);
1265                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1266                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
1267                         ab.SetCustomAttribute (cab);
1268
1269                         // LegalCopyright
1270                         attrType = typeof (AssemblyCopyrightAttribute);
1271                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1272                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
1273                         ab.SetCustomAttribute (cab);
1274
1275                         // LegalTrademarks
1276                         attrType = typeof (AssemblyTrademarkAttribute);
1277                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1278                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
1279                         ab.SetCustomAttribute (cab);
1280
1281                         // AssemblyVersion
1282                         attrType = typeof (AssemblyVersionAttribute);
1283                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1284                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
1285                         ab.SetCustomAttribute (cab);
1286
1287                         // AssemblyFileVersion
1288                         attrType = typeof (AssemblyFileVersionAttribute);
1289                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1290                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
1291                         ab.SetCustomAttribute (cab);
1292
1293                         // AssemblyInformationalVersion
1294                         attrType = typeof (AssemblyInformationalVersionAttribute);
1295                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1296                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
1297                         ab.SetCustomAttribute (cab);
1298
1299                         // AssemblyCulture
1300                         attrType = typeof (AssemblyCultureAttribute);
1301                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1302                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
1303                         ab.SetCustomAttribute (cab);
1304
1305                         ab.DefineVersionInfoResource ("AAA", "3.9.2", "BBB", "CCC", "DDD");
1306                         ab.Save ("lib1g.dll");
1307
1308                         string assemblyFile = Path.Combine (tempDir, "lib1g.dll");
1309
1310                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1311                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
1312                         Assert.AreEqual ("BBB", fvi.CompanyName, "#2");
1313                         Assert.AreEqual (7, fvi.FileBuildPart, "#3");
1314                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1315                         Assert.AreEqual (5, fvi.FileMajorPart, "#5");
1316                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
1317                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1318                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
1319                         Assert.AreEqual ("5.4.7.0", fvi.FileVersion, "#9");
1320                         Assert.AreEqual ("lib1g", fvi.InternalName, "#10");
1321                         Assert.IsFalse (fvi.IsDebug, "#11");
1322                         Assert.IsFalse (fvi.IsPatched, "#12");
1323                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1324                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1325                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1326                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
1327                         Assert.AreEqual ("CCC", fvi.LegalCopyright, "#17");
1328                         Assert.AreEqual ("DDD", fvi.LegalTrademarks, "#18");
1329                         Assert.AreEqual ("lib1g.dll", fvi.OriginalFilename, "#19");
1330                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1331                         Assert.AreEqual (2, fvi.ProductBuildPart, "#21");
1332                         Assert.AreEqual (3, fvi.ProductMajorPart, "#22");
1333                         Assert.AreEqual (9, fvi.ProductMinorPart, "#23");
1334                         Assert.AreEqual ("AAA", fvi.ProductName, "#24");
1335                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1336                         Assert.AreEqual ("3.9.2", fvi.ProductVersion, "#26");
1337                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1338                 }
1339
1340                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
1341                 public void DefineVersionInfoResource1h ()
1342                 {
1343                         AssemblyName aname = new AssemblyName ();
1344                         aname.CultureInfo = new CultureInfo ("nl-BE");
1345                         aname.Name = "lib1h";
1346                         aname.Version = new Version (5, 4);
1347
1348                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1349                                 aname, AssemblyBuilderAccess.RunAndSave,
1350                                 tempDir);
1351
1352                         // CompanyName
1353                         Type attrType = typeof (AssemblyCompanyAttribute);
1354                         ConstructorInfo ci = attrType.GetConstructor (
1355                                 new Type [] { typeof (String) });
1356                         CustomAttributeBuilder cab =
1357                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
1358                         ab.SetCustomAttribute (cab);
1359
1360                         // Comments
1361                         attrType = typeof (AssemblyDescriptionAttribute);
1362                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1363                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
1364                         ab.SetCustomAttribute (cab);
1365
1366                         // ProductName
1367                         attrType = typeof (AssemblyProductAttribute);
1368                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1369                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
1370                         ab.SetCustomAttribute (cab);
1371
1372                         // LegalCopyright
1373                         attrType = typeof (AssemblyCopyrightAttribute);
1374                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1375                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
1376                         ab.SetCustomAttribute (cab);
1377
1378                         // LegalTrademarks
1379                         attrType = typeof (AssemblyTrademarkAttribute);
1380                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1381                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
1382                         ab.SetCustomAttribute (cab);
1383
1384                         // AssemblyVersion
1385                         attrType = typeof (AssemblyVersionAttribute);
1386                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1387                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
1388                         ab.SetCustomAttribute (cab);
1389
1390                         // AssemblyFileVersion
1391                         attrType = typeof (AssemblyFileVersionAttribute);
1392                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1393                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
1394                         ab.SetCustomAttribute (cab);
1395
1396                         // AssemblyInformationalVersion
1397                         attrType = typeof (AssemblyInformationalVersionAttribute);
1398                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1399                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
1400                         ab.SetCustomAttribute (cab);
1401
1402                         // AssemblyCulture
1403                         attrType = typeof (AssemblyCultureAttribute);
1404                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1405                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
1406                         ab.SetCustomAttribute (cab);
1407
1408                         ab.DefineVersionInfoResource (null, null, null, null, null);
1409                         ab.Save ("lib1h.dll");
1410
1411                         string assemblyFile = Path.Combine (tempDir, "lib1h.dll");
1412
1413                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1414                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
1415                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
1416                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
1417                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1418                         Assert.AreEqual (5, fvi.FileMajorPart, "#5");
1419                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
1420                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1421                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
1422                         Assert.AreEqual ("5.4.0.0", fvi.FileVersion, "#9");
1423                         Assert.AreEqual ("lib1h", fvi.InternalName, "#10");
1424                         Assert.IsFalse (fvi.IsDebug, "#11");
1425                         Assert.IsFalse (fvi.IsPatched, "#12");
1426                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1427                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1428                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1429                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
1430                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
1431                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
1432                         Assert.AreEqual ("lib1h.dll", fvi.OriginalFilename, "#19");
1433                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1434                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
1435                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
1436                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
1437                         Assert.AreEqual (" ", fvi.ProductName, "#24");
1438                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1439                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
1440                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1441                 }
1442
1443                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
1444                 public void DefineVersionInfoResource1i ()
1445                 {
1446                         AssemblyName aname = new AssemblyName ();
1447                         aname.Name = "lib1i";
1448                         aname.Version = new Version (5, 4, 8, 2);
1449
1450                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1451                                 aname, AssemblyBuilderAccess.RunAndSave,
1452                                 tempDir);
1453
1454                         // CompanyName
1455                         Type attrType = typeof (AssemblyCompanyAttribute);
1456                         ConstructorInfo ci = attrType.GetConstructor (
1457                                 new Type [] { typeof (String) });
1458                         CustomAttributeBuilder cab =
1459                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
1460                         ab.SetCustomAttribute (cab);
1461
1462                         // Comments
1463                         attrType = typeof (AssemblyDescriptionAttribute);
1464                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1465                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
1466                         ab.SetCustomAttribute (cab);
1467
1468                         // ProductName
1469                         attrType = typeof (AssemblyProductAttribute);
1470                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1471                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
1472                         ab.SetCustomAttribute (cab);
1473
1474                         // LegalCopyright
1475                         attrType = typeof (AssemblyCopyrightAttribute);
1476                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1477                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
1478                         ab.SetCustomAttribute (cab);
1479
1480                         // LegalTrademarks
1481                         attrType = typeof (AssemblyTrademarkAttribute);
1482                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1483                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
1484                         ab.SetCustomAttribute (cab);
1485
1486                         // AssemblyVersion
1487                         attrType = typeof (AssemblyVersionAttribute);
1488                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1489                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
1490                         ab.SetCustomAttribute (cab);
1491
1492                         // AssemblyFileVersion
1493                         attrType = typeof (AssemblyFileVersionAttribute);
1494                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1495                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
1496                         ab.SetCustomAttribute (cab);
1497
1498                         // AssemblyInformationalVersion
1499                         attrType = typeof (AssemblyInformationalVersionAttribute);
1500                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1501                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
1502                         ab.SetCustomAttribute (cab);
1503
1504                         ab.DefineVersionInfoResource ("AAA", string.Empty,
1505                                 "BBB", "CCC", "DDD");
1506                         ab.Save ("lib1i.dll");
1507
1508                         string assemblyFile = Path.Combine (tempDir, "lib1i.dll");
1509
1510                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1511                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
1512                         Assert.AreEqual ("BBB", fvi.CompanyName, "#2");
1513                         Assert.AreEqual (8, fvi.FileBuildPart, "#3");
1514                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1515                         Assert.AreEqual (5, fvi.FileMajorPart, "#5");
1516                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
1517                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1518                         Assert.AreEqual (2, fvi.FilePrivatePart, "#8");
1519                         Assert.AreEqual ("5.4.8.2", fvi.FileVersion, "#9");
1520                         Assert.AreEqual ("lib1i", fvi.InternalName, "#10");
1521                         Assert.IsFalse (fvi.IsDebug, "#11");
1522                         Assert.IsFalse (fvi.IsPatched, "#12");
1523                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1524                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1525                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1526                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
1527                         Assert.AreEqual ("CCC", fvi.LegalCopyright, "#17");
1528                         Assert.AreEqual ("DDD", fvi.LegalTrademarks, "#18");
1529                         Assert.AreEqual ("lib1i.dll", fvi.OriginalFilename, "#19");
1530                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1531                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
1532                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
1533                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
1534                         Assert.AreEqual ("AAA", fvi.ProductName, "#24");
1535                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1536                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
1537                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1538                 }
1539
1540                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
1541                 public void DefineVersionInfoResource1j ()
1542                 {
1543                         AssemblyName aname = new AssemblyName ();
1544                         aname.Name = "lib1j";
1545                         aname.Version = new Version (5, 4, 8, 2);
1546
1547                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1548                                 aname, AssemblyBuilderAccess.RunAndSave,
1549                                 tempDir);
1550
1551                         // CompanyName
1552                         Type attrType = typeof (AssemblyCompanyAttribute);
1553                         ConstructorInfo ci = attrType.GetConstructor (
1554                                 new Type [] { typeof (String) });
1555                         CustomAttributeBuilder cab =
1556                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
1557                         ab.SetCustomAttribute (cab);
1558
1559                         // Comments
1560                         attrType = typeof (AssemblyDescriptionAttribute);
1561                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1562                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
1563                         ab.SetCustomAttribute (cab);
1564
1565                         // ProductName
1566                         attrType = typeof (AssemblyProductAttribute);
1567                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1568                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
1569                         ab.SetCustomAttribute (cab);
1570
1571                         // LegalCopyright
1572                         attrType = typeof (AssemblyCopyrightAttribute);
1573                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1574                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
1575                         ab.SetCustomAttribute (cab);
1576
1577                         // LegalTrademarks
1578                         attrType = typeof (AssemblyTrademarkAttribute);
1579                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1580                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
1581                         ab.SetCustomAttribute (cab);
1582
1583                         // AssemblyVersion
1584                         attrType = typeof (AssemblyVersionAttribute);
1585                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1586                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
1587                         ab.SetCustomAttribute (cab);
1588
1589                         // AssemblyFileVersion
1590                         attrType = typeof (AssemblyFileVersionAttribute);
1591                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1592                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
1593                         ab.SetCustomAttribute (cab);
1594
1595                         // AssemblyInformationalVersion
1596                         attrType = typeof (AssemblyInformationalVersionAttribute);
1597                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1598                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
1599                         ab.SetCustomAttribute (cab);
1600
1601                         ab.DefineVersionInfoResource (string.Empty, string.Empty,
1602                                 string.Empty, string.Empty, string.Empty);
1603                         ab.Save ("lib1j.dll");
1604
1605                         string assemblyFile = Path.Combine (tempDir, "lib1j.dll");
1606
1607                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1608                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
1609                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
1610                         Assert.AreEqual (8, fvi.FileBuildPart, "#3");
1611                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1612                         Assert.AreEqual (5, fvi.FileMajorPart, "#5");
1613                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
1614                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1615                         Assert.AreEqual (2, fvi.FilePrivatePart, "#8");
1616                         Assert.AreEqual ("5.4.8.2", fvi.FileVersion, "#9");
1617                         Assert.AreEqual ("lib1j", fvi.InternalName, "#10");
1618                         Assert.IsFalse (fvi.IsDebug, "#11");
1619                         Assert.IsFalse (fvi.IsPatched, "#12");
1620                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1621                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1622                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1623                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
1624                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
1625                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
1626                         Assert.AreEqual ("lib1j.dll", fvi.OriginalFilename, "#19");
1627                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1628                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
1629                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
1630                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
1631                         Assert.AreEqual (" ", fvi.ProductName, "#24");
1632                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1633                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
1634                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1635                 }
1636
1637                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
1638                 public void DefineVersionInfoResource1k ()
1639                 {
1640                         AssemblyName aname = new AssemblyName ();
1641                         aname.CultureInfo = new CultureInfo ("nl");
1642                         aname.Name = "lib1k";
1643                         aname.Version = new Version (5, 4, 7, 8);
1644
1645                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1646                                 aname, AssemblyBuilderAccess.RunAndSave,
1647                                 tempDir);
1648
1649                         // AssemblyCulture
1650                         Type attrType = typeof (AssemblyCultureAttribute);
1651                         ConstructorInfo ci = attrType.GetConstructor (new Type [] { typeof (String) });
1652                         CustomAttributeBuilder cab = new CustomAttributeBuilder (
1653                                 ci, new object [1] { string.Empty });
1654                         ab.SetCustomAttribute (cab);
1655
1656                         ab.DefineVersionInfoResource (null, null, null, null, null);
1657                         ab.Save ("lib1k.dll");
1658
1659                         string assemblyFile = Path.Combine (tempDir, "lib1k.dll");
1660
1661                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1662                         Assert.AreEqual (" ", fvi.Comments, "#1");
1663                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
1664                         Assert.AreEqual (7, fvi.FileBuildPart, "#3");
1665                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1666                         Assert.AreEqual (5, fvi.FileMajorPart, "#5");
1667                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
1668                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1669                         Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
1670                         Assert.AreEqual ("5.4.7.8", fvi.FileVersion, "#9");
1671                         Assert.AreEqual ("lib1k", fvi.InternalName, "#10");
1672                         Assert.IsFalse (fvi.IsDebug, "#11");
1673                         Assert.IsFalse (fvi.IsPatched, "#12");
1674                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1675                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1676                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1677                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
1678                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
1679                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
1680                         Assert.AreEqual ("lib1k.dll", fvi.OriginalFilename, "#19");
1681                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1682                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
1683                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
1684                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
1685                         Assert.AreEqual (" ", fvi.ProductName, "#24");
1686                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1687                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
1688                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1689                 }
1690
1691                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
1692                 public void DefineVersionInfoResource1l ()
1693                 {
1694                         AssemblyName aname = new AssemblyName ();
1695                         aname.CultureInfo = new CultureInfo ("nl-BE");
1696                         aname.Name = "lib1l";
1697                         aname.Version = new Version (5, 4, 7, 8);
1698
1699                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1700                                 aname, AssemblyBuilderAccess.RunAndSave,
1701                                 tempDir);
1702                         ab.DefineVersionInfoResource ("AAA", "3.9.2", "BBB", "CCC", "DDD");
1703
1704                         // CompanyName
1705                         Type attrType = typeof (AssemblyCompanyAttribute);
1706                         ConstructorInfo ci = attrType.GetConstructor (
1707                                 new Type [] { typeof (String) });
1708                         CustomAttributeBuilder cab =
1709                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
1710                         ab.SetCustomAttribute (cab);
1711
1712                         // Comments
1713                         attrType = typeof (AssemblyDescriptionAttribute);
1714                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1715                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
1716                         ab.SetCustomAttribute (cab);
1717
1718                         // ProductName
1719                         attrType = typeof (AssemblyProductAttribute);
1720                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1721                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
1722                         ab.SetCustomAttribute (cab);
1723
1724                         // LegalCopyright
1725                         attrType = typeof (AssemblyCopyrightAttribute);
1726                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1727                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
1728                         ab.SetCustomAttribute (cab);
1729
1730                         // LegalTrademarks
1731                         attrType = typeof (AssemblyTrademarkAttribute);
1732                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1733                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
1734                         ab.SetCustomAttribute (cab);
1735
1736                         // AssemblyVersion
1737                         attrType = typeof (AssemblyVersionAttribute);
1738                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1739                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
1740                         ab.SetCustomAttribute (cab);
1741
1742                         // AssemblyFileVersion
1743                         attrType = typeof (AssemblyFileVersionAttribute);
1744                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1745                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
1746                         ab.SetCustomAttribute (cab);
1747
1748                         // AssemblyInformationalVersion
1749                         attrType = typeof (AssemblyInformationalVersionAttribute);
1750                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1751                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
1752                         ab.SetCustomAttribute (cab);
1753
1754                         // AssemblyCulture
1755                         attrType = typeof (AssemblyCultureAttribute);
1756                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1757                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
1758                         ab.SetCustomAttribute (cab);
1759
1760                         ab.Save ("lib1l.dll");
1761
1762                         string assemblyFile = Path.Combine (tempDir, "lib1l.dll");
1763
1764                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1765                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
1766                         Assert.AreEqual ("BBB", fvi.CompanyName, "#2");
1767                         Assert.AreEqual (7, fvi.FileBuildPart, "#3");
1768                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1769                         Assert.AreEqual (5, fvi.FileMajorPart, "#5");
1770                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
1771                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1772                         Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
1773                         Assert.AreEqual ("5.4.7.8", fvi.FileVersion, "#9");
1774                         Assert.AreEqual ("lib1l", fvi.InternalName, "#10");
1775                         Assert.IsFalse (fvi.IsDebug, "#11");
1776                         Assert.IsFalse (fvi.IsPatched, "#12");
1777                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1778                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1779                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1780                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
1781                         Assert.AreEqual ("CCC", fvi.LegalCopyright, "#17");
1782                         Assert.AreEqual ("DDD", fvi.LegalTrademarks, "#18");
1783                         Assert.AreEqual ("lib1l.dll", fvi.OriginalFilename, "#19");
1784                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1785                         Assert.AreEqual (2, fvi.ProductBuildPart, "#21");
1786                         Assert.AreEqual (3, fvi.ProductMajorPart, "#22");
1787                         Assert.AreEqual (9, fvi.ProductMinorPart, "#23");
1788                         Assert.AreEqual ("AAA", fvi.ProductName, "#24");
1789                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1790                         Assert.AreEqual ("3.9.2", fvi.ProductVersion, "#26");
1791                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1792                 }
1793
1794                 [Test] // DefineVersionInfoResource (String, String, String, String, String)
1795                 public void DefineVersionInfoResource1m ()
1796                 {
1797                         AssemblyName aname = new AssemblyName ();
1798                         aname.CultureInfo = new CultureInfo ("nl-BE");
1799                         aname.Name = "lib1m";
1800                         aname.Version = new Version (5, 4, 7, 8);
1801
1802                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1803                                 aname, AssemblyBuilderAccess.RunAndSave,
1804                                 tempDir);
1805                         ab.DefineVersionInfoResource (string.Empty, string.Empty,
1806                                 string.Empty, string.Empty, string.Empty);
1807
1808                         // CompanyName
1809                         Type attrType = typeof (AssemblyCompanyAttribute);
1810                         ConstructorInfo ci = attrType.GetConstructor (
1811                                 new Type [] { typeof (String) });
1812                         CustomAttributeBuilder cab =
1813                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
1814                         ab.SetCustomAttribute (cab);
1815
1816                         // Comments
1817                         attrType = typeof (AssemblyDescriptionAttribute);
1818                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1819                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
1820                         ab.SetCustomAttribute (cab);
1821
1822                         // ProductName
1823                         attrType = typeof (AssemblyProductAttribute);
1824                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1825                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
1826                         ab.SetCustomAttribute (cab);
1827
1828                         // LegalCopyright
1829                         attrType = typeof (AssemblyCopyrightAttribute);
1830                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1831                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
1832                         ab.SetCustomAttribute (cab);
1833
1834                         // LegalTrademarks
1835                         attrType = typeof (AssemblyTrademarkAttribute);
1836                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1837                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
1838                         ab.SetCustomAttribute (cab);
1839
1840                         // AssemblyVersion
1841                         attrType = typeof (AssemblyVersionAttribute);
1842                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1843                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
1844                         ab.SetCustomAttribute (cab);
1845
1846                         // AssemblyFileVersion
1847                         attrType = typeof (AssemblyFileVersionAttribute);
1848                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1849                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
1850                         ab.SetCustomAttribute (cab);
1851
1852                         // AssemblyInformationalVersion
1853                         attrType = typeof (AssemblyInformationalVersionAttribute);
1854                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1855                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
1856                         ab.SetCustomAttribute (cab);
1857
1858                         // AssemblyCulture
1859                         attrType = typeof (AssemblyCultureAttribute);
1860                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1861                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
1862                         ab.SetCustomAttribute (cab);
1863
1864                         ab.Save ("lib1m.dll");
1865
1866                         string assemblyFile = Path.Combine (tempDir, "lib1m.dll");
1867
1868                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1869                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
1870                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
1871                         Assert.AreEqual (7, fvi.FileBuildPart, "#3");
1872                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1873                         Assert.AreEqual (5, fvi.FileMajorPart, "#5");
1874                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
1875                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1876                         Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
1877                         Assert.AreEqual ("5.4.7.8", fvi.FileVersion, "#9");
1878                         Assert.AreEqual ("lib1m", fvi.InternalName, "#10");
1879                         Assert.IsFalse (fvi.IsDebug, "#11");
1880                         Assert.IsFalse (fvi.IsPatched, "#12");
1881                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1882                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1883                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1884                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
1885                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
1886                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
1887                         Assert.AreEqual ("lib1m.dll", fvi.OriginalFilename, "#19");
1888                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1889                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
1890                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
1891                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
1892                         Assert.AreEqual (" ", fvi.ProductName, "#24");
1893                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1894                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
1895                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1896                 }
1897
1898                 [Test] // DefineVersionInfoResource ()
1899                 public void DefineVersionInfoResource2a ()
1900                 {
1901                         AssemblyName aname = new AssemblyName ();
1902                         aname.Name = "lib2a";
1903
1904                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1905                                 aname, AssemblyBuilderAccess.RunAndSave,
1906                                 tempDir);
1907                         ab.DefineVersionInfoResource ();
1908                         ab.Save ("lib2a.dll");
1909
1910                         string assemblyFile = Path.Combine (tempDir, "lib2a.dll");
1911
1912                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
1913                         Assert.AreEqual (" ", fvi.Comments, "#1");
1914                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
1915                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
1916                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
1917                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
1918                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
1919                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
1920                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
1921                         Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
1922                         Assert.AreEqual ("lib2a", fvi.InternalName, "#10");
1923                         Assert.IsFalse (fvi.IsDebug, "#11");
1924                         Assert.IsFalse (fvi.IsPatched, "#12");
1925                         Assert.IsFalse (fvi.IsPreRelease, "#13");
1926                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
1927                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
1928                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
1929                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
1930                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
1931                         Assert.AreEqual ("lib2a.dll", fvi.OriginalFilename, "#19");
1932                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
1933                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
1934                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
1935                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
1936                         Assert.AreEqual (" ", fvi.ProductName, "#24");
1937                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
1938                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
1939                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
1940                 }
1941
1942                 [Test] // DefineVersionInfoResource ()
1943                 public void DefineVersionInfoResource2b ()
1944                 {
1945                         AssemblyName aname = new AssemblyName ();
1946                         aname.Name = "lib2b";
1947                         aname.Version = new Version (3, 5, 7, 9);
1948
1949                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
1950                                 aname, AssemblyBuilderAccess.RunAndSave,
1951                                 tempDir);
1952
1953                         // CompanyName
1954                         Type attrType = typeof (AssemblyCompanyAttribute);
1955                         ConstructorInfo ci = attrType.GetConstructor (
1956                                 new Type [] { typeof (String) });
1957                         CustomAttributeBuilder cab =
1958                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
1959                         ab.SetCustomAttribute (cab);
1960
1961                         // Comments
1962                         attrType = typeof (AssemblyDescriptionAttribute);
1963                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1964                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
1965                         ab.SetCustomAttribute (cab);
1966
1967                         // ProductName
1968                         attrType = typeof (AssemblyProductAttribute);
1969                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1970                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
1971                         ab.SetCustomAttribute (cab);
1972
1973                         // LegalCopyright
1974                         attrType = typeof (AssemblyCopyrightAttribute);
1975                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1976                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
1977                         ab.SetCustomAttribute (cab);
1978
1979                         // LegalTrademarks
1980                         attrType = typeof (AssemblyTrademarkAttribute);
1981                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1982                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
1983                         ab.SetCustomAttribute (cab);
1984
1985                         // AssemblyVersion
1986                         attrType = typeof (AssemblyVersionAttribute);
1987                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1988                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
1989                         ab.SetCustomAttribute (cab);
1990
1991                         // AssemblyFileVersion
1992                         attrType = typeof (AssemblyFileVersionAttribute);
1993                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
1994                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
1995                         ab.SetCustomAttribute (cab);
1996
1997                         // AssemblyInformationalVersion
1998                         attrType = typeof (AssemblyInformationalVersionAttribute);
1999                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2000                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
2001                         ab.SetCustomAttribute (cab);
2002
2003                         // AssemblyCulture
2004                         attrType = typeof (AssemblyCultureAttribute);
2005                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2006                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
2007                         ab.SetCustomAttribute (cab);
2008
2009                         ab.DefineVersionInfoResource ();
2010                         ab.Save ("lib2b.dll");
2011
2012                         string assemblyFile = Path.Combine (tempDir, "lib2b.dll");
2013
2014                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2015                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
2016                         Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
2017                         Assert.AreEqual (6, fvi.FileBuildPart, "#3");
2018                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2019                         Assert.AreEqual (2, fvi.FileMajorPart, "#5");
2020                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
2021                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2022                         Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
2023                         Assert.AreEqual ("2.4.6.8", fvi.FileVersion, "#9");
2024                         Assert.AreEqual ("lib2b", fvi.InternalName, "#10");
2025                         Assert.IsFalse (fvi.IsDebug, "#11");
2026                         Assert.IsFalse (fvi.IsPatched, "#12");
2027                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2028                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2029                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2030                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
2031                         Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
2032                         Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
2033                         Assert.AreEqual ("lib2b.dll", fvi.OriginalFilename, "#19");
2034                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2035                         Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
2036                         Assert.AreEqual (6, fvi.ProductMajorPart, "#22");
2037                         Assert.AreEqual (4, fvi.ProductMinorPart, "#23");
2038                         Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
2039                         Assert.AreEqual (1, fvi.ProductPrivatePart, "#25");
2040                         Assert.AreEqual ("6.4.7.1", fvi.ProductVersion, "#26");
2041                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2042                 }
2043
2044                 [Test] // DefineVersionInfoResource ()
2045                 public void DefineVersionInfoResource2c ()
2046                 {
2047                         AssemblyName aname = new AssemblyName ();
2048                         aname.Name = "lib2c";
2049                         aname.Version = new Version (3, 5, 7, 9);
2050
2051                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
2052                                 aname, AssemblyBuilderAccess.RunAndSave,
2053                                 tempDir);
2054
2055                         // AssemblyVersion
2056                         Type attrType = typeof (AssemblyVersionAttribute);
2057                         ConstructorInfo ci = attrType.GetConstructor (new Type [] { typeof (String) });
2058                         CustomAttributeBuilder cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
2059                         ab.SetCustomAttribute (cab);
2060
2061                         // AssemblyCulture
2062                         attrType = typeof (AssemblyCultureAttribute);
2063                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2064                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
2065                         ab.SetCustomAttribute (cab);
2066
2067                         ab.DefineVersionInfoResource ();
2068                         ab.Save ("lib2c.dll");
2069
2070                         string assemblyFile = Path.Combine (tempDir, "lib2c.dll");
2071
2072                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2073                         Assert.AreEqual (" ", fvi.Comments, "#1");
2074                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
2075                         Assert.AreEqual (7, fvi.FileBuildPart, "#3");
2076                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2077                         Assert.AreEqual (3, fvi.FileMajorPart, "#5");
2078                         Assert.AreEqual (5, fvi.FileMinorPart, "#6");
2079                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2080                         Assert.AreEqual (9, fvi.FilePrivatePart, "#8");
2081                         Assert.AreEqual ("3.5.7.9", fvi.FileVersion, "#9");
2082                         Assert.AreEqual ("lib2c", fvi.InternalName, "#10");
2083                         Assert.IsFalse (fvi.IsDebug, "#11");
2084                         Assert.IsFalse (fvi.IsPatched, "#12");
2085                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2086                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2087                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2088                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
2089                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
2090                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
2091                         Assert.AreEqual ("lib2c.dll", fvi.OriginalFilename, "#19");
2092                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2093                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
2094                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
2095                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
2096                         Assert.AreEqual (" ", fvi.ProductName, "#24");
2097                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
2098                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
2099                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2100                 }
2101
2102                 [Test] // DefineVersionInfoResource ()
2103                 public void DefineVersionInfoResource2d ()
2104                 {
2105                         AssemblyName aname = new AssemblyName ();
2106                         aname.Name = "lib2d";
2107                         aname.Version = new Version (3, 5, 7, 9);
2108
2109                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
2110                                 aname, AssemblyBuilderAccess.RunAndSave,
2111                                 tempDir);
2112
2113                         // AssemblyVersion
2114                         Type attrType = typeof (AssemblyVersionAttribute);
2115                         ConstructorInfo ci = attrType.GetConstructor (new Type [] { typeof (String) });
2116                         CustomAttributeBuilder cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
2117                         ab.SetCustomAttribute (cab);
2118
2119                         // AssemblyFileVersion
2120                         attrType = typeof (AssemblyFileVersionAttribute);
2121                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2122                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6" });
2123                         ab.SetCustomAttribute (cab);
2124
2125                         // AssemblyCulture
2126                         attrType = typeof (AssemblyCultureAttribute);
2127                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2128                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
2129                         ab.SetCustomAttribute (cab);
2130
2131                         ab.DefineVersionInfoResource ();
2132                         ab.Save ("lib2d.dll");
2133
2134                         string assemblyFile = Path.Combine (tempDir, "lib2d.dll");
2135
2136                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2137                         Assert.AreEqual (" ", fvi.Comments, "#1");
2138                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
2139                         Assert.AreEqual (6, fvi.FileBuildPart, "#3");
2140                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2141                         Assert.AreEqual (2, fvi.FileMajorPart, "#5");
2142                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
2143                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2144                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
2145                         Assert.AreEqual ("2.4.6", fvi.FileVersion, "#9");
2146                         Assert.AreEqual ("lib2d", fvi.InternalName, "#10");
2147                         Assert.IsFalse (fvi.IsDebug, "#11");
2148                         Assert.IsFalse (fvi.IsPatched, "#12");
2149                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2150                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2151                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2152                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
2153                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
2154                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
2155                         Assert.AreEqual ("lib2d.dll", fvi.OriginalFilename, "#19");
2156                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2157                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
2158                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
2159                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
2160                         Assert.AreEqual (" ", fvi.ProductName, "#24");
2161                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
2162                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
2163                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2164                 }
2165
2166                 [Test] // DefineVersionInfoResource ()
2167                 public void DefineVersionInfoResource2e ()
2168                 {
2169                         AssemblyName aname = new AssemblyName ();
2170                         aname.Name = "lib2e";
2171                         aname.Version = new Version (3, 5, 7, 9);
2172
2173                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
2174                                 aname, AssemblyBuilderAccess.RunAndSave,
2175                                 tempDir);
2176
2177                         // AssemblyVersion
2178                         Type attrType = typeof (AssemblyVersionAttribute);
2179                         ConstructorInfo ci = attrType.GetConstructor (new Type [] { typeof (String) });
2180                         CustomAttributeBuilder cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
2181                         ab.SetCustomAttribute (cab);
2182
2183                         // AssemblyFileVersion
2184                         attrType = typeof (AssemblyFileVersionAttribute);
2185                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2186                         cab = new CustomAttributeBuilder (ci, new object [1] { "0.0.0.0" });
2187                         ab.SetCustomAttribute (cab);
2188
2189                         // AssemblyCulture
2190                         attrType = typeof (AssemblyCultureAttribute);
2191                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2192                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
2193                         ab.SetCustomAttribute (cab);
2194
2195                         ab.DefineVersionInfoResource ();
2196                         ab.Save ("lib2e.dll");
2197
2198                         string assemblyFile = Path.Combine (tempDir, "lib2e.dll");
2199
2200                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2201                         Assert.AreEqual (" ", fvi.Comments, "#1");
2202                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
2203                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
2204                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2205                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
2206                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
2207                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2208                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
2209                         Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
2210                         Assert.AreEqual ("lib2e", fvi.InternalName, "#10");
2211                         Assert.IsFalse (fvi.IsDebug, "#11");
2212                         Assert.IsFalse (fvi.IsPatched, "#12");
2213                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2214                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2215                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2216                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
2217                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
2218                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
2219                         Assert.AreEqual ("lib2e.dll", fvi.OriginalFilename, "#19");
2220                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2221                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
2222                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
2223                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
2224                         Assert.AreEqual (" ", fvi.ProductName, "#24");
2225                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
2226                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
2227                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2228                 }
2229
2230                 [Test] // DefineVersionInfoResource ()
2231                 public void DefineVersionInfoResource2f ()
2232                 {
2233                         AssemblyName aname = new AssemblyName ();
2234                         aname.CultureInfo = new CultureInfo ("nl-BE");
2235                         aname.Name = "lib2f";
2236                         aname.Version = new Version (3, 5, 7);
2237
2238                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
2239                                 aname, AssemblyBuilderAccess.RunAndSave,
2240                                 tempDir);
2241
2242                         ab.DefineVersionInfoResource ();
2243                         ab.Save ("lib2f.dll");
2244
2245                         string assemblyFile = Path.Combine (tempDir, "lib2f.dll");
2246
2247                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2248                         Assert.AreEqual (" ", fvi.Comments, "#1");
2249                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
2250                         Assert.AreEqual (7, fvi.FileBuildPart, "#3");
2251                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2252                         Assert.AreEqual (3, fvi.FileMajorPart, "#5");
2253                         Assert.AreEqual (5, fvi.FileMinorPart, "#6");
2254                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2255                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
2256                         Assert.AreEqual ("3.5.7.0", fvi.FileVersion, "#9");
2257                         Assert.AreEqual ("lib2f", fvi.InternalName, "#10");
2258                         Assert.IsFalse (fvi.IsDebug, "#11");
2259                         Assert.IsFalse (fvi.IsPatched, "#12");
2260                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2261                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2262                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2263                         //Assert.AreEqual ("Dutch (Belgium)", fvi.Language, "#16");
2264                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
2265                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
2266                         Assert.AreEqual ("lib2f.dll", fvi.OriginalFilename, "#19");
2267                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2268                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
2269                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
2270                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
2271                         Assert.AreEqual (" ", fvi.ProductName, "#24");
2272                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
2273                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
2274                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2275                 }
2276
2277                 [Test] // DefineVersionInfoResource ()
2278                 public void DefineVersionInfoResource2g ()
2279                 {
2280                         AssemblyName aname = new AssemblyName ();
2281                         aname.CultureInfo = new CultureInfo ("nl-BE");
2282                         aname.Name = "lib2g";
2283                         aname.Version = new Version (3, 5, 7, 9);
2284
2285                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
2286                                 aname, AssemblyBuilderAccess.RunAndSave,
2287                                 tempDir);
2288
2289                         // CompanyName
2290                         Type attrType = typeof (AssemblyCompanyAttribute);
2291                         ConstructorInfo ci = attrType.GetConstructor (
2292                                 new Type [] { typeof (String) });
2293                         CustomAttributeBuilder cab =
2294                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
2295                         ab.SetCustomAttribute (cab);
2296
2297                         // Comments
2298                         attrType = typeof (AssemblyDescriptionAttribute);
2299                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2300                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
2301                         ab.SetCustomAttribute (cab);
2302
2303                         // ProductName
2304                         attrType = typeof (AssemblyProductAttribute);
2305                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2306                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
2307                         ab.SetCustomAttribute (cab);
2308
2309                         // LegalCopyright
2310                         attrType = typeof (AssemblyCopyrightAttribute);
2311                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2312                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
2313                         ab.SetCustomAttribute (cab);
2314
2315                         // LegalTrademarks
2316                         attrType = typeof (AssemblyTrademarkAttribute);
2317                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2318                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
2319                         ab.SetCustomAttribute (cab);
2320
2321                         // AssemblyVersion
2322                         attrType = typeof (AssemblyVersionAttribute);
2323                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2324                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
2325                         ab.SetCustomAttribute (cab);
2326
2327                         // AssemblyFileVersion
2328                         attrType = typeof (AssemblyFileVersionAttribute);
2329                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2330                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6" });
2331                         ab.SetCustomAttribute (cab);
2332
2333                         // AssemblyInformationalVersion
2334                         attrType = typeof (AssemblyInformationalVersionAttribute);
2335                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2336                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7" });
2337                         ab.SetCustomAttribute (cab);
2338
2339                         // AssemblyCulture
2340                         attrType = typeof (AssemblyCultureAttribute);
2341                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2342                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
2343                         ab.SetCustomAttribute (cab);
2344
2345                         ab.DefineVersionInfoResource ();
2346                         ab.Save ("lib2b.dll");
2347
2348                         string assemblyFile = Path.Combine (tempDir, "lib2b.dll");
2349
2350                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2351                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
2352                         Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
2353                         Assert.AreEqual (6, fvi.FileBuildPart, "#3");
2354                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2355                         Assert.AreEqual (2, fvi.FileMajorPart, "#5");
2356                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
2357                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2358                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
2359                         Assert.AreEqual ("2.4.6", fvi.FileVersion, "#9");
2360                         Assert.AreEqual ("lib2b", fvi.InternalName, "#10");
2361                         Assert.IsFalse (fvi.IsDebug, "#11");
2362                         Assert.IsFalse (fvi.IsPatched, "#12");
2363                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2364                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2365                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2366                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
2367                         Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
2368                         Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
2369                         Assert.AreEqual ("lib2b.dll", fvi.OriginalFilename, "#19");
2370                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2371                         Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
2372                         Assert.AreEqual (6, fvi.ProductMajorPart, "#22");
2373                         Assert.AreEqual (4, fvi.ProductMinorPart, "#23");
2374                         Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
2375                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
2376                         Assert.AreEqual ("6.4.7", fvi.ProductVersion, "#26");
2377                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2378                 }
2379
2380                 [Test] // DefineVersionInfoResource ()
2381                 public void DefineVersionInfoResource2h ()
2382                 {
2383                         AssemblyName aname = new AssemblyName ();
2384                         aname.CultureInfo = new CultureInfo ("nl-BE");
2385                         aname.Name = "lib2h";
2386                         aname.Version = new Version (3, 5, 7);
2387
2388                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
2389                                 aname, AssemblyBuilderAccess.RunAndSave,
2390                                 tempDir);
2391
2392                         // CompanyName
2393                         Type attrType = typeof (AssemblyCompanyAttribute);
2394                         ConstructorInfo ci = attrType.GetConstructor (
2395                                 new Type [] { typeof (String) });
2396                         CustomAttributeBuilder cab =
2397                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
2398                         ab.SetCustomAttribute (cab);
2399
2400                         // Comments
2401                         attrType = typeof (AssemblyDescriptionAttribute);
2402                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2403                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
2404                         ab.SetCustomAttribute (cab);
2405
2406                         // ProductName
2407                         attrType = typeof (AssemblyProductAttribute);
2408                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2409                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
2410                         ab.SetCustomAttribute (cab);
2411
2412                         // LegalCopyright
2413                         attrType = typeof (AssemblyCopyrightAttribute);
2414                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2415                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
2416                         ab.SetCustomAttribute (cab);
2417
2418                         // LegalTrademarks
2419                         attrType = typeof (AssemblyTrademarkAttribute);
2420                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2421                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
2422                         ab.SetCustomAttribute (cab);
2423
2424                         // AssemblyVersion
2425                         attrType = typeof (AssemblyVersionAttribute);
2426                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2427                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
2428                         ab.SetCustomAttribute (cab);
2429
2430                         // AssemblyFileVersion
2431                         attrType = typeof (AssemblyFileVersionAttribute);
2432                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2433                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6" });
2434                         ab.SetCustomAttribute (cab);
2435
2436                         // AssemblyInformationalVersion
2437                         attrType = typeof (AssemblyInformationalVersionAttribute);
2438                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2439                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7" });
2440                         ab.SetCustomAttribute (cab);
2441
2442                         ab.DefineVersionInfoResource ();
2443                         ab.Save ("lib2h.dll");
2444
2445                         string assemblyFile = Path.Combine (tempDir, "lib2h.dll");
2446
2447                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2448                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
2449                         Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
2450                         Assert.AreEqual (6, fvi.FileBuildPart, "#3");
2451                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2452                         Assert.AreEqual (2, fvi.FileMajorPart, "#5");
2453                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
2454                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2455                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
2456                         Assert.AreEqual ("2.4.6", fvi.FileVersion, "#9");
2457                         Assert.AreEqual ("lib2h", fvi.InternalName, "#10");
2458                         Assert.IsFalse (fvi.IsDebug, "#11");
2459                         Assert.IsFalse (fvi.IsPatched, "#12");
2460                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2461                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2462                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2463                         //Assert.AreEqual ("Dutch (Belgium)", fvi.Language, "#16");
2464                         Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
2465                         Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
2466                         Assert.AreEqual ("lib2h.dll", fvi.OriginalFilename, "#19");
2467                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2468                         Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
2469                         Assert.AreEqual (6, fvi.ProductMajorPart, "#22");
2470                         Assert.AreEqual (4, fvi.ProductMinorPart, "#23");
2471                         Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
2472                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
2473                         Assert.AreEqual ("6.4.7", fvi.ProductVersion, "#26");
2474                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2475                 }
2476
2477                 [Test] // DefineVersionInfoResource ()
2478                 public void DefineVersionInfoResource2i ()
2479                 {
2480                         AssemblyName aname = new AssemblyName ();
2481                         aname.CultureInfo = new CultureInfo ("nl-BE");
2482                         aname.Name = "lib2i";
2483                         aname.Version = new Version (3, 5, 7);
2484
2485                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
2486                                 aname, AssemblyBuilderAccess.RunAndSave,
2487                                 tempDir);
2488
2489                         // CompanyName
2490                         Type attrType = typeof (AssemblyCompanyAttribute);
2491                         ConstructorInfo ci = attrType.GetConstructor (
2492                                 new Type [] { typeof (String) });
2493                         CustomAttributeBuilder cab =
2494                                 new CustomAttributeBuilder (ci, new object [1] { string.Empty });
2495                         ab.SetCustomAttribute (cab);
2496
2497                         // Comments
2498                         attrType = typeof (AssemblyDescriptionAttribute);
2499                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2500                         cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
2501                         ab.SetCustomAttribute (cab);
2502
2503                         // ProductName
2504                         attrType = typeof (AssemblyProductAttribute);
2505                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2506                         cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
2507                         ab.SetCustomAttribute (cab);
2508
2509                         // LegalCopyright
2510                         attrType = typeof (AssemblyCopyrightAttribute);
2511                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2512                         cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
2513                         ab.SetCustomAttribute (cab);
2514
2515                         // LegalTrademarks
2516                         attrType = typeof (AssemblyTrademarkAttribute);
2517                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2518                         cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
2519                         ab.SetCustomAttribute (cab);
2520
2521                         // AssemblyVersion
2522                         attrType = typeof (AssemblyVersionAttribute);
2523                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2524                         cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
2525                         ab.SetCustomAttribute (cab);
2526
2527                         // AssemblyFileVersion
2528                         attrType = typeof (AssemblyFileVersionAttribute);
2529                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2530                         cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
2531                         ab.SetCustomAttribute (cab);
2532
2533                         // AssemblyInformationalVersion
2534                         attrType = typeof (AssemblyInformationalVersionAttribute);
2535                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2536                         cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
2537                         ab.SetCustomAttribute (cab);
2538
2539                         // AssemblyCulture
2540                         attrType = typeof (AssemblyCultureAttribute);
2541                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2542                         cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
2543                         ab.SetCustomAttribute (cab);
2544
2545                         ab.DefineVersionInfoResource ();
2546                         ab.Save ("lib2i.dll");
2547
2548                         string assemblyFile = Path.Combine (tempDir, "lib2i.dll");
2549
2550                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2551                         Assert.AreEqual (" ", fvi.Comments, "#1");
2552                         Assert.AreEqual (" ", fvi.CompanyName, "#2");
2553                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
2554                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2555                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
2556                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
2557                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2558                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
2559                         Assert.AreEqual (" ", fvi.FileVersion, "#9");
2560                         Assert.AreEqual ("lib2i", fvi.InternalName, "#10");
2561                         Assert.IsFalse (fvi.IsDebug, "#11");
2562                         Assert.IsFalse (fvi.IsPatched, "#12");
2563                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2564                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2565                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2566                         Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
2567                         Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
2568                         Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
2569                         Assert.AreEqual ("lib2i.dll", fvi.OriginalFilename, "#19");
2570                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2571                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
2572                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
2573                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
2574                         Assert.AreEqual (" ", fvi.ProductName, "#24");
2575                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
2576                         Assert.AreEqual (" ", fvi.ProductVersion, "#26");
2577                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2578                 }
2579
2580                 [Test] // DefineVersionInfoResource ()
2581                 public void DefineVersionInfoResource2j ()
2582                 {
2583                         AssemblyName aname = new AssemblyName ();
2584                         aname.CultureInfo = new CultureInfo ("nl-BE");
2585                         aname.Name = "lib2j";
2586                         aname.Version = new Version (3, 5, 7, 9);
2587
2588                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
2589                                 aname, AssemblyBuilderAccess.RunAndSave,
2590                                 tempDir);
2591                         ab.DefineVersionInfoResource ();
2592
2593                         // CompanyName
2594                         Type attrType = typeof (AssemblyCompanyAttribute);
2595                         ConstructorInfo ci = attrType.GetConstructor (
2596                                 new Type [] { typeof (String) });
2597                         CustomAttributeBuilder cab =
2598                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
2599                         ab.SetCustomAttribute (cab);
2600
2601                         // Comments
2602                         attrType = typeof (AssemblyDescriptionAttribute);
2603                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2604                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
2605                         ab.SetCustomAttribute (cab);
2606
2607                         // ProductName
2608                         attrType = typeof (AssemblyProductAttribute);
2609                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2610                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
2611                         ab.SetCustomAttribute (cab);
2612
2613                         // LegalCopyright
2614                         attrType = typeof (AssemblyCopyrightAttribute);
2615                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2616                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
2617                         ab.SetCustomAttribute (cab);
2618
2619                         // LegalTrademarks
2620                         attrType = typeof (AssemblyTrademarkAttribute);
2621                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2622                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
2623                         ab.SetCustomAttribute (cab);
2624
2625                         // AssemblyVersion
2626                         attrType = typeof (AssemblyVersionAttribute);
2627                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2628                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
2629                         ab.SetCustomAttribute (cab);
2630
2631                         // AssemblyFileVersion
2632                         attrType = typeof (AssemblyFileVersionAttribute);
2633                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2634                         cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6" });
2635                         ab.SetCustomAttribute (cab);
2636
2637                         // AssemblyInformationalVersion
2638                         attrType = typeof (AssemblyInformationalVersionAttribute);
2639                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2640                         cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7" });
2641                         ab.SetCustomAttribute (cab);
2642
2643                         // AssemblyCulture
2644                         attrType = typeof (AssemblyCultureAttribute);
2645                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2646                         cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
2647                         ab.SetCustomAttribute (cab);
2648
2649                         ab.Save ("lib2j.dll");
2650
2651                         string assemblyFile = Path.Combine (tempDir, "lib2j.dll");
2652
2653                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2654                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
2655                         Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
2656                         Assert.AreEqual (6, fvi.FileBuildPart, "#3");
2657                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2658                         Assert.AreEqual (2, fvi.FileMajorPart, "#5");
2659                         Assert.AreEqual (4, fvi.FileMinorPart, "#6");
2660                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2661                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
2662                         Assert.AreEqual ("2.4.6", fvi.FileVersion, "#9");
2663                         Assert.AreEqual ("lib2j", fvi.InternalName, "#10");
2664                         Assert.IsFalse (fvi.IsDebug, "#11");
2665                         Assert.IsFalse (fvi.IsPatched, "#12");
2666                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2667                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2668                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2669                         //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
2670                         Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
2671                         Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
2672                         Assert.AreEqual ("lib2j.dll", fvi.OriginalFilename, "#19");
2673                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2674                         Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
2675                         Assert.AreEqual (6, fvi.ProductMajorPart, "#22");
2676                         Assert.AreEqual (4, fvi.ProductMinorPart, "#23");
2677                         Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
2678                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
2679                         Assert.AreEqual ("6.4.7", fvi.ProductVersion, "#26");
2680                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2681                 }
2682
2683                 [Test] // DefineVersionInfoResource ()
2684                 public void DefineVersionInfoResource2k ()
2685                 {
2686                         AssemblyName aname = new AssemblyName ();
2687                         aname.CultureInfo = new CultureInfo ("nl-BE");
2688                         aname.Name = "lib2k";
2689                         aname.Version = new Version (3, 5, 7);
2690
2691                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
2692                                 aname, AssemblyBuilderAccess.RunAndSave,
2693                                 tempDir);
2694
2695                         // CompanyName
2696                         Type attrType = typeof (AssemblyCompanyAttribute);
2697                         ConstructorInfo ci = attrType.GetConstructor (
2698                                 new Type [] { typeof (String) });
2699                         CustomAttributeBuilder cab =
2700                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
2701                         ab.SetCustomAttribute (cab);
2702
2703                         // Comments
2704                         attrType = typeof (AssemblyDescriptionAttribute);
2705                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2706                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
2707                         ab.SetCustomAttribute (cab);
2708
2709                         // ProductName
2710                         attrType = typeof (AssemblyProductAttribute);
2711                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2712                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
2713                         ab.SetCustomAttribute (cab);
2714
2715                         // LegalCopyright
2716                         attrType = typeof (AssemblyCopyrightAttribute);
2717                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2718                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
2719                         ab.SetCustomAttribute (cab);
2720
2721                         // LegalTrademarks
2722                         attrType = typeof (AssemblyTrademarkAttribute);
2723                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2724                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
2725                         ab.SetCustomAttribute (cab);
2726
2727                         // AssemblyVersion
2728                         attrType = typeof (AssemblyVersionAttribute);
2729                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2730                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
2731                         ab.SetCustomAttribute (cab);
2732
2733                         // AssemblyFileVersion
2734                         attrType = typeof (AssemblyFileVersionAttribute);
2735                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2736                         cab = new CustomAttributeBuilder (ci, new object [1] { "abc" });
2737                         ab.SetCustomAttribute (cab);
2738
2739                         // AssemblyInformationalVersion
2740                         attrType = typeof (AssemblyInformationalVersionAttribute);
2741                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2742                         cab = new CustomAttributeBuilder (ci, new object [1] { "def" });
2743                         ab.SetCustomAttribute (cab);
2744
2745                         ab.DefineVersionInfoResource ();
2746                         ab.Save ("lib2k.dll");
2747
2748                         string assemblyFile = Path.Combine (tempDir, "lib2k.dll");
2749
2750                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2751                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
2752                         Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
2753                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
2754                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2755                         Assert.AreEqual (0, fvi.FileMajorPart, "#5");
2756                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
2757                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2758                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
2759                         Assert.AreEqual ("abc", fvi.FileVersion, "#9");
2760                         Assert.AreEqual ("lib2k", fvi.InternalName, "#10");
2761                         Assert.IsFalse (fvi.IsDebug, "#11");
2762                         Assert.IsFalse (fvi.IsPatched, "#12");
2763                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2764                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2765                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2766                         //Assert.AreEqual ("Dutch (Belgium)", fvi.Language, "#16");
2767                         Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
2768                         Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
2769                         Assert.AreEqual ("lib2k.dll", fvi.OriginalFilename, "#19");
2770                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2771                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
2772                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
2773                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
2774                         Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
2775                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
2776                         Assert.AreEqual ("def", fvi.ProductVersion, "#26");
2777                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2778                 }
2779
2780                 [Test] // DefineVersionInfoResource ()
2781                 public void DefineVersionInfoResource2l ()
2782                 {
2783                         AssemblyName aname = new AssemblyName ();
2784                         aname.CultureInfo = new CultureInfo ("nl-BE");
2785                         aname.Name = "lib2l";
2786                         aname.Version = new Version (3, 5, 7);
2787
2788                         AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
2789                                 aname, AssemblyBuilderAccess.RunAndSave,
2790                                 tempDir);
2791
2792                         // CompanyName
2793                         Type attrType = typeof (AssemblyCompanyAttribute);
2794                         ConstructorInfo ci = attrType.GetConstructor (
2795                                 new Type [] { typeof (String) });
2796                         CustomAttributeBuilder cab =
2797                                 new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
2798                         ab.SetCustomAttribute (cab);
2799
2800                         // Comments
2801                         attrType = typeof (AssemblyDescriptionAttribute);
2802                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2803                         cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
2804                         ab.SetCustomAttribute (cab);
2805
2806                         // ProductName
2807                         attrType = typeof (AssemblyProductAttribute);
2808                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2809                         cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
2810                         ab.SetCustomAttribute (cab);
2811
2812                         // LegalCopyright
2813                         attrType = typeof (AssemblyCopyrightAttribute);
2814                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2815                         cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
2816                         ab.SetCustomAttribute (cab);
2817
2818                         // LegalTrademarks
2819                         attrType = typeof (AssemblyTrademarkAttribute);
2820                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2821                         cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
2822                         ab.SetCustomAttribute (cab);
2823
2824                         // AssemblyVersion
2825                         attrType = typeof (AssemblyVersionAttribute);
2826                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2827                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
2828                         ab.SetCustomAttribute (cab);
2829
2830                         // AssemblyFileVersion
2831                         attrType = typeof (AssemblyFileVersionAttribute);
2832                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2833                         cab = new CustomAttributeBuilder (ci, new object [1] { "1.b.3.c" });
2834                         ab.SetCustomAttribute (cab);
2835
2836                         // AssemblyInformationalVersion
2837                         attrType = typeof (AssemblyInformationalVersionAttribute);
2838                         ci = attrType.GetConstructor (new Type [] { typeof (String) });
2839                         cab = new CustomAttributeBuilder (ci, new object [1] { "b.3.6.c" });
2840                         ab.SetCustomAttribute (cab);
2841
2842                         ab.DefineVersionInfoResource ();
2843                         ab.Save ("lib2l.dll");
2844
2845                         string assemblyFile = Path.Combine (tempDir, "lib2l.dll");
2846
2847                         FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
2848                         Assert.AreEqual ("System Test", fvi.Comments, "#1");
2849                         Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
2850                         Assert.AreEqual (0, fvi.FileBuildPart, "#3");
2851                         Assert.AreEqual (" ", fvi.FileDescription, "#4");
2852                         Assert.AreEqual (1, fvi.FileMajorPart, "#5");
2853                         Assert.AreEqual (0, fvi.FileMinorPart, "#6");
2854                         Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
2855                         Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
2856                         Assert.AreEqual ("1.b.3.c", fvi.FileVersion, "#9");
2857                         Assert.AreEqual ("lib2l", fvi.InternalName, "#10");
2858                         Assert.IsFalse (fvi.IsDebug, "#11");
2859                         Assert.IsFalse (fvi.IsPatched, "#12");
2860                         Assert.IsFalse (fvi.IsPreRelease, "#13");
2861                         Assert.IsFalse (fvi.IsPrivateBuild, "#14");
2862                         Assert.IsFalse (fvi.IsSpecialBuild, "#15");
2863                         //Assert.AreEqual ("Dutch (Belgium)", fvi.Language, "#16");
2864                         Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
2865                         Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
2866                         Assert.AreEqual ("lib2l.dll", fvi.OriginalFilename, "#19");
2867                         Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
2868                         Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
2869                         Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
2870                         Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
2871                         Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
2872                         Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
2873                         Assert.AreEqual ("b.3.6.c", fvi.ProductVersion, "#26");
2874                         Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
2875                 }
2876
2877                 private static byte [] version_res1 = {
2878                         0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
2879                         0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2880                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc,
2881                         0x03, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x00,
2882                         0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2883                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x03,
2884                         0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5f, 0x00, 0x56,
2885                         0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4f, 0x00,
2886                         0x4e, 0x00, 0x5f, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x46, 0x00, 0x4f,
2887                         0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x04, 0xef, 0xfe, 0x00, 0x00,
2888                         0x01, 0x00, 0x09, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x00, 0x08,
2889                         0x00, 0x09, 0x00, 0x06, 0x00, 0x07, 0x00, 0x3f, 0x00, 0x00, 0x00,
2890                         0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
2891                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2892                         0x00, 0x00, 0x1c, 0x03, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x74,
2893                         0x00, 0x72, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x46, 0x00,
2894                         0x69, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x66,
2895                         0x00, 0x6f, 0x00, 0x00, 0x00, 0xf8, 0x02, 0x00, 0x00, 0x01, 0x00,
2896                         0x30, 0x00, 0x30, 0x00, 0x37, 0x00, 0x66, 0x00, 0x30, 0x00, 0x34,
2897                         0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x0a, 0x00,
2898                         0x01, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x6d, 0x00, 0x65,
2899                         0x00, 0x6e, 0x00, 0x74, 0x00, 0x73, 0x00, 0x00, 0x00, 0x4e, 0x00,
2900                         0x20, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x6d, 0x00, 0x65,
2901                         0x00, 0x6e, 0x00, 0x74, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0c, 0x00,
2902                         0x01, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x61,
2903                         0x00, 0x6e, 0x00, 0x79, 0x00, 0x4e, 0x00, 0x61, 0x00, 0x6d, 0x00,
2904                         0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x4d,
2905                         0x00, 0x6f, 0x00, 0x6e, 0x00, 0x6f, 0x00, 0x20, 0x00, 0x54, 0x00,
2906                         0x65, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x13,
2907                         0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00, 0x65, 0x00,
2908                         0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69,
2909                         0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00,
2910                         0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x46, 0x00, 0x69,
2911                         0x00, 0x6c, 0x00, 0x65, 0x00, 0x20, 0x00, 0x44, 0x00, 0x65, 0x00,
2912                         0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69, 0x00, 0x70, 0x00, 0x74,
2913                         0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00,
2914                         0x34, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c,
2915                         0x00, 0x65, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00,
2916                         0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e,
2917                         0x00, 0x20, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x2e, 0x00,
2918                         0x33, 0x00, 0x2e, 0x00, 0x34, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x07,
2919                         0x00, 0x01, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x65, 0x00,
2920                         0x72, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x4e, 0x00, 0x61,
2921                         0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00,
2922                         0x6c, 0x00, 0x69, 0x00, 0x62, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00,
2923                         0x00, 0x60, 0x00, 0x1e, 0x00, 0x01, 0x00, 0x4c, 0x00, 0x65, 0x00,
2924                         0x67, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x70,
2925                         0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00,
2926                         0x74, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6f,
2927                         0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00,
2928                         0x68, 0x00, 0x74, 0x00, 0x20, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30,
2929                         0x00, 0x37, 0x00, 0x20, 0x00, 0x4d, 0x00, 0x6f, 0x00, 0x6e, 0x00,
2930                         0x6f, 0x00, 0x20, 0x00, 0x48, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b,
2931                         0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x00, 0x00, 0x50, 0x00,
2932                         0x14, 0x00, 0x01, 0x00, 0x4c, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61,
2933                         0x00, 0x6c, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x64, 0x00,
2934                         0x65, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6b, 0x00, 0x73,
2935                         0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x52, 0x00,
2936                         0x65, 0x00, 0x67, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65,
2937                         0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x20, 0x00, 0x74, 0x00,
2938                         0x6f, 0x00, 0x20, 0x00, 0x41, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x00,
2939                         0x00, 0x3e, 0x00, 0x0b, 0x00, 0x01, 0x00, 0x4f, 0x00, 0x72, 0x00,
2940                         0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6c,
2941                         0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x6e, 0x00,
2942                         0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20,
2943                         0x00, 0x6c, 0x00, 0x69, 0x00, 0x62, 0x00, 0x33, 0x00, 0x2e, 0x00,
2944                         0x64, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e,
2945                         0x00, 0x07, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x69, 0x00,
2946                         0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x42, 0x00, 0x75,
2947                         0x00, 0x69, 0x00, 0x6c, 0x00, 0x64, 0x00, 0x00, 0x00, 0x4e, 0x00,
2948                         0x20, 0x00, 0x50, 0x00, 0x52, 0x00, 0x49, 0x00, 0x56, 0x00, 0x00,
2949                         0x00, 0x00, 0x00, 0x3e, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x50, 0x00,
2950                         0x72, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74,
2951                         0x00, 0x4e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00,
2952                         0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x4d, 0x00, 0x6f, 0x00, 0x6e,
2953                         0x00, 0x6f, 0x00, 0x20, 0x00, 0x52, 0x00, 0x75, 0x00, 0x6e, 0x00,
2954                         0x74, 0x00, 0x69, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00,
2955                         0x00, 0x38, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00,
2956                         0x6f, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x56,
2957                         0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00,
2958                         0x6e, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x34, 0x00, 0x2c,
2959                         0x00, 0x32, 0x00, 0x2c, 0x00, 0x31, 0x00, 0x2c, 0x00, 0x37, 0x00,
2960                         0x00, 0x00, 0x2e, 0x00, 0x07, 0x00, 0x01, 0x00, 0x53, 0x00, 0x70,
2961                         0x00, 0x65, 0x00, 0x63, 0x00, 0x69, 0x00, 0x61, 0x00, 0x6c, 0x00,
2962                         0x42, 0x00, 0x75, 0x00, 0x69, 0x00, 0x6c, 0x00, 0x64, 0x00, 0x00,
2963                         0x00, 0x4e, 0x00, 0x20, 0x00, 0x53, 0x00, 0x50, 0x00, 0x45, 0x00,
2964                         0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01,
2965                         0x00, 0x56, 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00,
2966                         0x6c, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x66, 0x00, 0x6f,
2967                         0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00,
2968                         0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x73, 0x00, 0x6c,
2969                         0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00,
2970                         0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0xb0, 0x04 };
2971
2972                 private static byte [] version_res2 = {
2973                         0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
2974                         0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2975                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec,
2976                         0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x00,
2977                         0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2978                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x01,
2979                         0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5f, 0x00, 0x56,
2980                         0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4f, 0x00,
2981                         0x4e, 0x00, 0x5f, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x46, 0x00, 0x4f,
2982                         0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x04, 0xef, 0xfe, 0x00, 0x00,
2983                         0x01, 0x00, 0x09, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x00, 0x08,
2984                         0x00, 0x09, 0x00, 0x06, 0x00, 0x07, 0x00, 0x17, 0x00, 0x00, 0x00,
2985                         0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
2986                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2987                         0x00, 0x00, 0x4c, 0x01, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x74,
2988                         0x00, 0x72, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x46, 0x00,
2989                         0x69, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x66,
2990                         0x00, 0x6f, 0x00, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, 0x01, 0x00,
2991                         0x30, 0x00, 0x30, 0x00, 0x37, 0x00, 0x66, 0x00, 0x30, 0x00, 0x34,
2992                         0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00,
2993                         0x01, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x61,
2994                         0x00, 0x6e, 0x00, 0x79, 0x00, 0x4e, 0x00, 0x61, 0x00, 0x6d, 0x00,
2995                         0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a,
2996                         0x00, 0x01, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00,
2997                         0x65, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72,
2998                         0x00, 0x69, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00,
2999                         0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
3000                         0x00, 0x01, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00,
3001                         0x65, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69,
3002                         0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3003                         0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 0x01, 0x00, 0x49, 0x00, 0x6e,
3004                         0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6e, 0x00, 0x61, 0x00,
3005                         0x6c, 0x00, 0x4e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00,
3006                         0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x01, 0x00, 0x01, 0x00,
3007                         0x4f, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6e,
3008                         0x00, 0x61, 0x00, 0x6c, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00,
3009                         0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00,
3010                         0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 0x01, 0x00,
3011                         0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63,
3012                         0x00, 0x74, 0x00, 0x4e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00,
3013                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x01,
3014                         0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x64, 0x00,
3015                         0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72,
3016                         0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00,
3017                         0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x56,
3018                         0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00,
3019                         0x65, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x66, 0x00, 0x6f, 0x00, 0x00,
3020                         0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00, 0x54, 0x00,
3021                         0x72, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x73, 0x00, 0x6c, 0x00, 0x61,
3022                         0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00,
3023                         0x00, 0x00, 0x7f, 0x00, 0xb0, 0x04 };
3024
3025                 private static byte [] version_res3 = {
3026                         0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
3027                         0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3028                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c,
3029                         0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x00,
3030                         0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3031                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00,
3032                         0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5f, 0x00, 0x56,
3033                         0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4f, 0x00,
3034                         0x4e, 0x00, 0x5f, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x46, 0x00, 0x4f,
3035                         0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x04, 0xef, 0xfe, 0x00, 0x00,
3036                         0x01, 0x00, 0x09, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x00, 0x08,
3037                         0x00, 0x09, 0x00, 0x06, 0x00, 0x07, 0x00, 0x17, 0x00, 0x00, 0x00,
3038                         0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
3039                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3040                         0x00, 0x00 };
3041
3042                 private static byte [] version_res4 = {
3043                         0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
3044                         0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3045                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
3046                 };
3047 #endif
3048         }
3049 }