diff --git a/FrmServerController.cs b/FrmServerController.cs
index c0f7dac..8b4a2c4 100644
--- a/FrmServerController.cs
+++ b/FrmServerController.cs
@@ -18,6 +18,7 @@
using System.Threading.Tasks;
using System.Windows.Forms;
+
namespace PteroController
{
public partial class FrmServerController : Form
diff --git a/Program.cs b/Program.cs
index 7581501..9d55405 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,5 +1,6 @@
using System;
using System.Linq;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
@@ -20,7 +21,8 @@ static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- //EXAMPLE OF A CLI COMMAND
+
+ // EXAMPLE OF A CLI COMMAND
if (args.Contains("-version"))
{
AttachConsole(ATTACH_PARENT_PROCESS);
@@ -32,7 +34,35 @@ static void Main(string[] args)
Console.WriteLine("Press any key to exit");
}
- Application.Run(new FrmLogin());
+ if(args.Contains("-debug"))
+ {
+ AttachConsole(ATTACH_PARENT_PROCESS);
+ Console.Title = "PteroController | CLI";
+ Console.WriteLine("@echo off");
+ Console.Clear();
+ Console.WriteLine("PteroController version " + appversion + " by MythicalSystems");
+ Console.WriteLine("");
+ Console.WriteLine("DEBUG MODE ACTIVE");
+ Console.WriteLine("Please do not use this mode if you are not a developer");
+ try
+ {
+ PteroControllerLoader pluginLoader = new PteroControllerLoader();
+ pluginLoader.LoadPlugins();
+ Application.Run(new FrmLogin());
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("An error occurred: " + ex.Message);
+ }
+ return;
+ }
+ else
+ {
+ PteroControllerLoader pluginLoader = new PteroControllerLoader();
+ pluginLoader.LoadPlugins();
+ Application.Run(new FrmLogin());
+ }
+
}
}
}
diff --git a/PteroController.csproj b/PteroController.csproj
index 319548d..3c4c761 100644
--- a/PteroController.csproj
+++ b/PteroController.csproj
@@ -305,6 +305,7 @@
+
FrmAlert.cs
diff --git a/PteroControllerLoader.cs b/PteroControllerLoader.cs
new file mode 100644
index 0000000..ab013b1
--- /dev/null
+++ b/PteroControllerLoader.cs
@@ -0,0 +1,124 @@
+//
+// PteroController | PluginLoader
+//
+// HI THERE THANKS FOR CHECKING THIS FILE OUT!
+// IF YOU ARE LOOKING FOR THE DEAFULT CODE TO MAKE A PLUGIN HERE YOU GO:
+/*
+using System;
+
+namespace PteroControllerPlugin
+{
+ public class PluginInit
+ {
+ private string _name = "ExamplePlugin";
+ private string _version = "1.0.0";
+ private string _author = "NaysKutzu";
+
+ public string Name
+ {
+ get { return _name; }
+ }
+
+ public string Version
+ {
+ get { return _version; }
+ }
+
+ public string Author
+ {
+ get { return _author; }
+ }
+
+ public PluginInit()
+ {
+ sayhello();
+ }
+
+ private void sayhello()
+ {
+ Console.WriteLine("Hello, World from plugin!");
+ }
+ }
+}
+*/
+// WARNING: DO NOT EDIT THE NAMESPACE OR THE PluginInit name this will not load on another pc!
+using System;
+using System.CodeDom.Compiler;
+using System.IO;
+using System.Reflection;
+using Microsoft.CSharp;
+
+namespace PteroController
+{
+ public class PluginInfo
+ {
+ public string Name { get; set; }
+ public string Version { get; set; }
+ public string Author { get; set; }
+ }
+
+ public class PteroControllerLoader
+ {
+ private const string FolderPath = "plugins";
+
+ public void CheckAndCreatePluginFolder()
+ {
+ if (!Directory.Exists(FolderPath))
+ {
+ Directory.CreateDirectory(FolderPath);
+ Console.WriteLine("Plugin folder created successfully.");
+ }
+ }
+
+ public void LoadPlugins()
+ {
+ CheckAndCreatePluginFolder();
+
+ string[] files = Directory.GetFiles(FolderPath, "*.cs");
+ foreach (string file in files)
+ {
+ string fileContent = File.ReadAllText(file);
+
+ CSharpCodeProvider codeProvider = new CSharpCodeProvider();
+ CompilerParameters compilerParameters = new CompilerParameters();
+ compilerParameters.GenerateInMemory = true;
+
+ CompilerResults compilerResults = codeProvider.CompileAssemblyFromSource(compilerParameters, fileContent);
+ if (compilerResults.Errors.HasErrors)
+ {
+ foreach (CompilerError error in compilerResults.Errors)
+ {
+ Console.WriteLine($"Error in file {Path.GetFileName(file)} at line {error.Line}: {error.ErrorText}");
+ }
+ }
+ else
+ {
+ Console.WriteLine($"File {Path.GetFileName(file)} compiled successfully.");
+ Assembly compiledAssembly = compilerResults.CompiledAssembly;
+ Type pluginType = compiledAssembly.GetType("PteroControllerPlugin.PluginInit");
+ object pluginInstance = Activator.CreateInstance(pluginType);
+ PluginInfo pluginInfo = GetPluginInfo(pluginInstance);
+ Console.WriteLine($"Loaded plugin: {pluginInfo.Name} (Version: {pluginInfo.Version}, Author: {pluginInfo.Author})");
+ }
+ }
+ }
+
+ private PluginInfo GetPluginInfo(object pluginInstance)
+ {
+ Type pluginType = pluginInstance.GetType();
+
+ PropertyInfo nameProperty = pluginType.GetProperty("Name");
+ PropertyInfo versionProperty = pluginType.GetProperty("Version");
+ PropertyInfo authorProperty = pluginType.GetProperty("Author");
+
+ PluginInfo pluginInfo = new PluginInfo
+ {
+ Name = nameProperty?.GetValue(pluginInstance)?.ToString(),
+ Version = versionProperty?.GetValue(pluginInstance)?.ToString(),
+ Author = authorProperty?.GetValue(pluginInstance)?.ToString()
+ };
+
+ return pluginInfo;
+ }
+ }
+}
diff --git a/README.md b/README.md
index 29573e0..41eff3f 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,9 @@ No currently the app is still in development, and we don't provide themes yet bu
### Im a developer where can i find the BunifUI files?
Well we are using a cracked version of BunifUI and we wont provide the files on the repo but if you need them dm `NaysKutzu#5375` on discord
+### How can i develop my own plugin?
+Well to make your own plugin for PteroController you will have to have some knowledge of c# and .net and if you alertly know all of that here you can find a the [documentation](https://docs.mythicalsystems.tech/PteroController/HowToMakeAPlugin)
+
## Authors
- [@NaysKutzu](https://github.com/NaysKutzu)
diff --git a/bin/Release/PteroController.exe b/bin/Release/PteroController.exe
index d47ece3..c0335e4 100644
Binary files a/bin/Release/PteroController.exe and b/bin/Release/PteroController.exe differ
diff --git a/bin/Release/PteroController.pdb b/bin/Release/PteroController.pdb
index b42067c..7329bc0 100644
Binary files a/bin/Release/PteroController.pdb and b/bin/Release/PteroController.pdb differ
diff --git a/bin/Release/plugins/ExamplePlugin.cs b/bin/Release/plugins/ExamplePlugin.cs
new file mode 100644
index 0000000..3b66577
--- /dev/null
+++ b/bin/Release/plugins/ExamplePlugin.cs
@@ -0,0 +1,37 @@
+// WARNING: DO NOT EDIT THE NAMESPACE OR THE PluginInit name this will not load on another pc!
+using System;
+
+namespace PteroControllerPlugin
+{
+ public class PluginInit
+ {
+ private string _name = "ExamplePlugin";
+ private string _version = "1.0.0";
+ private string _author = "NaysKutzu";
+
+ public string Name
+ {
+ get { return _name; }
+ }
+
+ public string Version
+ {
+ get { return _version; }
+ }
+
+ public string Author
+ {
+ get { return _author; }
+ }
+
+ public PluginInit()
+ {
+ sayhello();
+ }
+
+ private void sayhello()
+ {
+ Console.WriteLine("Hello, World from plugin!");
+ }
+ }
+}