Get list of all Classes using Interface.
Is there a way i can get a list of all the classes using this interface?
Here is a class using it:
Also is there a way i can create a instance of every class using IConsoleCommand?
public interface IConsoleCommand
{
string CommandWord { get;
}
bool Process (string[] args);
} public interface IConsoleCommand
{
string CommandWord { get;
}
bool Process (string[] args);
}Here is a class using it:
public class ExampleCommand : IConsoleCommand
{
public string CommandWord { get; } = "example";
public bool Process(string[] args)
{
//Run fancy code here!
//Make sure if the execution of your command was successfull => return true;
//else => return false;
//kind of like this:
if(args.Length == 0 || args == null)
{
MaumConsole.instance.Error("Missing Argument(s)", CommandWord);
return false; // This is optional. Just checking if user entered arguments!
}
if (args[0].Equals("pls", StringComparison.OrdinalIgnoreCase))
{
// yay the entered command was "[prefix][CommandWord] pls" and now i will help by sending some cool data > Debug.log();
MaumConsole.instance.Log("Yay you ran the example command!",CommandWord);
return true;
}
else
{
//oh no
MaumConsole.instance.Error("Wrong Argument(s)",CommandWord);
return false;
}
}
} public class ExampleCommand : IConsoleCommand
{
public string CommandWord { get; } = "example";
public bool Process(string[] args)
{
//Run fancy code here!
//Make sure if the execution of your command was successfull => return true;
//else => return false;
//kind of like this:
if(args.Length == 0 || args == null)
{
MaumConsole.instance.Error("Missing Argument(s)", CommandWord);
return false; // This is optional. Just checking if user entered arguments!
}
if (args[0].Equals("pls", StringComparison.OrdinalIgnoreCase))
{
// yay the entered command was "[prefix][CommandWord] pls" and now i will help by sending some cool data > Debug.log();
MaumConsole.instance.Log("Yay you ran the example command!",CommandWord);
return true;
}
else
{
//oh no
MaumConsole.instance.Error("Wrong Argument(s)",CommandWord);
return false;
}
}
}Also is there a way i can create a instance of every class using IConsoleCommand?