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