Cleaned ScriptRunner

This commit is contained in:
Fábio Ferreira 2020-10-15 15:39:08 +01:00
parent c0c2b5f955
commit 066566ba59
2 changed files with 67 additions and 10 deletions

55
OTDPlugins.sln Normal file
View file

@ -0,0 +1,55 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30309.148
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OemKill", "OemKill\OemKill.csproj", "{4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TouchEmu", "TouchEmu\TouchEmu.csproj", "{FC135341-4870-4555-8917-7248CFE07FCC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsInk", "WindowsInk\WindowsInk.csproj", "{5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VMultiMode", "VMultiMode\VMultiMode.csproj", "{7D086384-9E50-45A1-BD7A-ECF44CB31223}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeL", "MeL\MeL.csproj", "{F0931C43-4A63-4CDB-9B5F-A8DC50557109}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScriptRunner", "ScriptRunner\ScriptRunner.csproj", "{0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Release|Any CPU.Build.0 = Release|Any CPU
{FC135341-4870-4555-8917-7248CFE07FCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC135341-4870-4555-8917-7248CFE07FCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC135341-4870-4555-8917-7248CFE07FCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC135341-4870-4555-8917-7248CFE07FCC}.Release|Any CPU.Build.0 = Release|Any CPU
{5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Release|Any CPU.Build.0 = Release|Any CPU
{7D086384-9E50-45A1-BD7A-ECF44CB31223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D086384-9E50-45A1-BD7A-ECF44CB31223}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D086384-9E50-45A1-BD7A-ECF44CB31223}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D086384-9E50-45A1-BD7A-ECF44CB31223}.Release|Any CPU.Build.0 = Release|Any CPU
{F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Release|Any CPU.Build.0 = Release|Any CPU
{0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2BABACBE-E6E4-4641-BD76-927BFF428316}
EndGlobalSection
EndGlobal

View file

@ -11,13 +11,13 @@ namespace ScriptRunner
{
internal static class ScriptRunnerHelper
{
public static Dictionary<int, string> ScriptPathList = new Dictionary<int, string>();
public static List<string> ScriptPathList = Enumerable.Repeat("", 10).ToList();
}
[PluginName("Script Runner")]
public class ScriptRunner : ITool, IValidateBinding, IBinding
{
public Dictionary<int, string> ScriptPathList = ScriptRunnerHelper.ScriptPathList;
public List<string> ScriptPathList = ScriptRunnerHelper.ScriptPathList;
public string[] ValidProperties
{
get
@ -31,23 +31,25 @@ namespace ScriptRunner
}
}
public string Property { set; get; }
public Action Press => (Action)(() => RunScript(ScriptPathList[Int32.Parse(Property)]) );
public Action Press => (Action)(() => RunScript(ScriptPathList[Int32.Parse(Property)]));
private void RunScript(string path)
{
//TODO: distinguish between platforms
new Process
try
{
StartInfo = new ProcessStartInfo(path)
new Process
{
UseShellExecute = true
}
}.Start();
StartInfo = new ProcessStartInfo(path)
{
UseShellExecute = true
}
}.Start();
}
catch { }
}
public Action Release => (Action)(() => { });
public bool Initialize() { return true; }
public void Dispose() { }
//TODO: make this dynamic
[Property("Script Path 0")]
public string ScriptPath0
{