diff --git a/VAR.Toolbox.TestPlugin/FrmTestPlugin.Designer.cs b/VAR.Toolbox.TestPlugin/FrmTestPlugin.Designer.cs
new file mode 100644
index 0000000..07361ae
--- /dev/null
+++ b/VAR.Toolbox.TestPlugin/FrmTestPlugin.Designer.cs
@@ -0,0 +1,39 @@
+namespace VAR.Toolbox.TestPlugin
+{
+ partial class FrmTestPlugin
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "FrmTestPlugin";
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/VAR.Toolbox.TestPlugin/FrmTestPlugin.cs b/VAR.Toolbox.TestPlugin/FrmTestPlugin.cs
new file mode 100644
index 0000000..a55c0a4
--- /dev/null
+++ b/VAR.Toolbox.TestPlugin/FrmTestPlugin.cs
@@ -0,0 +1,17 @@
+using System.Windows.Forms;
+using VAR.Toolbox.UI;
+
+namespace VAR.Toolbox.TestPlugin
+{
+ public partial class FrmTestPlugin : Form, IToolForm
+ {
+ public FrmTestPlugin()
+ {
+ InitializeComponent();
+ }
+
+ public string ToolName { get { return "Test"; } }
+
+ public bool HasIcon { get { return false; } }
+ }
+}
diff --git a/VAR.Toolbox.TestPlugin/Notes.md b/VAR.Toolbox.TestPlugin/Notes.md
new file mode 100644
index 0000000..5f428e5
--- /dev/null
+++ b/VAR.Toolbox.TestPlugin/Notes.md
@@ -0,0 +1,13 @@
+## Preparation
+
+* Build as class library.
+* Add reference to ```VAR.Toolbox``` for interface declarations and utilities.
+* Use the interfaces to extend functionality:
+ * ```IToolForm```: Tool window.
+ * ```IToolPanel```: Tool panels in the main window. Try to fit all on 200px width.
+ * ```ITextCoder```: Text codification clases.
+ * ```IProxyCmdExecutor```: Proxy command executors, mainly for remote executions.
+
+## Usage
+
+Put the generated assembly near ```VAR.Toolbox.exe``` it will load as plug-ins any assembly that starts with ```VAR.Toolbox```
\ No newline at end of file
diff --git a/VAR.Toolbox.TestPlugin/Properties/AssemblyInfo.cs b/VAR.Toolbox.TestPlugin/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..a046fc6
--- /dev/null
+++ b/VAR.Toolbox.TestPlugin/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+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("VAR.Toolbox.TestPlugin")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("VAR.Toolbox.TestPlugin")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[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("74fe172a-d63c-460e-b15f-debf4150bab1")]
+
+// 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")]
diff --git a/VAR.Toolbox.TestPlugin/VAR.Toolbox.TestPlugin.csproj b/VAR.Toolbox.TestPlugin/VAR.Toolbox.TestPlugin.csproj
new file mode 100644
index 0000000..f673a4b
--- /dev/null
+++ b/VAR.Toolbox.TestPlugin/VAR.Toolbox.TestPlugin.csproj
@@ -0,0 +1,64 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {74FE172A-D63C-460E-B15F-DEBF4150BAB1}
+ Library
+ Properties
+ VAR.Toolbox.TestPlugin
+ VAR.Toolbox.TestPlugin
+ v4.7.2
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ FrmTestPlugin.cs
+
+
+
+
+
+ {e8dab98d-4fd0-4d40-b29a-62b4c2fca4d7}
+ VAR.Toolbox
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VAR.Toolbox.sln b/VAR.Toolbox.sln
index ebd7f2d..139bfb0 100644
--- a/VAR.Toolbox.sln
+++ b/VAR.Toolbox.sln
@@ -1,10 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28917.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.Toolbox", "VAR.Toolbox\VAR.Toolbox.csproj", "{E8DAB98D-4FD0-4D40-B29A-62B4C2FCA4D7}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.Toolbox.TestPlugin", "VAR.Toolbox.TestPlugin\VAR.Toolbox.TestPlugin.csproj", "{74FE172A-D63C-460E-B15F-DEBF4150BAB1}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,8 +17,15 @@ Global
{E8DAB98D-4FD0-4D40-B29A-62B4C2FCA4D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8DAB98D-4FD0-4D40-B29A-62B4C2FCA4D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8DAB98D-4FD0-4D40-B29A-62B4C2FCA4D7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {74FE172A-D63C-460E-B15F-DEBF4150BAB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {74FE172A-D63C-460E-B15F-DEBF4150BAB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {74FE172A-D63C-460E-B15F-DEBF4150BAB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {74FE172A-D63C-460E-B15F-DEBF4150BAB1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {08F0DAFF-33C5-4164-9454-62623789F7EB}
+ EndGlobalSection
EndGlobal
diff --git a/VAR.Toolbox/Program.cs b/VAR.Toolbox/Program.cs
index a1f7037..8c87c0e 100644
--- a/VAR.Toolbox/Program.cs
+++ b/VAR.Toolbox/Program.cs
@@ -1,4 +1,8 @@
using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
using System.Windows.Forms;
using VAR.Toolbox.Code;
using VAR.Toolbox.UI;
@@ -15,6 +19,13 @@ namespace VAR.Toolbox
{
Application.ThreadException += Application_ThreadException;
+ // Load plug-ins
+ string executingAssemblyPath = Assembly.GetExecutingAssembly().Location;
+ string dirName = Path.GetDirectoryName(executingAssemblyPath);
+ string execName = Path.GetFileNameWithoutExtension(executingAssemblyPath);
+ string[] assemblyPaths = Directory.GetFiles(dirName, string.Format("{0}*.dll", execName));
+ foreach (string assemblyPath in assemblyPaths) { AssemblyLoadFull(assemblyPath); }
+
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try
@@ -33,5 +44,36 @@ namespace VAR.Toolbox
Logger.Log(e.Exception);
Application.Exit();
}
+
+ private static Assembly AssemblyLoadFull(string fullPath, List allAssemblyNames = null)
+ {
+ if (allAssemblyNames == null)
+ {
+ allAssemblyNames = AppDomain.CurrentDomain.GetAssemblies().Select(a => a.GetName().Name).ToList();
+ }
+ Assembly asm = null;
+ try
+ {
+ asm = Assembly.LoadFrom(fullPath);
+ }
+ catch (Exception) { }
+ if (asm == null) { return null; }
+ allAssemblyNames.Add(asm.GetName().Name);
+
+ // Load dependencies
+ string dirPath = Path.GetDirectoryName(fullPath);
+ AssemblyName[] asmNames = asm.GetReferencedAssemblies();
+ foreach (AssemblyName asmName in asmNames)
+ {
+ if (allAssemblyNames.Contains(asmName.Name) == false)
+ {
+ string fullPathAux = string.Format("{0}/{1}.dll", dirPath, asmName.Name);
+ Assembly asmAux = AssemblyLoadFull(fullPathAux, allAssemblyNames);
+ }
+ }
+
+ return asm;
+ }
+
}
}