FileVersionInfoTest.cs 129 KB

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