| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049 |
- //
- // FileVersionInfoTest.cs - NUnit Test Cases for System.Diagnostics.FileVersionInfo
- //
- // Authors:
- // Gert Driesen <[email protected]>
- //
- // (c) 2008 Gert Driesen
- //
- using System;
- using System.IO;
- using System.Diagnostics;
- using System.Globalization;
- using System.Reflection;
- #if !MONOTOUCH
- using System.Reflection.Emit;
- #endif
- using System.Text;
- using NUnit.Framework;
- namespace MonoTests.System.Diagnostics
- {
- [TestFixture]
- public class FileVersionInfoTest
- {
- private string tempDir;
- [SetUp]
- public void SetUp ()
- {
- tempDir = Path.Combine (Path.GetTempPath (), Environment.UserName);
- tempDir = Path.Combine (tempDir, "MonoTests.System.Diagnostics.AppDomainTest");
- if (!Directory.Exists (tempDir))
- Directory.CreateDirectory (tempDir);
- }
- [TearDown]
- public void TearDown ()
- {
- Directory.Delete (tempDir, true);
- }
- [Test]
- public void GetVersionInfo_FileName_DoesNotExist ()
- {
- try {
- FileVersionInfo.GetVersionInfo ("shouldnoteverexist.tmp");
- Assert.Fail ("#1");
- } catch (FileNotFoundException ex) {
- Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
- Assert.IsNull (ex.FileName, "#3");
- Assert.IsNull (ex.InnerException, "#4");
- Assert.AreEqual ("shouldnoteverexist.tmp", ex.Message, "#5");
- }
- }
- [Test]
- public void GetVersionInfo_FileName_Null ()
- {
- try {
- FileVersionInfo.GetVersionInfo ((string) null);
- Assert.Fail ("#1");
- } catch (ArgumentNullException ex) {
- Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
- Assert.IsNull (ex.InnerException, "#3");
- Assert.IsNotNull (ex.Message, "#4");
- Assert.AreEqual ("path", ex.ParamName, "#5");
- }
- }
- [Test]
- public void GetVersionInfo_TextFile ()
- {
- string file = Path.Combine (tempDir, "lib.dll");
- using (StreamWriter sw = new StreamWriter (file, false, Encoding.UTF8)) {
- sw.WriteLine ("WHATEVER");
- }
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (file);
- Assert.IsNull (fvi.Comments, "#1");
- Assert.IsNull (fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.IsNull (fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (file, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.IsNull (fvi.FileVersion, "#9");
- Assert.IsNull (fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.IsNull (fvi.Language, "#16");
- Assert.IsNull (fvi.LegalCopyright, "#17");
- Assert.IsNull (fvi.LegalTrademarks, "#18");
- Assert.IsNull (fvi.OriginalFilename, "#19");
- Assert.IsNull (fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.IsNull (fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.IsNull (fvi.ProductVersion, "#26");
- Assert.IsNull (fvi.SpecialBuild, "#27");
- }
- #if !MONOTOUCH
- [Test]
- public void GetVersionInfo_NoNativeResources ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.Save ("lib.dll");
- string assemblyFile = Path.Combine (tempDir, "lib.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.IsNull (fvi.Comments, "#1");
- Assert.IsNull (fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.IsNull (fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.IsNull (fvi.FileVersion, "#9");
- Assert.IsNull (fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.IsNull (fvi.Language, "#16");
- Assert.IsNull (fvi.LegalCopyright, "#17");
- Assert.IsNull (fvi.LegalTrademarks, "#18");
- Assert.IsNull (fvi.OriginalFilename, "#19");
- Assert.IsNull (fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.IsNull (fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.IsNull (fvi.ProductVersion, "#26");
- Assert.IsNull (fvi.SpecialBuild, "#27");
- }
- [Test] // DefineUnmanagedResource (String)
- public void DefineUnmanagedResource1a ()
- {
- string resFile = Path.Combine (tempDir, "version.res");
- using (FileStream fs = File.OpenWrite (resFile)) {
- fs.Write (version_res1, 0, version_res1.Length);
- }
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib3a";
- aname.Version = new Version (8, 5, 4, 2);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave, tempDir);
- ab.DefineUnmanagedResource (resFile);
- ab.Save ("lib3a.dll");
- string assemblyFile = Path.Combine (tempDir, "lib3a.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("N Comment", fvi.Comments, "#1");
- Assert.AreEqual ("N Mono Team", fvi.CompanyName, "#2");
- Assert.AreEqual (1, fvi.FileBuildPart, "#3");
- Assert.AreEqual ("N File Description", fvi.FileDescription, "#4");
- Assert.AreEqual (6, fvi.FileMajorPart, "#5");
- Assert.AreEqual (9, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("N 1.2.3.4", fvi.FileVersion, "#9");
- Assert.AreEqual ("N lib3", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsTrue (fvi.IsPrivateBuild, "#14");
- Assert.IsTrue (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual ("N Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("N Registered to All", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("N lib3.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual ("N PRIV", fvi.PrivateBuild, "#20");
- Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("N Mono Runtime", fvi.ProductName, "#24");
- Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("N 4,2,1,7", fvi.ProductVersion, "#26");
- Assert.AreEqual ("N SPEC", fvi.SpecialBuild, "#27");
- }
- [Test] // DefineUnmanagedResource (String)
- public void DefineUnmanagedResource1b ()
- {
- string resFile = Path.Combine (tempDir, "version.res");
- using (FileStream fs = File.OpenWrite (resFile)) {
- fs.Write (version_res1, 0, version_res1.Length);
- }
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib3b";
- aname.Version = new Version (9, 0, 3, 0);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineUnmanagedResource (resFile);
- ab.Save ("lib3b.dll");
- string assemblyFile = Path.Combine (tempDir, "lib3b.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("N Comment", fvi.Comments, "#1");
- Assert.AreEqual ("N Mono Team", fvi.CompanyName, "#2");
- Assert.AreEqual (1, fvi.FileBuildPart, "#3");
- Assert.AreEqual ("N File Description", fvi.FileDescription, "#4");
- Assert.AreEqual (6, fvi.FileMajorPart, "#5");
- Assert.AreEqual (9, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("N 1.2.3.4", fvi.FileVersion, "#9");
- Assert.AreEqual ("N lib3", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsTrue (fvi.IsPrivateBuild, "#14");
- Assert.IsTrue (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual ("N Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("N Registered to All", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("N lib3.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual ("N PRIV", fvi.PrivateBuild, "#20");
- Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("N Mono Runtime", fvi.ProductName, "#24");
- Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("N 4,2,1,7", fvi.ProductVersion, "#26");
- Assert.AreEqual ("N SPEC", fvi.SpecialBuild, "#27");
- }
- [Test] // DefineUnmanagedResource (String)
- public void DefineUnmanagedResource1c ()
- {
- string resFile = Path.Combine (tempDir, "version.res");
- using (FileStream fs = File.OpenWrite (resFile)) {
- fs.Write (version_res2, 0, version_res2.Length);
- }
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib3c";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave, tempDir);
- ab.DefineUnmanagedResource (resFile);
- ab.Save ("lib3c.dll");
- string assemblyFile = Path.Combine (tempDir, "lib3c.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (string.Empty, fvi.Comments, "#1");
- Assert.AreEqual (string.Empty, fvi.CompanyName, "#2");
- Assert.AreEqual (1, fvi.FileBuildPart, "#3");
- Assert.AreEqual (string.Empty, fvi.FileDescription, "#4");
- Assert.AreEqual (6, fvi.FileMajorPart, "#5");
- Assert.AreEqual (9, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
- Assert.AreEqual (string.Empty, fvi.FileVersion, "#9");
- Assert.AreEqual (string.Empty, fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual (string.Empty, fvi.LegalCopyright, "#17");
- Assert.AreEqual (string.Empty, fvi.LegalTrademarks, "#18");
- Assert.AreEqual (string.Empty, fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (string.Empty, fvi.ProductName, "#24");
- Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (string.Empty, fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineUnmanagedResource (String)
- public void DefineUnmanagedResource1d ()
- {
- string resFile = Path.Combine (tempDir, "version.res");
- using (FileStream fs = File.OpenWrite (resFile)) {
- fs.Write (version_res2, 0, version_res2.Length);
- }
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib3d";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave, tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineUnmanagedResource (resFile);
- ab.Save ("lib3d.dll");
- string assemblyFile = Path.Combine (tempDir, "lib3d.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (string.Empty, fvi.Comments, "#1");
- Assert.AreEqual (string.Empty, fvi.CompanyName, "#2");
- Assert.AreEqual (1, fvi.FileBuildPart, "#3");
- Assert.AreEqual (string.Empty, fvi.FileDescription, "#4");
- Assert.AreEqual (6, fvi.FileMajorPart, "#5");
- Assert.AreEqual (9, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
- Assert.AreEqual (string.Empty, fvi.FileVersion, "#9");
- Assert.AreEqual (string.Empty, fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual (string.Empty, fvi.LegalCopyright, "#17");
- Assert.AreEqual (string.Empty, fvi.LegalTrademarks, "#18");
- Assert.AreEqual (string.Empty, fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (string.Empty, fvi.ProductName, "#24");
- Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (string.Empty, fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineUnmanagedResource (String)
- public void DefineUnmanagedResource1e ()
- {
- string resFile = Path.Combine (tempDir, "version.res");
- using (FileStream fs = File.OpenWrite (resFile)) {
- fs.Write (version_res3, 0, version_res3.Length);
- }
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib3e";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave, tempDir);
- ab.DefineUnmanagedResource (resFile);
- ab.Save ("lib3e.dll");
- string assemblyFile = Path.Combine (tempDir, "lib3e.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (string.Empty, fvi.Comments, "#1");
- Assert.AreEqual (string.Empty, fvi.CompanyName, "#2");
- Assert.AreEqual (1, fvi.FileBuildPart, "#3");
- Assert.AreEqual (string.Empty, fvi.FileDescription, "#4");
- Assert.AreEqual (6, fvi.FileMajorPart, "#5");
- Assert.AreEqual (9, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
- Assert.AreEqual (string.Empty, fvi.FileVersion, "#9");
- Assert.AreEqual (string.Empty, fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United States)", fvi.Language, "#16");
- Assert.AreEqual (string.Empty, fvi.LegalCopyright, "#17");
- Assert.AreEqual (string.Empty, fvi.LegalTrademarks, "#18");
- Assert.AreEqual (string.Empty, fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (string.Empty, fvi.ProductName, "#24");
- Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (string.Empty, fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineUnmanagedResource (String)
- public void DefineUnmanagedResource1f ()
- {
- string resFile = Path.Combine (tempDir, "version.res");
- using (FileStream fs = File.OpenWrite (resFile)) {
- fs.Write (version_res3, 0, version_res3.Length);
- }
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib3f";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave, tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineUnmanagedResource (resFile);
- ab.Save ("lib3f.dll");
- string assemblyFile = Path.Combine (tempDir, "lib3f.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (string.Empty, fvi.Comments, "#1");
- Assert.AreEqual (string.Empty, fvi.CompanyName, "#2");
- Assert.AreEqual (1, fvi.FileBuildPart, "#3");
- Assert.AreEqual (string.Empty, fvi.FileDescription, "#4");
- Assert.AreEqual (6, fvi.FileMajorPart, "#5");
- Assert.AreEqual (9, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (3, fvi.FilePrivatePart, "#8");
- Assert.AreEqual (string.Empty, fvi.FileVersion, "#9");
- Assert.AreEqual (string.Empty, fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United States)", fvi.Language, "#16");
- Assert.AreEqual (string.Empty, fvi.LegalCopyright, "#17");
- Assert.AreEqual (string.Empty, fvi.LegalTrademarks, "#18");
- Assert.AreEqual (string.Empty, fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (9, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (8, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (string.Empty, fvi.ProductName, "#24");
- Assert.AreEqual (6, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (string.Empty, fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineUnmanagedResource (String)
- public void DefineUnmanagedResource1g ()
- {
- string resFile = Path.Combine (tempDir, "version.res");
- using (FileStream fs = File.OpenWrite (resFile)) {
- fs.Write (version_res4, 0, version_res4.Length);
- }
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib3g";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave, tempDir);
- ab.DefineUnmanagedResource (resFile);
- ab.Save ("lib3g.dll");
- string assemblyFile = Path.Combine (tempDir, "lib3g.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.IsNull (fvi.Comments, "#1");
- Assert.IsNull (fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.IsNull (fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.IsNull (fvi.FileVersion, "#9");
- Assert.IsNull (fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.IsNull (fvi.Language, "#16");
- Assert.IsNull (fvi.LegalCopyright, "#17");
- Assert.IsNull (fvi.LegalTrademarks, "#18");
- Assert.IsNull (fvi.OriginalFilename, "#19");
- Assert.IsNull (fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.IsNull (fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.IsNull (fvi.ProductVersion, "#26");
- Assert.IsNull (fvi.SpecialBuild, "#27");
- }
- [Test] // DefineUnmanagedResource (String)
- public void DefineUnmanagedResource1h ()
- {
- string resFile = Path.Combine (tempDir, "version.res");
- using (FileStream fs = File.OpenWrite (resFile)) {
- fs.Write (version_res4, 0, version_res4.Length);
- }
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib3h";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave, tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineUnmanagedResource (resFile);
- ab.Save ("lib3h.dll");
- string assemblyFile = Path.Combine (tempDir, "lib3h.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.IsNull (fvi.Comments, "#1");
- Assert.IsNull (fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.IsNull (fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.IsNull (fvi.FileVersion, "#9");
- Assert.IsNull (fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.IsNull (fvi.Language, "#16");
- Assert.IsNull (fvi.LegalCopyright, "#17");
- Assert.IsNull (fvi.LegalTrademarks, "#18");
- Assert.IsNull (fvi.OriginalFilename, "#19");
- Assert.IsNull (fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.IsNull (fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.IsNull (fvi.ProductVersion, "#26");
- Assert.IsNull (fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1a ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib1a";
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- ab.DefineVersionInfoResource ("BBB", "1.3.2.4", "CCC", "DDD", "EEE");
- ab.Save ("lib1a.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1a.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual ("CCC", fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1a", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual ("DDD", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("EEE", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1a.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (2, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (1, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (3, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("BBB", fvi.ProductName, "#24");
- Assert.AreEqual (4, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("1.3.2.4", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1b ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib1b";
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- ab.DefineVersionInfoResource (null, null, null, null, null);
- ab.Save ("lib1b.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1b.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1b", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1b.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1c ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib1c";
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ("AAA", "3.9.2", "BBB", "CCC", "DDD");
- ab.Save ("lib1c.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1c.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual ("BBB", fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1c", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual ("CCC", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("DDD", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1c.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (2, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (3, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (9, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("AAA", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("3.9.2", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1d ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib1d";
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource (null, null, null, null, null);
- ab.Save ("lib1d.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1d.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1d", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1d.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1e ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib1e";
- aname.Version = new Version (5, 4, 7, 8);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- ab.DefineVersionInfoResource ("BBB", "1.3.2.4", "CCC", "DDD", "EEE");
- ab.Save ("lib1e.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1e.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual ("CCC", fvi.CompanyName, "#2");
- Assert.AreEqual (7, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (5, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("5.4.7.8", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1e", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("Dutch (Belgium)", fvi.Language, "#16");
- Assert.AreEqual ("DDD", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("EEE", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1e.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (2, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (1, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (3, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("BBB", fvi.ProductName, "#24");
- Assert.AreEqual (4, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("1.3.2.4", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1f ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl");
- aname.Name = "lib1f";
- aname.Version = new Version (5, 4, 7, 8);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- ab.DefineVersionInfoResource (null, null, null, null, null);
- ab.Save ("lib1f.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1f.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (7, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (5, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("5.4.7.8", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1f", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("Dutch (Netherlands)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1f.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1g ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib1g";
- aname.Version = new Version (5, 4, 7);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ("AAA", "3.9.2", "BBB", "CCC", "DDD");
- ab.Save ("lib1g.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1g.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual ("BBB", fvi.CompanyName, "#2");
- Assert.AreEqual (7, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (5, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("5.4.7.0", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1g", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual ("CCC", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("DDD", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1g.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (2, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (3, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (9, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("AAA", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("3.9.2", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1h ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib1h";
- aname.Version = new Version (5, 4);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource (null, null, null, null, null);
- ab.Save ("lib1h.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1h.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (5, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("5.4.0.0", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1h", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1h.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1i ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib1i";
- aname.Version = new Version (5, 4, 8, 2);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ("AAA", string.Empty,
- "BBB", "CCC", "DDD");
- ab.Save ("lib1i.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1i.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual ("BBB", fvi.CompanyName, "#2");
- Assert.AreEqual (8, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (5, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (2, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("5.4.8.2", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1i", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual ("CCC", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("DDD", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1i.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("AAA", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1j ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib1j";
- aname.Version = new Version (5, 4, 8, 2);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource (string.Empty, string.Empty,
- string.Empty, string.Empty, string.Empty);
- ab.Save ("lib1j.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1j.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (8, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (5, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (2, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("5.4.8.2", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1j", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1j.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1k ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl");
- aname.Name = "lib1k";
- aname.Version = new Version (5, 4, 7, 8);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // AssemblyCulture
- Type attrType = typeof (AssemblyCultureAttribute);
- ConstructorInfo ci = attrType.GetConstructor (new Type [] { typeof (String) });
- CustomAttributeBuilder cab = new CustomAttributeBuilder (
- ci, new object [1] { string.Empty });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource (null, null, null, null, null);
- ab.Save ("lib1k.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1k.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (7, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (5, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("5.4.7.8", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1k", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1k.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1l ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib1l";
- aname.Version = new Version (5, 4, 7, 8);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- ab.DefineVersionInfoResource ("AAA", "3.9.2", "BBB", "CCC", "DDD");
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.Save ("lib1l.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1l.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual ("BBB", fvi.CompanyName, "#2");
- Assert.AreEqual (7, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (5, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("5.4.7.8", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1l", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual ("CCC", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("DDD", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1l.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (2, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (3, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (9, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("AAA", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("3.9.2", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource (String, String, String, String, String)
- public void DefineVersionInfoResource1m ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib1m";
- aname.Version = new Version (5, 4, 7, 8);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- ab.DefineVersionInfoResource (string.Empty, string.Empty,
- string.Empty, string.Empty, string.Empty);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.Save ("lib1m.dll");
- string assemblyFile = Path.Combine (tempDir, "lib1m.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (7, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (5, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("5.4.7.8", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib1m", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib1m.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2a ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib2a";
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2a.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2a.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2a", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2a.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2b ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib2b";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6.8" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7.1" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2b.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2b.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
- Assert.AreEqual (6, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (2, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (8, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("2.4.6.8", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2b", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2b.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (6, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (4, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
- Assert.AreEqual (1, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("6.4.7.1", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2c ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib2c";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // AssemblyVersion
- Type attrType = typeof (AssemblyVersionAttribute);
- ConstructorInfo ci = attrType.GetConstructor (new Type [] { typeof (String) });
- CustomAttributeBuilder cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2c.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2c.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (7, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (3, fvi.FileMajorPart, "#5");
- Assert.AreEqual (5, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (9, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("3.5.7.9", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2c", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2c.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2d ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib2d";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // AssemblyVersion
- Type attrType = typeof (AssemblyVersionAttribute);
- ConstructorInfo ci = attrType.GetConstructor (new Type [] { typeof (String) });
- CustomAttributeBuilder cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2d.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2d.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (6, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (2, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("2.4.6", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2d", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2d.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2e ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.Name = "lib2e";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // AssemblyVersion
- Type attrType = typeof (AssemblyVersionAttribute);
- ConstructorInfo ci = attrType.GetConstructor (new Type [] { typeof (String) });
- CustomAttributeBuilder cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "0.0.0.0" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2e.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2e.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("0.0.0.0", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2e", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2e.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2f ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib2f";
- aname.Version = new Version (3, 5, 7);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2f.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2f.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (7, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (3, fvi.FileMajorPart, "#5");
- Assert.AreEqual (5, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("3.5.7.0", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2f", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("Dutch (Belgium)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2f.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2g ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib2g";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2b.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2b.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
- Assert.AreEqual (6, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (2, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("2.4.6", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2b", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2b.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (6, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (4, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("6.4.7", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2h ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib2h";
- aname.Version = new Version (3, 5, 7);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2h.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2h.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
- Assert.AreEqual (6, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (2, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("2.4.6", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2h", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("Dutch (Belgium)", fvi.Language, "#16");
- Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2h.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (6, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (4, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("6.4.7", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2i ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib2i";
- aname.Version = new Version (3, 5, 7);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { string.Empty });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { string.Empty });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2i.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2i.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual (" ", fvi.Comments, "#1");
- Assert.AreEqual (" ", fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual (" ", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2i", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- Assert.AreEqual ("Invariant Language (Invariant Country)", fvi.Language, "#16");
- Assert.AreEqual (" ", fvi.LegalCopyright, "#17");
- Assert.AreEqual (" ", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2i.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual (" ", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual (" ", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2j ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib2j";
- aname.Version = new Version (3, 5, 7, 9);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- ab.DefineVersionInfoResource ();
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "2.4.6" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "6.4.7" });
- ab.SetCustomAttribute (cab);
- // AssemblyCulture
- attrType = typeof (AssemblyCultureAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "en-GB" });
- ab.SetCustomAttribute (cab);
- ab.Save ("lib2j.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2j.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
- Assert.AreEqual (6, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (2, fvi.FileMajorPart, "#5");
- Assert.AreEqual (4, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("2.4.6", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2j", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("English (United Kingdom)", fvi.Language, "#16");
- Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2j.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (7, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (6, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (4, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("6.4.7", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2k ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib2k";
- aname.Version = new Version (3, 5, 7);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "abc" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "def" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2k.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2k.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (0, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("abc", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2k", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("Dutch (Belgium)", fvi.Language, "#16");
- Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2k.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("def", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- [Test] // DefineVersionInfoResource ()
- public void DefineVersionInfoResource2l ()
- {
- AssemblyName aname = new AssemblyName ();
- aname.CultureInfo = new CultureInfo ("nl-BE");
- aname.Name = "lib2l";
- aname.Version = new Version (3, 5, 7);
- AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (
- aname, AssemblyBuilderAccess.RunAndSave,
- tempDir);
- // CompanyName
- Type attrType = typeof (AssemblyCompanyAttribute);
- ConstructorInfo ci = attrType.GetConstructor (
- new Type [] { typeof (String) });
- CustomAttributeBuilder cab =
- new CustomAttributeBuilder (ci, new object [1] { "Mono Team" });
- ab.SetCustomAttribute (cab);
- // Comments
- attrType = typeof (AssemblyDescriptionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "System Test" });
- ab.SetCustomAttribute (cab);
- // ProductName
- attrType = typeof (AssemblyProductAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Mono Runtime" });
- ab.SetCustomAttribute (cab);
- // LegalCopyright
- attrType = typeof (AssemblyCopyrightAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Copyright 2007 Mono Hackers" });
- ab.SetCustomAttribute (cab);
- // LegalTrademarks
- attrType = typeof (AssemblyTrademarkAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "Registered to All" });
- ab.SetCustomAttribute (cab);
- // AssemblyVersion
- attrType = typeof (AssemblyVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.2.3.4" });
- ab.SetCustomAttribute (cab);
- // AssemblyFileVersion
- attrType = typeof (AssemblyFileVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "1.b.3.c" });
- ab.SetCustomAttribute (cab);
- // AssemblyInformationalVersion
- attrType = typeof (AssemblyInformationalVersionAttribute);
- ci = attrType.GetConstructor (new Type [] { typeof (String) });
- cab = new CustomAttributeBuilder (ci, new object [1] { "b.3.6.c" });
- ab.SetCustomAttribute (cab);
- ab.DefineVersionInfoResource ();
- ab.Save ("lib2l.dll");
- string assemblyFile = Path.Combine (tempDir, "lib2l.dll");
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo (assemblyFile);
- Assert.AreEqual ("System Test", fvi.Comments, "#1");
- Assert.AreEqual ("Mono Team", fvi.CompanyName, "#2");
- Assert.AreEqual (0, fvi.FileBuildPart, "#3");
- Assert.AreEqual (" ", fvi.FileDescription, "#4");
- Assert.AreEqual (1, fvi.FileMajorPart, "#5");
- Assert.AreEqual (0, fvi.FileMinorPart, "#6");
- Assert.AreEqual (assemblyFile, fvi.FileName, "#7");
- Assert.AreEqual (0, fvi.FilePrivatePart, "#8");
- Assert.AreEqual ("1.b.3.c", fvi.FileVersion, "#9");
- Assert.AreEqual ("lib2l", fvi.InternalName, "#10");
- Assert.IsFalse (fvi.IsDebug, "#11");
- Assert.IsFalse (fvi.IsPatched, "#12");
- Assert.IsFalse (fvi.IsPreRelease, "#13");
- Assert.IsFalse (fvi.IsPrivateBuild, "#14");
- Assert.IsFalse (fvi.IsSpecialBuild, "#15");
- //Assert.AreEqual ("Dutch (Belgium)", fvi.Language, "#16");
- Assert.AreEqual ("Copyright 2007 Mono Hackers", fvi.LegalCopyright, "#17");
- Assert.AreEqual ("Registered to All", fvi.LegalTrademarks, "#18");
- Assert.AreEqual ("lib2l.dll", fvi.OriginalFilename, "#19");
- Assert.AreEqual (string.Empty, fvi.PrivateBuild, "#20");
- Assert.AreEqual (0, fvi.ProductBuildPart, "#21");
- Assert.AreEqual (0, fvi.ProductMajorPart, "#22");
- Assert.AreEqual (0, fvi.ProductMinorPart, "#23");
- Assert.AreEqual ("Mono Runtime", fvi.ProductName, "#24");
- Assert.AreEqual (0, fvi.ProductPrivatePart, "#25");
- Assert.AreEqual ("b.3.6.c", fvi.ProductVersion, "#26");
- Assert.AreEqual (string.Empty, fvi.SpecialBuild, "#27");
- }
- private static byte [] version_res1 = {
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
- 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc,
- 0x03, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x00,
- 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x03,
- 0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5f, 0x00, 0x56,
- 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4f, 0x00,
- 0x4e, 0x00, 0x5f, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x46, 0x00, 0x4f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x04, 0xef, 0xfe, 0x00, 0x00,
- 0x01, 0x00, 0x09, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x00, 0x08,
- 0x00, 0x09, 0x00, 0x06, 0x00, 0x07, 0x00, 0x3f, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1c, 0x03, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x74,
- 0x00, 0x72, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x46, 0x00,
- 0x69, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x66,
- 0x00, 0x6f, 0x00, 0x00, 0x00, 0xf8, 0x02, 0x00, 0x00, 0x01, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x37, 0x00, 0x66, 0x00, 0x30, 0x00, 0x34,
- 0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x0a, 0x00,
- 0x01, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x6d, 0x00, 0x65,
- 0x00, 0x6e, 0x00, 0x74, 0x00, 0x73, 0x00, 0x00, 0x00, 0x4e, 0x00,
- 0x20, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x6d, 0x00, 0x65,
- 0x00, 0x6e, 0x00, 0x74, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0c, 0x00,
- 0x01, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x61,
- 0x00, 0x6e, 0x00, 0x79, 0x00, 0x4e, 0x00, 0x61, 0x00, 0x6d, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x4d,
- 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x6f, 0x00, 0x20, 0x00, 0x54, 0x00,
- 0x65, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x13,
- 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00, 0x65, 0x00,
- 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69,
- 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x46, 0x00, 0x69,
- 0x00, 0x6c, 0x00, 0x65, 0x00, 0x20, 0x00, 0x44, 0x00, 0x65, 0x00,
- 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69, 0x00, 0x70, 0x00, 0x74,
- 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x34, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c,
- 0x00, 0x65, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00,
- 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e,
- 0x00, 0x20, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x2e, 0x00,
- 0x33, 0x00, 0x2e, 0x00, 0x34, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x07,
- 0x00, 0x01, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x65, 0x00,
- 0x72, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x4e, 0x00, 0x61,
- 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00,
- 0x6c, 0x00, 0x69, 0x00, 0x62, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x00, 0x1e, 0x00, 0x01, 0x00, 0x4c, 0x00, 0x65, 0x00,
- 0x67, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x70,
- 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00,
- 0x74, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x43, 0x00, 0x6f,
- 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00,
- 0x68, 0x00, 0x74, 0x00, 0x20, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30,
- 0x00, 0x37, 0x00, 0x20, 0x00, 0x4d, 0x00, 0x6f, 0x00, 0x6e, 0x00,
- 0x6f, 0x00, 0x20, 0x00, 0x48, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b,
- 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x00, 0x00, 0x50, 0x00,
- 0x14, 0x00, 0x01, 0x00, 0x4c, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61,
- 0x00, 0x6c, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x64, 0x00,
- 0x65, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x72, 0x00, 0x6b, 0x00, 0x73,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x52, 0x00,
- 0x65, 0x00, 0x67, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65,
- 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x20, 0x00, 0x74, 0x00,
- 0x6f, 0x00, 0x20, 0x00, 0x41, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x00,
- 0x00, 0x3e, 0x00, 0x0b, 0x00, 0x01, 0x00, 0x4f, 0x00, 0x72, 0x00,
- 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6c,
- 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x6e, 0x00,
- 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20,
- 0x00, 0x6c, 0x00, 0x69, 0x00, 0x62, 0x00, 0x33, 0x00, 0x2e, 0x00,
- 0x64, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e,
- 0x00, 0x07, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x69, 0x00,
- 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x42, 0x00, 0x75,
- 0x00, 0x69, 0x00, 0x6c, 0x00, 0x64, 0x00, 0x00, 0x00, 0x4e, 0x00,
- 0x20, 0x00, 0x50, 0x00, 0x52, 0x00, 0x49, 0x00, 0x56, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x3e, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x50, 0x00,
- 0x72, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74,
- 0x00, 0x4e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x4d, 0x00, 0x6f, 0x00, 0x6e,
- 0x00, 0x6f, 0x00, 0x20, 0x00, 0x52, 0x00, 0x75, 0x00, 0x6e, 0x00,
- 0x74, 0x00, 0x69, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x38, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00,
- 0x6f, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x56,
- 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00,
- 0x6e, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x20, 0x00, 0x34, 0x00, 0x2c,
- 0x00, 0x32, 0x00, 0x2c, 0x00, 0x31, 0x00, 0x2c, 0x00, 0x37, 0x00,
- 0x00, 0x00, 0x2e, 0x00, 0x07, 0x00, 0x01, 0x00, 0x53, 0x00, 0x70,
- 0x00, 0x65, 0x00, 0x63, 0x00, 0x69, 0x00, 0x61, 0x00, 0x6c, 0x00,
- 0x42, 0x00, 0x75, 0x00, 0x69, 0x00, 0x6c, 0x00, 0x64, 0x00, 0x00,
- 0x00, 0x4e, 0x00, 0x20, 0x00, 0x53, 0x00, 0x50, 0x00, 0x45, 0x00,
- 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x56, 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00,
- 0x6c, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x66, 0x00, 0x6f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x73, 0x00, 0x6c,
- 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0xb0, 0x04 };
- private static byte [] version_res2 = {
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
- 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec,
- 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x00,
- 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x01,
- 0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5f, 0x00, 0x56,
- 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4f, 0x00,
- 0x4e, 0x00, 0x5f, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x46, 0x00, 0x4f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x04, 0xef, 0xfe, 0x00, 0x00,
- 0x01, 0x00, 0x09, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x00, 0x08,
- 0x00, 0x09, 0x00, 0x06, 0x00, 0x07, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x4c, 0x01, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x74,
- 0x00, 0x72, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x46, 0x00,
- 0x69, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x66,
- 0x00, 0x6f, 0x00, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, 0x01, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x37, 0x00, 0x66, 0x00, 0x30, 0x00, 0x34,
- 0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x61,
- 0x00, 0x6e, 0x00, 0x79, 0x00, 0x4e, 0x00, 0x61, 0x00, 0x6d, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a,
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00,
- 0x65, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72,
- 0x00, 0x69, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00,
- 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00,
- 0x65, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69,
- 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 0x01, 0x00, 0x49, 0x00, 0x6e,
- 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6e, 0x00, 0x61, 0x00,
- 0x6c, 0x00, 0x4e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x4f, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6e,
- 0x00, 0x61, 0x00, 0x6c, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00,
- 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63,
- 0x00, 0x74, 0x00, 0x4e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x01,
- 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x64, 0x00,
- 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72,
- 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x56,
- 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6c, 0x00,
- 0x65, 0x00, 0x49, 0x00, 0x6e, 0x00, 0x66, 0x00, 0x6f, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00, 0x54, 0x00,
- 0x72, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x73, 0x00, 0x6c, 0x00, 0x61,
- 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0x00, 0xb0, 0x04 };
- private static byte [] version_res3 = {
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
- 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c,
- 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x00,
- 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00,
- 0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5f, 0x00, 0x56,
- 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4f, 0x00,
- 0x4e, 0x00, 0x5f, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x46, 0x00, 0x4f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x04, 0xef, 0xfe, 0x00, 0x00,
- 0x01, 0x00, 0x09, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x00, 0x08,
- 0x00, 0x09, 0x00, 0x06, 0x00, 0x07, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00 };
- private static byte [] version_res4 = {
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
- 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
- #endif
- }
- }
|