mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Always save solution first :>>>
This commit is contained in:
parent
a51ae92fea
commit
25f832cba5
@ -62,7 +62,7 @@ namespace Artemis.Plugins.Models
|
|||||||
var pluginInfo = JsonConvert.DeserializeObject<PluginInfo>(File.ReadAllText(folder + "plugin.json"));
|
var pluginInfo = JsonConvert.DeserializeObject<PluginInfo>(File.ReadAllText(folder + "plugin.json"));
|
||||||
pluginInfo.Folder = folder;
|
pluginInfo.Folder = folder;
|
||||||
|
|
||||||
// Load the main plugin which will contain a class implementing IPlugin
|
// Load the main script and get the type
|
||||||
var assembly = await CSScript.Evaluator.CompileCodeAsync(File.ReadAllText(folder + pluginInfo.Main));
|
var assembly = await CSScript.Evaluator.CompileCodeAsync(File.ReadAllText(folder + pluginInfo.Main));
|
||||||
var pluginType = assembly.GetTypes().Where(t => typeof(IPlugin).IsAssignableFrom(t)).ToList();
|
var pluginType = assembly.GetTypes().Where(t => typeof(IPlugin).IsAssignableFrom(t)).ToList();
|
||||||
if (!pluginType.Any())
|
if (!pluginType.Any())
|
||||||
@ -70,6 +70,7 @@ namespace Artemis.Plugins.Models
|
|||||||
if (pluginType.Count > 1)
|
if (pluginType.Count > 1)
|
||||||
throw new ArtemisPluginException(pluginInfo, "Failed to load plugin, more than one type found that implements IPlugin");
|
throw new ArtemisPluginException(pluginInfo, "Failed to load plugin, more than one type found that implements IPlugin");
|
||||||
|
|
||||||
|
// Instantiate the plugin with Ninject
|
||||||
pluginInfo.Plugin = (IPlugin) kernel.Get(pluginType.First());
|
pluginInfo.Plugin = (IPlugin) kernel.Get(pluginType.First());
|
||||||
pluginInfo.Plugin.LoadPlugin();
|
pluginInfo.Plugin.LoadPlugin();
|
||||||
|
|
||||||
@ -93,5 +94,25 @@ namespace Artemis.Plugins.Models
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IModuleViewModel> GetModuleViewModel(IKernel kernel)
|
||||||
|
{
|
||||||
|
// Don't attempt to locave VMs for something other than a module
|
||||||
|
if (Plugin is IModule)
|
||||||
|
throw new ArtemisPluginException(this, "Cannot locate a view model for this plugin as it's not a module.");
|
||||||
|
|
||||||
|
// Compile the ViewModel script and get the type
|
||||||
|
var assembly = await CSScript.Evaluator.CompileCodeAsync(File.ReadAllText(Folder + ViewModel));
|
||||||
|
var vmType = assembly.GetTypes().Where(t => typeof(IModuleViewModel).IsAssignableFrom(t)).ToList();
|
||||||
|
if (!vmType.Any())
|
||||||
|
throw new ArtemisPluginException(this, "Failed to load plugin, no type found that implements IModuleViewModel");
|
||||||
|
if (vmType.Count > 1)
|
||||||
|
throw new ArtemisPluginException(this, "Failed to load plugin, more than one type found that implements IModuleViewModel");
|
||||||
|
|
||||||
|
// Instantiate the ViewModel with Ninject
|
||||||
|
var vm = (IModuleViewModel)kernel.Get(vmType.First());
|
||||||
|
vm.PluginInfo = this;
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26730.12
|
VisualStudioVersion = 15.0.27130.2036
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.UI", "Artemis.UI\Artemis.UI.csproj", "{46B74153-77CF-4489-BDF9-D53FDB1F7ACB}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.UI", "Artemis.UI\Artemis.UI.csproj", "{46B74153-77CF-4489-BDF9-D53FDB1F7ACB}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -11,6 +11,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Core", "Artemis.Cor
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Plugins", "Artemis.Plugins\Artemis.Plugins.csproj", "{CD23BC5E-57F0-46CE-A007-24D031146219}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Plugins", "Artemis.Plugins\Artemis.Plugins.csproj", "{CD23BC5E-57F0-46CE-A007-24D031146219}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{FAF4C738-F49C-490B-9134-57598FF5358C}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Module.General", "Module.General\Module.General.csproj", "{58113CC5-A9CA-4EC3-AB4E-3C94B99268D8}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -33,10 +37,17 @@ Global
|
|||||||
{CD23BC5E-57F0-46CE-A007-24D031146219}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{CD23BC5E-57F0-46CE-A007-24D031146219}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{CD23BC5E-57F0-46CE-A007-24D031146219}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{CD23BC5E-57F0-46CE-A007-24D031146219}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{CD23BC5E-57F0-46CE-A007-24D031146219}.Release|Any CPU.Build.0 = Release|Any CPU
|
{CD23BC5E-57F0-46CE-A007-24D031146219}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{58113CC5-A9CA-4EC3-AB4E-3C94B99268D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{58113CC5-A9CA-4EC3-AB4E-3C94B99268D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{58113CC5-A9CA-4EC3-AB4E-3C94B99268D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{58113CC5-A9CA-4EC3-AB4E-3C94B99268D8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{58113CC5-A9CA-4EC3-AB4E-3C94B99268D8} = {FAF4C738-F49C-490B-9134-57598FF5358C}
|
||||||
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {C203080A-4473-4CC2-844B-F552EA43D66A}
|
SolutionGuid = {C203080A-4473-4CC2-844B-F552EA43D66A}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|||||||
@ -9,8 +9,9 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Artemis.BuiltIn.Module.General</RootNamespace>
|
<RootNamespace>Artemis.BuiltIn.Module.General</RootNamespace>
|
||||||
<AssemblyName>Module.General</AssemblyName>
|
<AssemblyName>Module.General</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@ -65,5 +66,8 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
@ -36,4 +36,4 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user