mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Added some module architecture
This commit is contained in:
parent
ab3f2b1fd8
commit
f093520ce8
@ -33,11 +33,32 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Castle.Core.4.2.0\lib\net45\Castle.Core.dll</HintPath>
|
<HintPath>..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="CSScriptLibrary, Version=3.27.2.0, Culture=neutral, PublicKeyToken=70fcc3d18c749033, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\CS-Script.bin.3.27.2.0\lib\net46\CSScriptLibrary.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="HidSharp, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="HidSharp, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\HidSharp.1.5\lib\net35\HidSharp.dll</HintPath>
|
<HintPath>..\packages\HidSharp.1.5\lib\net35\HidSharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.CodeAnalysis, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.2.6.1\lib\netstandard1.3\Microsoft.CodeAnalysis.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.2.6.1\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.CodeAnalysis.CSharp.Scripting, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.Scripting.2.6.1\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.Scripting.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.CodeAnalysis.Scripting, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.CodeAnalysis.Scripting.Common.2.6.1\lib\netstandard1.3\Microsoft.CodeAnalysis.Scripting.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Mono.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\CS-Script.bin.3.27.2.0\lib\net46\Mono.CSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
<Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath>
|
<HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -48,44 +69,95 @@
|
|||||||
<HintPath>..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll</HintPath>
|
<HintPath>..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Brushes, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Brushes, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Brushes.0.0.1.18\lib\net45\RGB.NET.Brushes.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Brushes.0.0.1.20\lib\net45\RGB.NET.Brushes.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Core, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Core, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Core.0.0.1.18\lib\net45\RGB.NET.Core.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Core.0.0.1.20\lib\net45\RGB.NET.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Decorators, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Decorators, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Decorators.0.0.1.18\lib\net45\RGB.NET.Decorators.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Decorators.0.0.1.20\lib\net45\RGB.NET.Decorators.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Devices.Asus, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Devices.Asus, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Devices.Asus.0.0.1.18\lib\net45\RGB.NET.Devices.Asus.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Devices.Asus.0.0.1.20\lib\net45\RGB.NET.Devices.Asus.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Devices.CoolerMaster, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Devices.CoolerMaster, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.18\lib\net45\RGB.NET.Devices.CoolerMaster.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\lib\net45\RGB.NET.Devices.CoolerMaster.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Devices.Corsair, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Devices.Corsair, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Devices.Corsair.0.0.1.18\lib\net45\RGB.NET.Devices.Corsair.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Devices.Corsair.0.0.1.20\lib\net45\RGB.NET.Devices.Corsair.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Devices.Logitech, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Devices.Logitech, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Devices.Logitech.0.0.1.18\lib\net45\RGB.NET.Devices.Logitech.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Devices.Logitech.0.0.1.20\lib\net45\RGB.NET.Devices.Logitech.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Devices.Msi, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Devices.Msi, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Devices.Msi.0.0.1.18\lib\net45\RGB.NET.Devices.Msi.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Devices.Msi.0.0.1.20\lib\net45\RGB.NET.Devices.Msi.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Devices.Novation, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Devices.Novation, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Devices.Novation.0.0.1.18\lib\net45\RGB.NET.Devices.Novation.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Devices.Novation.0.0.1.20\lib\net45\RGB.NET.Devices.Novation.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Devices.Razer, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Devices.Razer, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Devices.Razer.0.0.1.18\lib\net45\RGB.NET.Devices.Razer.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Devices.Razer.0.0.1.20\lib\net45\RGB.NET.Devices.Razer.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RGB.NET.Groups, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RGB.NET.Groups, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\RGB.NET.Groups.0.0.1.18\lib\net45\RGB.NET.Groups.dll</HintPath>
|
<HintPath>..\packages\RGB.NET.Groups.0.0.1.20\lib\net45\RGB.NET.Groups.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Sanford.Multimedia.Midi, Version=6.4.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Sanford.Multimedia.Midi, Version=6.4.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Sanford.Multimedia.Midi.6.4.1\lib\net20\Sanford.Multimedia.Midi.dll</HintPath>
|
<HintPath>..\packages\Sanford.Multimedia.Midi.6.4.2\lib\net20\Sanford.Multimedia.Midi.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Collections.Immutable, Version=1.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Collections.Immutable.1.4.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.ComponentModel.Composition" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Diagnostics.FileVersionInfo, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Diagnostics.FileVersionInfo.4.3.0\lib\net46\System.Diagnostics.FileVersionInfo.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Diagnostics.StackTrace, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Reflection.Metadata, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Reflection.Metadata.1.5.0\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net46\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net46\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Text.Encoding.CodePages, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Text.Encoding.CodePages.4.4.0\lib\net46\System.Text.Encoding.CodePages.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Threading.Thread, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
|
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -95,36 +167,61 @@
|
|||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.XPath, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.XPath.XDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Constants.cs" />
|
||||||
|
<Compile Include="Exceptions\ArtemisCoreException.cs" />
|
||||||
|
<Compile Include="Exceptions\ArtemisModuleException.cs" />
|
||||||
|
<Compile Include="Models\ModuleInfo.cs" />
|
||||||
|
<Compile Include="Modules\Interfaces\IModule.cs" />
|
||||||
<Compile Include="Ninject\CoreModule.cs" />
|
<Compile Include="Ninject\CoreModule.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Scripting.evaluator.cs" />
|
||||||
|
<Compile Include="Scripting.Extensions.cs" />
|
||||||
|
<Compile Include="Scripting.native.cs" />
|
||||||
<Compile Include="Services\CoreService.cs" />
|
<Compile Include="Services\CoreService.cs" />
|
||||||
<Compile Include="Services\Interfaces\IArtemisService.cs" />
|
<Compile Include="Services\Interfaces\IArtemisService.cs" />
|
||||||
<Compile Include="Services\Interfaces\ICoreService.cs" />
|
<Compile Include="Services\Interfaces\ICoreService.cs" />
|
||||||
<Compile Include="Services\Interfaces\IModuleService.cs" />
|
<Compile Include="Services\Interfaces\IModuleService.cs" />
|
||||||
|
<Compile Include="Events\ModuleEventArgs.cs" />
|
||||||
<Compile Include="Services\ModuleService.cs" />
|
<Compile Include="Services\ModuleService.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
|
||||||
|
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="..\packages\RGB.NET.Devices.Asus.0.0.1.18\build\net45\RGB.NET.Devices.Asus.targets" Condition="Exists('..\packages\RGB.NET.Devices.Asus.0.0.1.18\build\net45\RGB.NET.Devices.Asus.targets')" />
|
<Import Project="..\packages\RGB.NET.Devices.Asus.0.0.1.20\build\net45\RGB.NET.Devices.Asus.targets" Condition="Exists('..\packages\RGB.NET.Devices.Asus.0.0.1.20\build\net45\RGB.NET.Devices.Asus.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Asus.0.0.1.18\build\net45\RGB.NET.Devices.Asus.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Asus.0.0.1.18\build\net45\RGB.NET.Devices.Asus.targets'))" />
|
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Asus.0.0.1.20\build\net45\RGB.NET.Devices.Asus.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Asus.0.0.1.20\build\net45\RGB.NET.Devices.Asus.targets'))" />
|
||||||
<Error Condition="!Exists('..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.18\build\net45\RGB.NET.Devices.CoolerMaster.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.18\build\net45\RGB.NET.Devices.CoolerMaster.targets'))" />
|
<Error Condition="!Exists('..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\build\net45\RGB.NET.Devices.CoolerMaster.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\build\net45\RGB.NET.Devices.CoolerMaster.targets'))" />
|
||||||
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Corsair.0.0.1.18\build\net45\RGB.NET.Devices.Corsair.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Corsair.0.0.1.18\build\net45\RGB.NET.Devices.Corsair.targets'))" />
|
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Corsair.0.0.1.20\build\net45\RGB.NET.Devices.Corsair.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Corsair.0.0.1.20\build\net45\RGB.NET.Devices.Corsair.targets'))" />
|
||||||
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Logitech.0.0.1.18\build\net45\RGB.NET.Devices.Logitech.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Logitech.0.0.1.18\build\net45\RGB.NET.Devices.Logitech.targets'))" />
|
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Logitech.0.0.1.20\build\net45\RGB.NET.Devices.Logitech.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Logitech.0.0.1.20\build\net45\RGB.NET.Devices.Logitech.targets'))" />
|
||||||
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Msi.0.0.1.18\build\net45\RGB.NET.Devices.Msi.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Msi.0.0.1.18\build\net45\RGB.NET.Devices.Msi.targets'))" />
|
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Msi.0.0.1.20\build\net45\RGB.NET.Devices.Msi.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Msi.0.0.1.20\build\net45\RGB.NET.Devices.Msi.targets'))" />
|
||||||
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Razer.0.0.1.18\build\net45\RGB.NET.Devices.Razer.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Razer.0.0.1.18\build\net45\RGB.NET.Devices.Razer.targets'))" />
|
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Razer.0.0.1.20\build\net45\RGB.NET.Devices.Razer.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Razer.0.0.1.20\build\net45\RGB.NET.Devices.Razer.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<Import Project="..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.18\build\net45\RGB.NET.Devices.CoolerMaster.targets" Condition="Exists('..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.18\build\net45\RGB.NET.Devices.CoolerMaster.targets')" />
|
<Import Project="..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\build\net45\RGB.NET.Devices.CoolerMaster.targets" Condition="Exists('..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\build\net45\RGB.NET.Devices.CoolerMaster.targets')" />
|
||||||
<Import Project="..\packages\RGB.NET.Devices.Corsair.0.0.1.18\build\net45\RGB.NET.Devices.Corsair.targets" Condition="Exists('..\packages\RGB.NET.Devices.Corsair.0.0.1.18\build\net45\RGB.NET.Devices.Corsair.targets')" />
|
<Import Project="..\packages\RGB.NET.Devices.Corsair.0.0.1.20\build\net45\RGB.NET.Devices.Corsair.targets" Condition="Exists('..\packages\RGB.NET.Devices.Corsair.0.0.1.20\build\net45\RGB.NET.Devices.Corsair.targets')" />
|
||||||
<Import Project="..\packages\RGB.NET.Devices.Logitech.0.0.1.18\build\net45\RGB.NET.Devices.Logitech.targets" Condition="Exists('..\packages\RGB.NET.Devices.Logitech.0.0.1.18\build\net45\RGB.NET.Devices.Logitech.targets')" />
|
<Import Project="..\packages\RGB.NET.Devices.Logitech.0.0.1.20\build\net45\RGB.NET.Devices.Logitech.targets" Condition="Exists('..\packages\RGB.NET.Devices.Logitech.0.0.1.20\build\net45\RGB.NET.Devices.Logitech.targets')" />
|
||||||
<Import Project="..\packages\RGB.NET.Devices.Msi.0.0.1.18\build\net45\RGB.NET.Devices.Msi.targets" Condition="Exists('..\packages\RGB.NET.Devices.Msi.0.0.1.18\build\net45\RGB.NET.Devices.Msi.targets')" />
|
<Import Project="..\packages\RGB.NET.Devices.Msi.0.0.1.20\build\net45\RGB.NET.Devices.Msi.targets" Condition="Exists('..\packages\RGB.NET.Devices.Msi.0.0.1.20\build\net45\RGB.NET.Devices.Msi.targets')" />
|
||||||
<Import Project="..\packages\RGB.NET.Devices.Razer.0.0.1.18\build\net45\RGB.NET.Devices.Razer.targets" Condition="Exists('..\packages\RGB.NET.Devices.Razer.0.0.1.18\build\net45\RGB.NET.Devices.Razer.targets')" />
|
<Import Project="..\packages\RGB.NET.Devices.Razer.0.0.1.20\build\net45\RGB.NET.Devices.Razer.targets" Condition="Exists('..\packages\RGB.NET.Devices.Razer.0.0.1.20\build\net45\RGB.NET.Devices.Razer.targets')" />
|
||||||
</Project>
|
</Project>
|
||||||
10
src/Artemis.Core/Constants.cs
Normal file
10
src/Artemis.Core/Constants.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Artemis.Core
|
||||||
|
{
|
||||||
|
public static class Constants
|
||||||
|
{
|
||||||
|
public static readonly string DataFolder =
|
||||||
|
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Artemis\\";
|
||||||
|
}
|
||||||
|
}
|
||||||
9
src/Artemis.Core/Events/ModuleEventArgs.cs
Normal file
9
src/Artemis.Core/Events/ModuleEventArgs.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Artemis.Core.Modules.Interfaces;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Events
|
||||||
|
{
|
||||||
|
public class ModuleEventArgs : System.EventArgs
|
||||||
|
{
|
||||||
|
public IModule Module { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
19
src/Artemis.Core/Exceptions/ArtemisCoreException.cs
Normal file
19
src/Artemis.Core/Exceptions/ArtemisCoreException.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Exceptions
|
||||||
|
{
|
||||||
|
public class ArtemisCoreException : Exception
|
||||||
|
{
|
||||||
|
public ArtemisCoreException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtemisCoreException(string message) : base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtemisCoreException(string message, Exception inner) : base(message, inner)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/Artemis.Core/Exceptions/ArtemisModuleException.cs
Normal file
25
src/Artemis.Core/Exceptions/ArtemisModuleException.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using Artemis.Core.Models;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Exceptions
|
||||||
|
{
|
||||||
|
public class ArtemisModuleException : Exception
|
||||||
|
{
|
||||||
|
public ArtemisModuleException(ModuleInfo moduleInfo)
|
||||||
|
{
|
||||||
|
ModuleInfo = moduleInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtemisModuleException(ModuleInfo moduleInfo, string message) : base(message)
|
||||||
|
{
|
||||||
|
ModuleInfo = moduleInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtemisModuleException(ModuleInfo moduleInfo, string message, Exception inner) : base(message, inner)
|
||||||
|
{
|
||||||
|
ModuleInfo = moduleInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModuleInfo ModuleInfo { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
17
src/Artemis.Core/Models/ModuleInfo.cs
Normal file
17
src/Artemis.Core/Models/ModuleInfo.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Artemis.Core.Modules.Interfaces;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Models
|
||||||
|
{
|
||||||
|
public class ModuleInfo
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Version { get; set; }
|
||||||
|
public string MainFile { get; set; }
|
||||||
|
public IReadOnlyList<string> SubFiles { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public IModule Module { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/Artemis.Core/Modules/Interfaces/IModule.cs
Normal file
6
src/Artemis.Core/Modules/Interfaces/IModule.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace Artemis.Core.Modules.Interfaces
|
||||||
|
{
|
||||||
|
public interface IModule
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
295
src/Artemis.Core/Scripting.Extensions.cs
Normal file
295
src/Artemis.Core/Scripting.Extensions.cs
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
using CSScriptLibrary;
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.Remoting.Lifetime;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
// Read in more details about all aspects of CS-Script hosting in applications
|
||||||
|
// here: http://www.csscript.net/help/Script_hosting_guideline_.html
|
||||||
|
//
|
||||||
|
// This file contains samples for the script hosting scenarios requiring asynchronous script execution as well as unloading the
|
||||||
|
// scripts being executed.
|
||||||
|
// AsyncSamples
|
||||||
|
// Samples demonstrate the use of Async and Await mechanism available in C# 5 and higher. Note that the async method extensions
|
||||||
|
// cover the complete set of CSScript.Evaluator methods.
|
||||||
|
//
|
||||||
|
// UnloadingSamples
|
||||||
|
// Samples demonstrate the use of temporary AppDoamain for loading and executing dynamic C# code (script). It is the
|
||||||
|
// only mechanism available for unloading dynamically loaded assemblies. This is a well known CLR design limitation that leads to
|
||||||
|
// memory leaks if the assembly/script loaded in the caller AppDomain. The problem affects all C# script engines (e.g. Roslyn, CodeDom)
|
||||||
|
// and it cannot be solved by the engine itself thus CS-Script provides a work around in form of the MethodExtensions for the
|
||||||
|
// CSScript.Evaluator methods that are compatible with the unloading mechanism.
|
||||||
|
//
|
||||||
|
// Nevertheless you should try to avoid using remote AppDoamain unless you have to. It is very heavy and also imposes the serialization
|
||||||
|
// constrains.
|
||||||
|
//
|
||||||
|
// All samples rely on the compiler agnostic CSScript.Evaluator API.
|
||||||
|
namespace CSScriptEvaluatorExtensions
|
||||||
|
{
|
||||||
|
public class HostApp
|
||||||
|
{
|
||||||
|
public static void Test()
|
||||||
|
{
|
||||||
|
Console.WriteLine("---------------------------------------------");
|
||||||
|
Console.WriteLine("Testing asynchronous API");
|
||||||
|
Console.WriteLine("---------------------------------------------");
|
||||||
|
new AsyncSamples().RunAll();
|
||||||
|
Thread.Sleep(2000);
|
||||||
|
Console.WriteLine("\nPress 'Enter' to run uloading samples...");
|
||||||
|
Console.ReadLine();
|
||||||
|
Console.WriteLine("---------------------------------------------");
|
||||||
|
Console.WriteLine("Testing unloading API");
|
||||||
|
Console.WriteLine("---------------------------------------------");
|
||||||
|
new UnloadingSamples().RunAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
class AsyncSamples
|
||||||
|
{
|
||||||
|
public void RunAll()
|
||||||
|
{
|
||||||
|
Action<Action, string> run = (action, name) => { action(); Console.WriteLine(name); };
|
||||||
|
|
||||||
|
run(LoadDelegateAsync, "Start of " + nameof(LoadDelegateAsync));
|
||||||
|
run(LoadMethodAsync, "Start of " + nameof(LoadMethodAsync));
|
||||||
|
run(LoadCodeAsync, "Start of " + nameof(LoadCodeAsync));
|
||||||
|
run(CreateDelegateAsync, "Start of " + nameof(CreateDelegateAsync));
|
||||||
|
run(CompileCodeAsync, "Start of " + nameof(CompileCodeAsync));
|
||||||
|
run(RemoteAsynch, "Start of " + nameof(RemoteAsynch));
|
||||||
|
}
|
||||||
|
|
||||||
|
async void LoadDelegateAsync()
|
||||||
|
{
|
||||||
|
var product = await CSScript.Evaluator
|
||||||
|
.LoadDelegateAsync<Func<int, int, int>>(
|
||||||
|
@"int Product(int a, int b)
|
||||||
|
{
|
||||||
|
return a * b;
|
||||||
|
}");
|
||||||
|
|
||||||
|
Console.WriteLine(" End of {0}: {1}", nameof(LoadDelegateAsync), product(4, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void LoadMethodAsync()
|
||||||
|
{
|
||||||
|
dynamic script = await CSScript.Evaluator
|
||||||
|
.LoadMethodAsync(@"public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
public int Div(int a, int b)
|
||||||
|
{
|
||||||
|
return a/b;
|
||||||
|
}");
|
||||||
|
|
||||||
|
Console.WriteLine(" End of {0}: {1}", nameof(LoadMethodAsync), script.Div(15, 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void LoadCodeAsync()
|
||||||
|
{
|
||||||
|
//This use-case uses Interface Alignment and this requires all assemblies involved to have
|
||||||
|
//non-empty Assembly.Location
|
||||||
|
CSScript.GlobalSettings.InMemoryAssembly = false;
|
||||||
|
|
||||||
|
ICalc calc = await CSScript.Evaluator
|
||||||
|
.LoadCodeAsync<ICalc>(
|
||||||
|
@"using System;
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}");
|
||||||
|
|
||||||
|
Console.WriteLine(" End of {0}: {1}", nameof(LoadCodeAsync), calc.Sum(1, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void CreateDelegateAsync()
|
||||||
|
{
|
||||||
|
var product = await CSScript.Evaluator
|
||||||
|
.CreateDelegateAsync<int>(
|
||||||
|
@"int Product(int a, int b)
|
||||||
|
{
|
||||||
|
return a * b;
|
||||||
|
}");
|
||||||
|
|
||||||
|
Console.WriteLine(" End of {0}: {1}", nameof(CreateDelegateAsync), product(15, 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void CompileCodeAsync()
|
||||||
|
{
|
||||||
|
Assembly script = await CSScript.Evaluator
|
||||||
|
.CompileCodeAsync(@"using System;
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}");
|
||||||
|
dynamic calc = script.CreateObject("*");
|
||||||
|
|
||||||
|
Console.WriteLine(" End of {0}: {1}", nameof(CompileCodeAsync), calc.Sum(15, 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void RemoteAsynch()
|
||||||
|
{
|
||||||
|
var sum = await Task.Run(() =>
|
||||||
|
CSScript.Evaluator
|
||||||
|
.CreateDelegateRemotely<int>(
|
||||||
|
@"int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}")
|
||||||
|
);
|
||||||
|
Console.WriteLine(" End of {0}: {1}", nameof(RemoteAsynch), sum(1, 2));
|
||||||
|
|
||||||
|
sum.UnloadOwnerDomain();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UnloadingSamples
|
||||||
|
{
|
||||||
|
public void RunAll()
|
||||||
|
{
|
||||||
|
CreateDelegateRemotely();
|
||||||
|
LoadMethodRemotely();
|
||||||
|
LoadCodeRemotely();
|
||||||
|
LoadCodeRemotelyWithInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateDelegateRemotely()
|
||||||
|
{
|
||||||
|
var sum = CSScript.Evaluator
|
||||||
|
.CreateDelegateRemotely<int>(@"int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}");
|
||||||
|
|
||||||
|
Console.WriteLine("{0}: {1}", nameof(CreateDelegateRemotely), sum(15, 3));
|
||||||
|
|
||||||
|
sum.UnloadOwnerDomain();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadCodeRemotely()
|
||||||
|
{
|
||||||
|
// Class Calc doesn't implement ICals interface. Thus the compiled object cannot be typecasted into
|
||||||
|
// the interface and Evaluator will emit duck-typed assembly instead.
|
||||||
|
// But Mono and Roslyn build file-less assemblies, meaning that they cannot be used to build
|
||||||
|
// duck-typed proxies and CodeDomEvaluator needs to be used explicitly.
|
||||||
|
// Note class Calc also inherits from MarshalByRefObject. This is required for all object that
|
||||||
|
// are passed between AppDomain: they must inherit from MarshalByRefObject or be serializable.
|
||||||
|
|
||||||
|
//This use-case uses Interface Alignment and this requires all assemblies involved to have
|
||||||
|
//non-empty Assembly.Location
|
||||||
|
CSScript.GlobalSettings.InMemoryAssembly = false;
|
||||||
|
|
||||||
|
var script = CSScript.CodeDomEvaluator
|
||||||
|
.LoadCodeRemotely<ICalc>(
|
||||||
|
@"using System;
|
||||||
|
public class Calc : MarshalByRefObject
|
||||||
|
{
|
||||||
|
object t;
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
t = new Test();
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Test
|
||||||
|
{
|
||||||
|
~Test()
|
||||||
|
{
|
||||||
|
Console.WriteLine(""Domain is unloaded: ~Test()"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
");
|
||||||
|
|
||||||
|
Console.WriteLine("{0}: {1}", nameof(LoadCodeRemotely), script.Sum(15, 3));
|
||||||
|
|
||||||
|
script.UnloadOwnerDomain();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadCodeRemotelyWithInterface()
|
||||||
|
{
|
||||||
|
// Note class Calc also inherits from MarshalByRefObject. This is required for all object that
|
||||||
|
// are passed between AppDomain: they must inherit from MarshalByRefObject or be serializable.
|
||||||
|
var script = CSScript.Evaluator
|
||||||
|
.LoadCodeRemotely<ICalc>(
|
||||||
|
@"using System;
|
||||||
|
public class Calc : MarshalByRefObject, CSScriptEvaluatorExtensions.ICalc
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
");
|
||||||
|
|
||||||
|
Console.WriteLine("{0}: {1}", nameof(LoadCodeRemotelyWithInterface), script.Sum(15, 3));
|
||||||
|
|
||||||
|
script.UnloadOwnerDomain();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadMethodRemotely()
|
||||||
|
{
|
||||||
|
// LoadMethodRemotely is essentially the same as LoadCodeRemotely. It just deals not with the
|
||||||
|
// whole class definition but a single method(s) only. And the rest of the class definition is
|
||||||
|
// added automatically by CS-Script. The auto-generated class declaration also indicates
|
||||||
|
// that the class implements ICalc interface. Meaning that it will trigger compile error
|
||||||
|
// if the set of methods in the script code doesn't implement all interface members.
|
||||||
|
|
||||||
|
//This use-case uses Interface Alignment and this requires all assemblies involved to have
|
||||||
|
//non-empty Assembly.Location
|
||||||
|
CSScript.GlobalSettings.InMemoryAssembly = false;
|
||||||
|
|
||||||
|
var script = CSScript.Evaluator
|
||||||
|
.LoadMethodRemotely<IFullCalc>(
|
||||||
|
@"public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
public int Sub(int a, int b)
|
||||||
|
{
|
||||||
|
return a-b;
|
||||||
|
}");
|
||||||
|
|
||||||
|
Console.WriteLine("{0}: {1}", nameof(LoadMethodRemotely), script.Sum(15, 3));
|
||||||
|
|
||||||
|
script.UnloadOwnerDomain();
|
||||||
|
}
|
||||||
|
|
||||||
|
MethodDelegate sum;
|
||||||
|
ClientSponsor sumSponsor;
|
||||||
|
|
||||||
|
public void KeepRemoteObjectAlive()
|
||||||
|
{
|
||||||
|
sum = CSScript.Evaluator
|
||||||
|
.CreateDelegateRemotely(@"int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}");
|
||||||
|
|
||||||
|
//Normally remote objects are disposed if they are not accessed withing a default timeout period.
|
||||||
|
//It is not even enough to keep transparent proxies or their wrappers (e.g. 'sum') referenced.
|
||||||
|
//To prevent GC collection in the remote domain use .NET ClientSponsor mechanism as below.
|
||||||
|
sumSponsor = sum.ExtendLifeFromMinutes(30);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ICalc
|
||||||
|
{
|
||||||
|
int Sum(int a, int b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IFullCalc
|
||||||
|
{
|
||||||
|
int Sum(int a, int b);
|
||||||
|
|
||||||
|
int Sub(int a, int b);
|
||||||
|
}
|
||||||
|
}
|
||||||
345
src/Artemis.Core/Scripting.evaluator.cs
Normal file
345
src/Artemis.Core/Scripting.evaluator.cs
Normal file
@ -0,0 +1,345 @@
|
|||||||
|
using CSScriptLibrary;
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
// Read in more details about all aspects of CS-Script hosting in applications
|
||||||
|
// here: http://www.csscript.net/help/Script_hosting_guideline_.html
|
||||||
|
//
|
||||||
|
// This file contains samples for the script hosting scenarios relying on CS-Script Evaluator interface (API).
|
||||||
|
// This API is a unified generic interface allowing dynamic switch of the underlying compiling services (Mono, Roslyn, CodeDom)
|
||||||
|
// without the need for changing the hosting code.
|
||||||
|
//
|
||||||
|
// Apart from Evaluator (compiler agnostic) API CS-Script offers alternative hosting model: CS-Script Native,
|
||||||
|
// which relies solely on CodeDom compiler. CS-Script Native offers some features that are not available with CS-Script Evaluator
|
||||||
|
// (e.g. script unloading).
|
||||||
|
//
|
||||||
|
// The choice of the underlying compiling engine (e.g. Mono vs CodeDom) when using CS-Script Evaluator is always dictated by the
|
||||||
|
// specifics of the hosting scenario. Thanks to in-process compiler hosting, Mono and Roslyn demonstrate much better compiling
|
||||||
|
// performance comparing to CodeDom engine. However they don't allow script debugging and caching easily supported with CodeDom.
|
||||||
|
// Mono and particularly Roslyn also leas create more memory pressure due to the higher volume of the temp assemblies loaded into
|
||||||
|
// the hosting AppDomain. Roslyn (at least CSharp.Scripting-v1.2.0.0) also has very high initial loading overhead up to 4 seconds.
|
||||||
|
//
|
||||||
|
// One of the possible approaches would be to use EvaluatorEngine.CodeDom during the active development and later on switch to Mono/Roslyn.
|
||||||
|
|
||||||
|
namespace CSScriptEvaluatorApi
|
||||||
|
{
|
||||||
|
public class HostApp
|
||||||
|
{
|
||||||
|
public static void Test()
|
||||||
|
{
|
||||||
|
// Just in case clear AlternativeCompiler so it is not set to Roslyn or anything else by
|
||||||
|
// the CS-Script installed (if any) on the host OS
|
||||||
|
CSScript.GlobalSettings.UseAlternativeCompiler = null;
|
||||||
|
|
||||||
|
var samples = new EvaluatorSamples();
|
||||||
|
|
||||||
|
Console.WriteLine("Testing compiling services");
|
||||||
|
Console.WriteLine("---------------------------------------------");
|
||||||
|
|
||||||
|
CSScript.EvaluatorConfig.Engine = EvaluatorEngine.Mono;
|
||||||
|
Console.WriteLine(CSScript.Evaluator.GetType().Name + "...");
|
||||||
|
samples.RunAll();
|
||||||
|
|
||||||
|
Console.WriteLine("---------------------------------------------");
|
||||||
|
|
||||||
|
CSScript.EvaluatorConfig.Engine = EvaluatorEngine.Roslyn;
|
||||||
|
Console.WriteLine(CSScript.Evaluator.GetType().Name + "...");
|
||||||
|
samples.RunAll();
|
||||||
|
|
||||||
|
Console.WriteLine("---------------------------------------------");
|
||||||
|
|
||||||
|
CSScript.EvaluatorConfig.Engine = EvaluatorEngine.CodeDom;
|
||||||
|
Console.WriteLine(CSScript.Evaluator.GetType().Name + "...");
|
||||||
|
|
||||||
|
samples.RunAll();
|
||||||
|
|
||||||
|
//samples.DebugTest(); //uncomment if want to fire an assertion during the script execution
|
||||||
|
|
||||||
|
//Profile(); //uncomment if want to test performance of the engines
|
||||||
|
}
|
||||||
|
|
||||||
|
class EvaluatorSamples
|
||||||
|
{
|
||||||
|
public void RunAll()
|
||||||
|
{
|
||||||
|
Action<Action, string> run = (action, name) => { action(); Console.WriteLine(name + " - OK"); };
|
||||||
|
|
||||||
|
run(CompileMethod_Instance, nameof(CompileMethod_Instance));
|
||||||
|
run(CompileMethod_Static, nameof(CompileMethod_Static));
|
||||||
|
run(CreateDelegate, nameof(CreateDelegate));
|
||||||
|
run(LoadDelegate, nameof(LoadDelegate));
|
||||||
|
run(LoadCode, nameof(LoadCode));
|
||||||
|
run(LoadMethod, nameof(LoadMethod));
|
||||||
|
run(LoadMethodWithInterface, nameof(LoadMethodWithInterface));
|
||||||
|
run(LoadCode_WithInterface, nameof(LoadCode_WithInterface));
|
||||||
|
run(LoadCode_WithDuckTypedInterface, nameof(LoadCode_WithDuckTypedInterface));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CompileMethod_Instance()
|
||||||
|
{
|
||||||
|
// 1- CompileMethod wraps method into a class definition and returns compiled assembly
|
||||||
|
// 2 - CreateObject creates instance of a first class in the assembly
|
||||||
|
|
||||||
|
dynamic script = CSScript.Evaluator
|
||||||
|
.CompileMethod(@"int Sqr(int data)
|
||||||
|
{
|
||||||
|
return data * data;
|
||||||
|
}")
|
||||||
|
.CreateObject("*");
|
||||||
|
|
||||||
|
var result = script.Sqr(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CompileMethod_Static()
|
||||||
|
{
|
||||||
|
// 1 - CompileMethod wraps method into a class definition and returns compiled assembly
|
||||||
|
// 2 - GetStaticMethod returns duck-typed delegate that accepts 'params object[]' arguments
|
||||||
|
// Note: GetStaticMethodWithArgs can be replaced with a more convenient/shorter version
|
||||||
|
// that takes the object instead of the Type and then queries objects type internally:
|
||||||
|
// "GetStaticMethod("*.Test", data)"
|
||||||
|
|
||||||
|
var test = CSScript.Evaluator
|
||||||
|
.CompileMethod(@"using CSScriptEvaluatorApi;
|
||||||
|
static void Test(InputData data)
|
||||||
|
{
|
||||||
|
data.Index = GetIndex();
|
||||||
|
}
|
||||||
|
static int GetIndex()
|
||||||
|
{
|
||||||
|
return Environment.TickCount;
|
||||||
|
}")
|
||||||
|
.GetStaticMethodWithArgs("*.Test", typeof(InputData));
|
||||||
|
|
||||||
|
var data = new InputData();
|
||||||
|
test(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateDelegate()
|
||||||
|
{
|
||||||
|
// Wraps method into a class definition, compiles it and loads the compiled assembly.
|
||||||
|
// It returns duck-typed delegate. A delegate with 'params object[]' arguments and
|
||||||
|
// without any specific return type.
|
||||||
|
|
||||||
|
var sqr = CSScript.Evaluator
|
||||||
|
.CreateDelegate(@"int Sqr(int a)
|
||||||
|
{
|
||||||
|
return a * a;
|
||||||
|
}");
|
||||||
|
|
||||||
|
var r = sqr(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadDelegate()
|
||||||
|
{
|
||||||
|
// Wraps method into a class definition, loads the compiled assembly
|
||||||
|
// and returns the method delegate for the method, which matches the delegate specified
|
||||||
|
// as the type parameter of LoadDelegate
|
||||||
|
|
||||||
|
var product = CSScript.Evaluator
|
||||||
|
.LoadDelegate<Func<int, int, int>>(
|
||||||
|
@"int Product(int a, int b)
|
||||||
|
{
|
||||||
|
return a * b;
|
||||||
|
}");
|
||||||
|
|
||||||
|
int result = product(3, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadCode()
|
||||||
|
{
|
||||||
|
// LoadCode compiles code and returns instance of a first class
|
||||||
|
// in the compiled assembly
|
||||||
|
|
||||||
|
dynamic script = CSScript.Evaluator
|
||||||
|
.LoadCode(@"using System;
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}");
|
||||||
|
|
||||||
|
int result = script.Sum(1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadMethod()
|
||||||
|
{
|
||||||
|
// LoadMethod compiles code and returns instance of a first class
|
||||||
|
// in the compiled assembly.
|
||||||
|
// LoadMethod is essentially the same as LoadCode. It just deals not with the
|
||||||
|
// whole class definition but a single method(s) only. And the rest of the class definition is
|
||||||
|
// added automatically by CS-Script.
|
||||||
|
// 'public' is optional as it will be injected if the code doesn't start with it.
|
||||||
|
dynamic script = CSScript.Evaluator
|
||||||
|
.LoadMethod(@"using System;
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}");
|
||||||
|
|
||||||
|
int result = script.Sum(1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadMethodWithInterface()
|
||||||
|
{
|
||||||
|
// LoadMethod compiles code and returns instance of a first class
|
||||||
|
// in the compiled assembly.
|
||||||
|
// LoadMethod is essentially the same as LoadCode. It just deals not with the
|
||||||
|
// whole class definition but a single method(s) only. And the rest of the class definition is
|
||||||
|
// added automatically by CS-Script. The auto-generated class declaration also indicates
|
||||||
|
// that the class implements ICalc interface. Meaning that it will trigger compile error
|
||||||
|
// if the set of methods in the script code doesn't implement all interface members.
|
||||||
|
|
||||||
|
//This use-case uses Interface Alignment and this requires all assemblies involved to have
|
||||||
|
//non-empty Assembly.Location
|
||||||
|
CSScript.GlobalSettings.InMemoryAssembly = false;
|
||||||
|
|
||||||
|
ICalc script = CSScript.Evaluator
|
||||||
|
.LoadMethod<ICalc>(
|
||||||
|
@"int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}");
|
||||||
|
|
||||||
|
int result = script.Sum(1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadCode_WithInterface()
|
||||||
|
{
|
||||||
|
// 1 - LoadCode compiles code and returns instance of a first class in the compiled assembly
|
||||||
|
// 2 - The script class implements host app interface so the returned object can be type casted into it
|
||||||
|
|
||||||
|
var script = (ICalc)CSScript.Evaluator
|
||||||
|
.LoadCode(@"using System;
|
||||||
|
public class Script : CSScriptEvaluatorApi.ICalc
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}");
|
||||||
|
|
||||||
|
int result = script.Sum(1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadCode_WithDuckTypedInterface()
|
||||||
|
{
|
||||||
|
// 1 - LoadCode compiles code and returns instance of a first class in the compiled assembly
|
||||||
|
// 2- The script class doesn't implement host app interface but it can still be aligned to
|
||||||
|
// one as long at it implements the interface members
|
||||||
|
|
||||||
|
//This use-case uses Interface Alignment and this requires all assemblies involved to have
|
||||||
|
//non-empty Assembly.Location
|
||||||
|
CSScript.GlobalSettings.InMemoryAssembly = false;
|
||||||
|
|
||||||
|
ICalc script = CSScript.MonoEvaluator
|
||||||
|
.LoadCode<ICalc>(@"using System;
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}");
|
||||||
|
|
||||||
|
int result = script.Sum(1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PerformanceTest(int count = -1)
|
||||||
|
{
|
||||||
|
var code = @"int Sqr(int a)
|
||||||
|
{
|
||||||
|
return a * a;
|
||||||
|
}";
|
||||||
|
|
||||||
|
if (count != -1)
|
||||||
|
code += "//" + count; //this unique extra code comment ensures the code to be compiled cannot be cached
|
||||||
|
|
||||||
|
dynamic script = CSScript.Evaluator
|
||||||
|
.CompileMethod(code)
|
||||||
|
.CreateObject("*");
|
||||||
|
|
||||||
|
var r = script.Sqr(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DebugTest()
|
||||||
|
{
|
||||||
|
//pops up an assertion dialog
|
||||||
|
|
||||||
|
CSScript.EvaluatorConfig.DebugBuild = true;
|
||||||
|
CSScript.EvaluatorConfig.Engine = EvaluatorEngine.CodeDom;
|
||||||
|
|
||||||
|
dynamic script = CSScript.Evaluator
|
||||||
|
.LoadCode(@"using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
Debug.Assert(false,""Testing CS-Script debugging..."");
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}");
|
||||||
|
|
||||||
|
var r = script.Sum(3, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Profile()
|
||||||
|
{
|
||||||
|
var sw = new Stopwatch();
|
||||||
|
var samples = new EvaluatorSamples();
|
||||||
|
var count = 20;
|
||||||
|
var inxed = 0;
|
||||||
|
bool preventCaching = false;
|
||||||
|
|
||||||
|
Action run = () =>
|
||||||
|
{
|
||||||
|
sw.Restart();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
if (preventCaching)
|
||||||
|
samples.PerformanceTest(inxed++);
|
||||||
|
else
|
||||||
|
samples.PerformanceTest();
|
||||||
|
|
||||||
|
Console.WriteLine(CSScript.Evaluator.GetType().Name + ": " + sw.ElapsedMilliseconds);
|
||||||
|
};
|
||||||
|
|
||||||
|
Action runAll = () =>
|
||||||
|
{
|
||||||
|
Console.WriteLine("\n---------------------------------------------");
|
||||||
|
Console.WriteLine($"Caching enabled: {!preventCaching}\n");
|
||||||
|
|
||||||
|
CSScript.EvaluatorConfig.Engine = EvaluatorEngine.Mono;
|
||||||
|
run();
|
||||||
|
|
||||||
|
CSScript.EvaluatorConfig.Engine = EvaluatorEngine.CodeDom;
|
||||||
|
run();
|
||||||
|
|
||||||
|
CSScript.EvaluatorConfig.Engine = EvaluatorEngine.Roslyn;
|
||||||
|
run();
|
||||||
|
};
|
||||||
|
|
||||||
|
RoslynEvaluator.LoadCompilers(); //Roslyn is extremely heavy so exclude startup time from profiling
|
||||||
|
|
||||||
|
Console.WriteLine("Testing performance");
|
||||||
|
|
||||||
|
preventCaching = true;
|
||||||
|
runAll();
|
||||||
|
|
||||||
|
preventCaching = false;
|
||||||
|
runAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ICalc
|
||||||
|
{
|
||||||
|
int Sum(int a, int b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InputData
|
||||||
|
{
|
||||||
|
public int Index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
354
src/Artemis.Core/Scripting.native.cs
Normal file
354
src/Artemis.Core/Scripting.native.cs
Normal file
@ -0,0 +1,354 @@
|
|||||||
|
using CSScriptLibrary;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.IO;
|
||||||
|
using csscript;
|
||||||
|
using System.CodeDom.Compiler;
|
||||||
|
|
||||||
|
// Read in more details about all aspects of CS-Script hosting in applications
|
||||||
|
// here: http://www.csscript.net/help/Script_hosting_guideline_.html
|
||||||
|
//
|
||||||
|
// This file contains samples for the script hosting scenarios relying on CS-Script Native interface (API).
|
||||||
|
// This API is a compiler specific interface, which relies solely on CodeDom compiler. In most of the cases
|
||||||
|
// CS-Script Native model is the most flexible and natural choice
|
||||||
|
//
|
||||||
|
// Apart from Native API CS-Script offers alternative hosting model: CS-Script Evaluator, which provides
|
||||||
|
// a unified generic interface allowing dynamic switch the underlying compiling services (Mono, Roslyn, CodeDom)
|
||||||
|
// without the need for changing the hosting code.
|
||||||
|
//
|
||||||
|
// The Native interface is the original API that was designed to take maximum advantage of the dynamic C# code
|
||||||
|
// execution with CodeDom. The original implementation of this API was developed even before any compiler-as-service
|
||||||
|
// solution became available. Being based solely on CodeDOM the API doesn't utilize neither Mono nor Roslyn
|
||||||
|
// scripting solutions. Despite that CS-Script Native is the most mature, powerful and flexible API available with CS-Script.
|
||||||
|
//
|
||||||
|
// Native interface allows some unique features that are not available with CS-Script Evaluator:
|
||||||
|
// - Debugging scripts
|
||||||
|
// - Script caching
|
||||||
|
// - Script unloading
|
||||||
|
|
||||||
|
namespace CSScriptNativeApi
|
||||||
|
{
|
||||||
|
public class HostApp
|
||||||
|
{
|
||||||
|
public static void Test()
|
||||||
|
{
|
||||||
|
var host = new HostApp();
|
||||||
|
host.Log("Testing compiling services CS-Script Native API");
|
||||||
|
Console.WriteLine("---------------------------------------------");
|
||||||
|
|
||||||
|
CodeDomSamples.LoadMethod_Instance();
|
||||||
|
CodeDomSamples.LoadMethod_Static();
|
||||||
|
CodeDomSamples.LoadDelegate();
|
||||||
|
CodeDomSamples.CreateAction();
|
||||||
|
CodeDomSamples.CreateFunc();
|
||||||
|
CodeDomSamples.LoadCode();
|
||||||
|
CodeDomSamples.LoadCode_WithInterface(host);
|
||||||
|
CodeDomSamples.LoadCode_WithDuckTypedInterface(host);
|
||||||
|
CodeDomSamples.ExecuteAndUnload();
|
||||||
|
//CodeDomSamples.DebugTest(); //uncomment if want to fire an assertion during the script execution
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CodeDomSamples
|
||||||
|
{
|
||||||
|
public static void LoadMethod_Instance()
|
||||||
|
{
|
||||||
|
// 1- LoadMethod wraps method into a class definition, compiles it and returns loaded assembly
|
||||||
|
// 2 - CreateObject creates instance of a first class in the assembly
|
||||||
|
|
||||||
|
dynamic script = CSScript.LoadMethod(@"int Sqr(int data)
|
||||||
|
{
|
||||||
|
return data * data;
|
||||||
|
}")
|
||||||
|
.CreateObject("*");
|
||||||
|
|
||||||
|
var result = script.Sqr(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LoadMethod_Static()
|
||||||
|
{
|
||||||
|
// 1 - LoadMethod wraps method into a class definition, compiles it and returns loaded assembly
|
||||||
|
// 2 - GetStaticMethod returns first found static method as a duck-typed delegate that
|
||||||
|
// accepts 'params object[]' arguments
|
||||||
|
//
|
||||||
|
// Note: you can use GetStaticMethodWithArgs for higher precision method search: GetStaticMethodWithArgs("*.SayHello", typeof(string));
|
||||||
|
var sayHello = CSScript.LoadMethod(@"static void SayHello(string greeting)
|
||||||
|
{
|
||||||
|
Console.WriteLine(greeting);
|
||||||
|
}")
|
||||||
|
.GetStaticMethod();
|
||||||
|
|
||||||
|
sayHello("Hello World!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LoadDelegate()
|
||||||
|
{
|
||||||
|
// LoadDelegate wraps method into a class definition, compiles it and loads the compiled assembly.
|
||||||
|
// It returns the method delegate for the method, which matches the delegate specified
|
||||||
|
// as the type parameter of LoadDelegate
|
||||||
|
|
||||||
|
// The 'using System;' is optional; it demonstrates how to specify 'using' in the method-only syntax
|
||||||
|
|
||||||
|
var sayHello = CSScript.LoadDelegate<Action<string>>(
|
||||||
|
@"void SayHello(string greeting)
|
||||||
|
{
|
||||||
|
Console.WriteLine(greeting);
|
||||||
|
}");
|
||||||
|
|
||||||
|
sayHello("Hello World!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CreateAction()
|
||||||
|
{
|
||||||
|
// Wraps method into a class definition, compiles it and loads the compiled assembly.
|
||||||
|
// It returns duck-typed delegate. A delegate with 'params object[]' arguments and
|
||||||
|
// without any specific return type.
|
||||||
|
|
||||||
|
var sayHello = CSScript.CreateAction(@"void SayHello(string greeting)
|
||||||
|
{
|
||||||
|
Console.WriteLine(greeting);
|
||||||
|
}");
|
||||||
|
|
||||||
|
sayHello("Hello World!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CreateFunc()
|
||||||
|
{
|
||||||
|
// Wraps method into a class definition, compiles it and loads the compiled assembly.
|
||||||
|
// It returns duck-typed delegate. A delegate with 'params object[]' arguments and
|
||||||
|
// int as a return type.
|
||||||
|
|
||||||
|
var Sqr = CSScript.CreateFunc<int>(@"int Sqr(int a)
|
||||||
|
{
|
||||||
|
return a * a;
|
||||||
|
}");
|
||||||
|
int r = Sqr(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LoadCode()
|
||||||
|
{
|
||||||
|
// LoadCode compiles code and returns instance of a first class
|
||||||
|
// in the compiled assembly
|
||||||
|
|
||||||
|
dynamic script = CSScript.LoadCode(@"using System;
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}")
|
||||||
|
.CreateObject("*");
|
||||||
|
|
||||||
|
int result = script.Sum(1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LoadCodeWithConfig()
|
||||||
|
{
|
||||||
|
// LoadCode compiles code and returns instance of a first class
|
||||||
|
// in the compiled assembly
|
||||||
|
|
||||||
|
string file = Path.GetTempFileName();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.WriteAllText(file, @"using System;
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}");
|
||||||
|
|
||||||
|
var settings = new Settings();
|
||||||
|
//settings = null; // set to null to foll back to defaults
|
||||||
|
|
||||||
|
dynamic script = CSScript.LoadWithConfig(file, null, false, settings, "/define:TEST")
|
||||||
|
.CreateObject("*");
|
||||||
|
|
||||||
|
int result = script.Sum(1, 2);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (File.Exists(file))
|
||||||
|
File.Delete(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LoadCode_WithInterface(HostApp host)
|
||||||
|
{
|
||||||
|
// 1 - LoadCode compiles code and returns instance of a first class in the compiled assembly.
|
||||||
|
// 2 - The script class implements host app interface so the returned object can be type casted into it.
|
||||||
|
// 3 - In this sample host object is passed into script routine.
|
||||||
|
|
||||||
|
var calc = (ICalc) CSScript.LoadCode(@"using CSScriptNativeApi;
|
||||||
|
public class Script : ICalc
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
if(Host != null)
|
||||||
|
Host.Log(""Sum is invoked"");
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HostApp Host { get; set; }
|
||||||
|
}")
|
||||||
|
.CreateObject("*");
|
||||||
|
calc.Host = host;
|
||||||
|
int result = calc.Sum(1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LoadCode_WithDuckTypedInterface(HostApp host)
|
||||||
|
{
|
||||||
|
// 1 - LoadCode compiles code and returns instance of a first class in the compiled assembly
|
||||||
|
// 2- The script class doesn't implement host app interface but it can still be aligned to
|
||||||
|
// one as long at it implements the interface members
|
||||||
|
// 3 - In this sample host object is passed into script routine.
|
||||||
|
|
||||||
|
//This use-case uses Interface Alignment and this requires all assemblies involved to have
|
||||||
|
//non-empty Assembly.Location
|
||||||
|
CSScript.GlobalSettings.InMemoryAssembly = false;
|
||||||
|
|
||||||
|
ICalc calc = CSScript.LoadCode(@"using CSScriptNativeApi;
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
if(Host != null)
|
||||||
|
Host.Log(""Sum is invoked"");
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HostApp Host { get; set; }
|
||||||
|
}")
|
||||||
|
.CreateObject("*")
|
||||||
|
.AlignToInterface<ICalc>();
|
||||||
|
calc.Host = host;
|
||||||
|
int result = calc.Sum(1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ExecuteAndUnload()
|
||||||
|
{
|
||||||
|
// The script will be loaded into a temporary AppDomain and unloaded after the execution.
|
||||||
|
|
||||||
|
// Note: remote execution is a subject of some restrictions associated with the nature of the
|
||||||
|
// CLR cross-AppDomain interaction model:
|
||||||
|
// * the script class must be serializable or derived from MarshalByRefObject.
|
||||||
|
//
|
||||||
|
// * any object (call arguments, return objects) that crosses ApPDomain boundaries
|
||||||
|
// must be serializable or derived from MarshalByRefObject.
|
||||||
|
//
|
||||||
|
// * long living script class instances may get disposed in remote domain even if they are
|
||||||
|
// being referenced in the current AppDomain. You need to use the usual .NET techniques
|
||||||
|
// to prevent that. See LifetimeManagement.cs sample for details.
|
||||||
|
|
||||||
|
//This use-case uses Interface Alignment and this requires all assemblies involved to have
|
||||||
|
//non-empty Assembly.Location
|
||||||
|
CSScript.GlobalSettings.InMemoryAssembly = false;
|
||||||
|
|
||||||
|
var code = @"using System;
|
||||||
|
public class Script : MarshalByRefObject
|
||||||
|
{
|
||||||
|
public void Hello(string greeting)
|
||||||
|
{
|
||||||
|
Console.WriteLine(greeting);
|
||||||
|
}
|
||||||
|
}";
|
||||||
|
|
||||||
|
//Note: usage of helper.CreateAndAlignToInterface<IScript>("Script") is also acceptable
|
||||||
|
using (var helper = new AsmHelper(CSScript.CompileCode(code), null, deleteOnExit: true))
|
||||||
|
{
|
||||||
|
IScript script = helper.CreateAndAlignToInterface<IScript>("*");
|
||||||
|
script.Hello("Hi there...");
|
||||||
|
}
|
||||||
|
//from this point AsmHelper is disposed and the temp AppDomain is unloaded
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DebugTest()
|
||||||
|
{
|
||||||
|
//pops up an assertion dialog
|
||||||
|
dynamic script = CSScript.LoadCode(@"using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
Debug.Assert(false,""Testing CS-Script debugging..."");
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}", null, debugBuild: true).CreateObject("*");
|
||||||
|
|
||||||
|
int result = script.Sum(1, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Log(string message)
|
||||||
|
{
|
||||||
|
Console.WriteLine(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IScript
|
||||||
|
{
|
||||||
|
void Hello(string greeting);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ICalc
|
||||||
|
{
|
||||||
|
HostApp Host { get; set; }
|
||||||
|
|
||||||
|
int Sum(int a, int b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Samples
|
||||||
|
{
|
||||||
|
static public void CompilingHistory()
|
||||||
|
{
|
||||||
|
string script = Path.GetTempFileName();
|
||||||
|
string scriptAsm = script + ".dll";
|
||||||
|
CSScript.KeepCompilingHistory = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.WriteAllText(script, @"using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
public class Script
|
||||||
|
{
|
||||||
|
public int Sum(int a, int b)
|
||||||
|
{
|
||||||
|
return a+b;
|
||||||
|
}
|
||||||
|
}");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CSScript.CompileFile(script, scriptAsm, false, null);
|
||||||
|
|
||||||
|
CompilingInfo info = CSScript.CompilingHistory
|
||||||
|
.Values
|
||||||
|
.FirstOrDefault(item => item.ScriptFile == script);
|
||||||
|
if (info != null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Script: " + info.ScriptFile);
|
||||||
|
|
||||||
|
Console.WriteLine("Referenced assemblies:");
|
||||||
|
foreach (string asm in info.Input.ReferencedAssemblies)
|
||||||
|
Console.WriteLine(asm);
|
||||||
|
|
||||||
|
if (info.Result.Errors.HasErrors)
|
||||||
|
{
|
||||||
|
foreach (CompilerError err in info.Result.Errors)
|
||||||
|
if (!err.IsWarning)
|
||||||
|
Console.WriteLine("Error: " + err.ErrorText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CSScript.CompilingHistory.Clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
CSScript.KeepCompilingHistory = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,30 @@
|
|||||||
using Artemis.Core.Services.Interfaces;
|
using System.Threading.Tasks;
|
||||||
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
|
||||||
namespace Artemis.Core.Services
|
namespace Artemis.Core.Services
|
||||||
{
|
{
|
||||||
public class CoreService : ICoreService
|
public class CoreService : ICoreService
|
||||||
{
|
{
|
||||||
|
private readonly IModuleService _moduleService;
|
||||||
|
|
||||||
|
public CoreService(IModuleService moduleService)
|
||||||
|
{
|
||||||
|
_moduleService = moduleService;
|
||||||
|
Task.Run(Initialize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_moduleService.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsInitialized { get; set; }
|
||||||
|
|
||||||
|
private async Task Initialize()
|
||||||
|
{
|
||||||
|
await _moduleService.LoadModules();
|
||||||
|
|
||||||
|
IsInitialized = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,6 +1,9 @@
|
|||||||
namespace Artemis.Core.Services.Interfaces
|
using System;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Services.Interfaces
|
||||||
{
|
{
|
||||||
public interface ICoreService
|
public interface ICoreService: IArtemisService, IDisposable
|
||||||
{
|
{
|
||||||
|
bool IsInitialized { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,6 +1,16 @@
|
|||||||
namespace Artemis.Core.Services.Interfaces
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Artemis.Core.Events;
|
||||||
|
using Artemis.Core.Modules.Interfaces;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Services.Interfaces
|
||||||
{
|
{
|
||||||
public interface IModuleService
|
public interface IModuleService : IArtemisService, IDisposable
|
||||||
{
|
{
|
||||||
|
Task LoadModules();
|
||||||
|
Task ReloadModule(IModule module);
|
||||||
|
|
||||||
|
event EventHandler<ModuleEventArgs> ModuleLoaded;
|
||||||
|
event EventHandler<ModuleEventArgs> ModuleReloaded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,8 +1,120 @@
|
|||||||
using Artemis.Core.Services.Interfaces;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Artemis.Core.Events;
|
||||||
|
using Artemis.Core.Exceptions;
|
||||||
|
using Artemis.Core.Models;
|
||||||
|
using Artemis.Core.Modules.Interfaces;
|
||||||
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
using CSScriptLibrary;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Artemis.Core.Services
|
namespace Artemis.Core.Services
|
||||||
{
|
{
|
||||||
public class ModuleService : IModuleService
|
public class ModuleService : IModuleService
|
||||||
{
|
{
|
||||||
|
private readonly List<IModule> _modules;
|
||||||
|
|
||||||
|
public ModuleService()
|
||||||
|
{
|
||||||
|
_modules = new List<IModule>();
|
||||||
|
|
||||||
|
if (!Directory.Exists(Constants.DataFolder + "modules"))
|
||||||
|
Directory.CreateDirectory(Constants.DataFolder + "modules");
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoadingModules { get; private set; }
|
||||||
|
public ReadOnlyCollection<IModule> Modules => _modules.AsReadOnly();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads all installed modules. If modules already loaded this will reload them all
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task LoadModules()
|
||||||
|
{
|
||||||
|
if (LoadingModules)
|
||||||
|
throw new ArtemisCoreException("Cannot load modules while a previous load hasn't been completed yet.");
|
||||||
|
|
||||||
|
OnStartedLoadingModules();
|
||||||
|
|
||||||
|
// Empty the list of modules
|
||||||
|
_modules.Clear();
|
||||||
|
// Iterate all module folders
|
||||||
|
foreach (var directory in Directory.GetDirectories(Constants.DataFolder + "modules"))
|
||||||
|
// Load each module
|
||||||
|
_modules.Add(await LoadModuleFromFolder(directory));
|
||||||
|
|
||||||
|
|
||||||
|
OnFinishedLoadedModules();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ReloadModule(IModule module)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<IModule> LoadModuleFromFolder(string folder)
|
||||||
|
{
|
||||||
|
if (!folder.EndsWith("\\"))
|
||||||
|
folder += "\\";
|
||||||
|
if (!File.Exists(folder + "module.json"))
|
||||||
|
throw new ArtemisModuleException(null, "Failed to load module, no module.json found in " + folder);
|
||||||
|
|
||||||
|
var moduleInfo = JsonConvert.DeserializeObject<ModuleInfo>(File.ReadAllText(folder + "module.json"));
|
||||||
|
// Load the main module which will contain a class implementing IModule
|
||||||
|
var module = await CSScript.Evaluator.LoadFileAsync<IModule>(folder + moduleInfo.MainFile);
|
||||||
|
return module;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when a single module has loaded
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler<ModuleEventArgs> ModuleLoaded;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when a single module has reloaded
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler<ModuleEventArgs> ModuleReloaded;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when loading all modules has started
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler StartedLoadingModules;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when loading all modules has finished
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler FinishedLoadedModules;
|
||||||
|
|
||||||
|
private void OnModuleLoaded(ModuleEventArgs e)
|
||||||
|
{
|
||||||
|
ModuleLoaded?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnModuleReloaded(ModuleEventArgs e)
|
||||||
|
{
|
||||||
|
ModuleReloaded?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnStartedLoadingModules()
|
||||||
|
{
|
||||||
|
LoadingModules = true;
|
||||||
|
StartedLoadingModules?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnFinishedLoadedModules()
|
||||||
|
{
|
||||||
|
LoadingModules = false;
|
||||||
|
FinishedLoadedModules?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11,6 +11,58 @@
|
|||||||
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Diagnostics.FileVersionInfo" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.CodeAnalysis.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -1,25 +1,73 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Castle.Core" version="4.2.0" targetFramework="net46" />
|
<package id="Castle.Core" version="4.2.1" targetFramework="net46" />
|
||||||
|
<package id="CS-Script" version="3.27.2.0" targetFramework="net46" />
|
||||||
|
<package id="CS-Script.bin" version="3.27.2.0" targetFramework="net46" />
|
||||||
<package id="HidSharp" version="1.5" targetFramework="net46" />
|
<package id="HidSharp" version="1.5" targetFramework="net46" />
|
||||||
|
<package id="Microsoft.CodeAnalysis.Analyzers" version="1.1.0" targetFramework="net46" />
|
||||||
|
<package id="Microsoft.CodeAnalysis.Common" version="2.6.1" targetFramework="net46" />
|
||||||
|
<package id="Microsoft.CodeAnalysis.CSharp" version="2.6.1" targetFramework="net46" />
|
||||||
|
<package id="Microsoft.CodeAnalysis.CSharp.Scripting" version="2.6.1" targetFramework="net46" />
|
||||||
|
<package id="Microsoft.CodeAnalysis.Scripting.Common" version="2.6.1" targetFramework="net46" />
|
||||||
|
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" />
|
||||||
<package id="Ninject" version="3.3.4" targetFramework="net46" />
|
<package id="Ninject" version="3.3.4" targetFramework="net46" />
|
||||||
<package id="Ninject.Extensions.Conventions" version="3.3.0" targetFramework="net46" />
|
<package id="Ninject.Extensions.Conventions" version="3.3.0" targetFramework="net46" />
|
||||||
<package id="Ninject.Extensions.Factory" version="3.3.2" targetFramework="net46" />
|
<package id="Ninject.Extensions.Factory" version="3.3.2" targetFramework="net46" />
|
||||||
<package id="RGB.NET" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Brushes" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Brushes" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Core" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Core" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Decorators" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Decorators" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Devices" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Devices" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Devices.Asus" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Devices.Asus" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Devices.CoolerMaster" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Devices.CoolerMaster" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Devices.Corsair" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Devices.Corsair" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Devices.Logitech" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Devices.Logitech" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Devices.Msi" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Devices.Msi" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Devices.Novation" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Devices.Novation" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Devices.Razer" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Devices.Razer" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Groups" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Groups" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="RGB.NET.Presets" version="0.0.1.18" targetFramework="net46" />
|
<package id="RGB.NET.Presets" version="0.0.1.20" targetFramework="net46" />
|
||||||
<package id="Sanford.Multimedia.Midi" version="6.4.1" targetFramework="net46" />
|
<package id="Sanford.Multimedia.Midi" version="6.4.2" targetFramework="net46" />
|
||||||
|
<package id="System.AppContext" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Collections" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Collections.Immutable" version="1.4.0" targetFramework="net46" />
|
||||||
|
<package id="System.Console" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Diagnostics.FileVersionInfo" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Diagnostics.StackTrace" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Globalization" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.IO" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.IO.Compression" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Linq" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Reflection" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Reflection.Metadata" version="1.5.0" targetFramework="net46" />
|
||||||
|
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Runtime" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net46" />
|
||||||
|
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net46" />
|
||||||
|
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Text.Encoding.CodePages" version="4.4.0" targetFramework="net46" />
|
||||||
|
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Threading" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Threading.Thread" version="4.3.0" targetFramework="net46" />
|
||||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net46" />
|
<package id="System.ValueTuple" version="4.4.0" targetFramework="net46" />
|
||||||
|
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Xml.XPath" version="4.3.0" targetFramework="net46" />
|
||||||
|
<package id="System.Xml.XPath.XDocument" version="4.3.0" targetFramework="net46" />
|
||||||
</packages>
|
</packages>
|
||||||
56
src/Artemis.Modules/Artemis.Modules.csproj
Normal file
56
src/Artemis.Modules/Artemis.Modules.csproj
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{6B62C017-8ED8-4076-BDF9-555918266D43}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Artemis.Modules</RootNamespace>
|
||||||
|
<AssemblyName>Artemis.Modules</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="TestModule.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj">
|
||||||
|
<Project>{9b811f9b-86b9-4771-87af-72bae7078a36}</Project>
|
||||||
|
<Name>Artemis.Core</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
36
src/Artemis.Modules/Properties/AssemblyInfo.cs
Normal file
36
src/Artemis.Modules/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Artemis.Modules")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Artemis.Modules")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("6b62c017-8ed8-4076-bdf9-555918266d43")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
8
src/Artemis.Modules/TestModule.cs
Normal file
8
src/Artemis.Modules/TestModule.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using Artemis.Core.Modules.Interfaces;
|
||||||
|
|
||||||
|
namespace Artemis.Modules
|
||||||
|
{
|
||||||
|
public class TestModule : IModule
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
63
src/Artemis.Modules/app.config
Normal file
63
src/Artemis.Modules/app.config
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.CodeAnalysis.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
||||||
@ -10,6 +10,62 @@
|
|||||||
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Diagnostics.FileVersionInfo" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.CodeAnalysis.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -147,6 +147,10 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj">
|
||||||
|
<Project>{9b811f9b-86b9-4771-87af-72bae7078a36}</Project>
|
||||||
|
<Name>Artemis.Core</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Artemis.Storage\Artemis.Storage.csproj">
|
<ProjectReference Include="..\Artemis.Storage\Artemis.Storage.csproj">
|
||||||
<Project>{e489e5e3-1a65-4af5-a1ea-f9805fd19a65}</Project>
|
<Project>{e489e5e3-1a65-4af5-a1ea-f9805fd19a65}</Project>
|
||||||
<Name>Artemis.Storage</Name>
|
<Name>Artemis.Storage</Name>
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using Artemis.UI.Ninject;
|
using System.Windows;
|
||||||
|
using Artemis.Core.Ninject;
|
||||||
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
using Artemis.UI.Ninject;
|
||||||
using Artemis.UI.Stylet;
|
using Artemis.UI.Stylet;
|
||||||
using Artemis.UI.ViewModels;
|
using Artemis.UI.ViewModels;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
@ -7,9 +10,26 @@ namespace Artemis.UI
|
|||||||
{
|
{
|
||||||
public class Bootstrapper : NinjectBootstrapper<RootViewModel>
|
public class Bootstrapper : NinjectBootstrapper<RootViewModel>
|
||||||
{
|
{
|
||||||
|
private ICoreService _core;
|
||||||
|
|
||||||
|
protected override void OnExit(ExitEventArgs e)
|
||||||
|
{
|
||||||
|
// Stop the Artemis core
|
||||||
|
_core.Dispose();
|
||||||
|
|
||||||
|
base.OnExit(e);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void ConfigureIoC(IKernel kernel)
|
protected override void ConfigureIoC(IKernel kernel)
|
||||||
{
|
{
|
||||||
|
// Load this assembly's module
|
||||||
kernel.Load<UIModule>();
|
kernel.Load<UIModule>();
|
||||||
|
// Load the core assembly's module
|
||||||
|
kernel.Load<CoreModule>();
|
||||||
|
|
||||||
|
// Start the Artemis core, the core's constructor will initialize async
|
||||||
|
_core = Kernel.Get<ICoreService>();
|
||||||
|
|
||||||
base.ConfigureIoC(kernel);
|
base.ConfigureIoC(kernel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,17 +9,17 @@ namespace Artemis.UI.Stylet
|
|||||||
public class NinjectBootstrapper<TRootViewModel> : BootstrapperBase where TRootViewModel : class
|
public class NinjectBootstrapper<TRootViewModel> : BootstrapperBase where TRootViewModel : class
|
||||||
{
|
{
|
||||||
private object _rootViewModel;
|
private object _rootViewModel;
|
||||||
private IKernel kernel;
|
protected IKernel Kernel;
|
||||||
|
|
||||||
protected virtual object RootViewModel =>
|
protected virtual object RootViewModel => _rootViewModel ?? (_rootViewModel = GetInstance(typeof(TRootViewModel)));
|
||||||
_rootViewModel ?? (_rootViewModel = GetInstance(typeof(TRootViewModel)));
|
|
||||||
|
|
||||||
protected override void ConfigureBootstrapper()
|
protected override void ConfigureBootstrapper()
|
||||||
{
|
{
|
||||||
kernel = new StandardKernel();
|
Kernel = new StandardKernel();
|
||||||
DefaultConfigureIoC(kernel);
|
DefaultConfigureIoC(Kernel);
|
||||||
ConfigureIoC(kernel);
|
ConfigureIoC(Kernel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Carries out default configuration of the IoC container. Override if you don't want to do this
|
/// Carries out default configuration of the IoC container. Override if you don't want to do this
|
||||||
@ -49,7 +49,7 @@ namespace Artemis.UI.Stylet
|
|||||||
|
|
||||||
public override object GetInstance(Type type)
|
public override object GetInstance(Type type)
|
||||||
{
|
{
|
||||||
return kernel.Get(type);
|
return Kernel.Get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Launch()
|
protected override void Launch()
|
||||||
@ -61,8 +61,8 @@ namespace Artemis.UI.Stylet
|
|||||||
{
|
{
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
ScreenExtensions.TryDispose(_rootViewModel);
|
ScreenExtensions.TryDispose(_rootViewModel);
|
||||||
if (kernel != null)
|
if (Kernel != null)
|
||||||
kernel.Dispose();
|
Kernel.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Storage", "Artemis.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Core", "Artemis.Core\Artemis.Core.csproj", "{9B811F9B-86B9-4771-87AF-72BAE7078A36}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Core", "Artemis.Core\Artemis.Core.csproj", "{9B811F9B-86B9-4771-87AF-72BAE7078A36}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Modules", "Artemis.Modules\Artemis.Modules.csproj", "{6B62C017-8ED8-4076-BDF9-555918266D43}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -27,6 +29,10 @@ Global
|
|||||||
{9B811F9B-86B9-4771-87AF-72BAE7078A36}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{9B811F9B-86B9-4771-87AF-72BAE7078A36}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{9B811F9B-86B9-4771-87AF-72BAE7078A36}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{9B811F9B-86B9-4771-87AF-72BAE7078A36}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{9B811F9B-86B9-4771-87AF-72BAE7078A36}.Release|Any CPU.Build.0 = Release|Any CPU
|
{9B811F9B-86B9-4771-87AF-72BAE7078A36}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{6B62C017-8ED8-4076-BDF9-555918266D43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{6B62C017-8ED8-4076-BDF9-555918266D43}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6B62C017-8ED8-4076-BDF9-555918266D43}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{6B62C017-8ED8-4076-BDF9-555918266D43}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user