File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+ <!-- All-in-one example project.
3+ It contains a launcher for all examples in the subdirectories that
4+ compiles to a single .exe, prints some information about the wrapper and
5+ passes all arguments through to the example specified as first command line
6+ argument. -->
7+ <PropertyGroup >
8+ <TargetFramework >netcoreapp5.0</TargetFramework >
9+ <Product >Labstreaminglayer C# examples</Product >
10+ <Version >1.14</Version >
11+ <LangVersion >8.0</LangVersion >
12+ <OutputType >Exe</OutputType >
13+ <StartupObject >LSLExamples.EntryPoint</StartupObject >
14+ </PropertyGroup >
15+ <ItemGroup >
16+ <ProjectReference Include =" ..\liblsl.csproj" />
17+ </ItemGroup >
18+ </Project >
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Linq ;
3+ using System . Reflection ;
4+
5+ namespace LSLExamples
6+ {
7+ static class EntryPoint
8+ {
9+ public static void Main ( string [ ] args ) {
10+ var examples = Assembly . GetExecutingAssembly ( ) . GetTypes ( )
11+ . Where ( t => t . Namespace == "LSLExamples" ) . ToDictionary ( e=> e . Name , e=> e ) ;
12+
13+ var WrapperVersion = Assembly . GetAssembly ( typeof ( LSL . LSL ) ) . GetName ( ) . Version . ToString ( ) ;
14+ Console . Out . Write ( "Wrapper version: " ) ;
15+ Console . Out . WriteLine ( WrapperVersion ) ;
16+ Console . Out . Write ( "liblsl version: " ) ;
17+ Console . Out . WriteLine ( LSL . LSL . library_version ( ) ) ;
18+ if ( args . Length < 1 || ! examples . ContainsKey ( args [ 0 ] ) ) {
19+ Console . Out . WriteLine ( "\n Not enough arguments. Valid examples:" ) ;
20+ foreach ( var name in examples . Keys ) Console . Out . WriteLine ( name ) ;
21+ return ;
22+ }
23+ var method = examples [ args [ 0 ] ] . GetMethod ( "Main" , BindingFlags . Public | BindingFlags . Static ) ;
24+ Console . Out . WriteLine ( method ) ;
25+ method . Invoke ( null , new object [ ] { args } ) ;
26+ }
27+ }
28+ }
29+
You can’t perform that action at this time.
0 commit comments