================================================================================ GeViScope_SDK.pdf - Pages 31 to 40 ================================================================================ ──────────────────────────────────────────────────────────────────────────────── Page 31 ──────────────────────────────────────────────────────────────────────────────── ThesewrapperassembliesaredevelopedinC++/CLIandpublishedwiththeSDK.The assembliescanbefoundintheGeViScopeSDKbinaryfolder“GeViScopeSDK\BIN”. TheSDKprovideswrapperassembliesforthe.NET-Frameworksversions2.0and4.0 whicharenamedasfollows: .NET-Framework2.0 •GscExceptionsNET_2_0.dll •GscActionsNET_2_0.dll •GscMediaPlayerNET_2_0.dll •GscDBINET_2_0.dll .NET-Framework4.0 •GscExceptionsNET_4_0.dll •GscActionsNET_4_0.dll •GscMediaPlayerNET_4_0.dll •GscDBINET_4_0.dll ThesewrapperassembliescanbeusedtogetherwithournativeSDKDLLs(GscAc- tions.DLL,GscDBI.DLL,GscHelper.DLL,GscMediaPlayer.DLL,MscDBI.DLL)tocreate customapplicationsunderany.NETlanguageonawindowsplatform.Theassemblies needtobereferencedbythe.NETprojectandallthefiles(assembliesandnativeDLLs) havetoresideintheapplicationfolder. ──────────────────────────────────────────────────────────────────────────────── Page 32 ──────────────────────────────────────────────────────────────────────────────── Deployingacustomsolutionbasedonthe.NETwrapper Tosuccessfullydeployacustomapplicationthatusesthe.NETwrappercontainedinthe SDK,thefollowingprerequisiteshavetobefulfilled: a)MicrosoftVisualC++RedistributablePackagehastobe installed ThewrapperassembliesaredevelopedinC++/CLI.Soforexecutingthemonanonedevel- opmentmachine,theMicrosoftVisualC++RedistributablePackageisneeded.Thispack- ageexistsinadebugorinareleaseversion.Onproductivemachinesthereleaseversion needstobeinstalled. Forapplicationsusingthe.NET-Framework2.0theVisualC++2008RedistributablePack- ageisneeded.Incasethattheapplicationisdevelopedusingthe.NET-Framework4.0you needtoinstalltheVisualC++2010RedistributablePackage. b).NETFrameworkVersion2.0SP1ornewerhastobe installed Ifupdatingthe.NETFrameworkonaGEUTEBRÜCKdevice(GeViScopeorre_porter) fails,aspecialMicrosofttoolWindowsInstallerCleanUpUtility(MSICUU2.exe)can improvethesituation.Afterexecutingthistool,updatingtheFrameworkshouldbepossible. c)WrapperassembliesANDnativeSDKDLLsareneeded BesidethecustomapplicationalsothewrapperassembliesandthenativeSDKDLLs(lis- tedabove)areneededinthesamefolderasinwhichthecustomapplicationresides. Iftheapplicationusesthe.NET-Framework4.0youneedtoreferencetheGeViScopewrap- perDLLswiththeextension_4_0otherwisepleaseusethewrapperassemblieswiththe extension_2_0(seeabove). GeViScopeREGISTRY UsingtheGscRegistrywith.NET Introduction ByusingtheGeViScoperegistry(GSCREGISTRY)itispossibletomodifyGeViScope/Re_ portersettingsprogrammatically.TheGscRegistryisaproprietaryregistryformat developedbyGEUTEBRÜCK.ThisregistryformatissimilartotheMicrosoftWindows registry. ──────────────────────────────────────────────────────────────────────────────── Page 33 ──────────────────────────────────────────────────────────────────────────────── AllneededGeViScopeserversettingsarestoredintheGscRegistrydatabase.Thecreation ofownregistrydatabasesbasedonfilesisalsopossible. TheGEUTEBRÜCKGEVISCOPESDKprovidesseveralclassesandmethodstoallowa comfortableaccesstotheGscRegistry. Requirements Thefollowingrequirementsareneededtocreatea.NETapplicationthatusestheGscRe- gistryfunctionality: •.NET-Framework2.0SP1ornewer -.NET-Framework2.0SP1Wrapper-Assemblies: GscExceptionsNET_2_0.dll GscDBINET_2_0.dll -.NET-Framework4.0Wrapper-Assemblies: GscExceptionsNET_4_0.dll GscDBINET_4_0.dll •NativeWin32-DLLs,usedbythe.NET-Wrapper: -GscActions.dll -GscDBI.dll -GscMediaPlayer.dll -GscHelper.dll -MscDBI.dll •MicrosoftVisualC++RedistributablePackage Usingtheregistry Inthefollowing,theusageoftheGscRegistrywith.NETisexplainedindetail.Itdiscusses thefollowingsteps: l Opentheregistry l Readvaluesoutofnodes l Createanode l Addvaluestoanode l Savetheregistry AllnecessaryclassesandmethodsforusingtheGscRegistryareavailableintheGscDBI namespace.Toincludethisnamespacethefollowingusing-statementisneeded: usingGEUTEBRUECK.GeViScope.Wrapper.DBI; Opentheregistry ToreadormodifyGeViScope/Re_portersettingsitisnecessarytoestablishaconnection tothepreferredGeViScope/Re_porterserverbefore.Afterthisisdoneyouneedtocreatea newobjectoftheclassGscRegistryandinitializeitbyusingtheCreateRegistry()method whichiscontainedintheGscServerobject. C#-Code:Opentheregistry if(_GscServer!=null) { //createanobjectinstanceoftheserverregistry GscRegistryGscRegistry=_GscServer.CreateRegistry(); if(GscRegistry!=null) { //defineanarrayforthesetupreadrequest(registrynodepaths toread) ──────────────────────────────────────────────────────────────────────────────── Page 34 ──────────────────────────────────────────────────────────────────────────────── GscRegistryReadRequest[]ReadRequests=newGscRegistryReadRequest [1]; ReadRequests[0]=newGscRegistryReadRequest("/",0); //readthenodes(setupdata)outoftheserverregistry GscRegistry.ReadNodes(ReadRequests); } } ThemethodReadNodes()oftheGscRegistryobjectexpectsanarrayofthetypeGscRe- gistryReadRequestwhichcontainsallnodepathstobereadoutoftheregistry.Inthe sourcecodesnippetabove,thearraysimplycontainsoneelementwhichrepresentsthe rootnode(“/”).Byreadingtherootnodetheentireregistrywillbereadout. Readvaluesofnodes Thefollowingsourcecodesnippetshowshowtoreadvaluesoutofnodes: C#-Code:Readvaluesoutofnodes if(GscRegistry!=null) { GscRegNodeRegNode=GscRegistry.FindNode("/System/MediaChannels/"); for(inti=0;i