Extra Attributes
Quantum Console comes with extra, non essential attributes designed to make your life using QC easier.
[CommandPrefix]
By using the [CommandPrefix] attribute on a class, you can easily add an attribute to all of the commands declared inside of it.
using QFSW.QC;
[CommandPrefix("test.")]
public static class MyClass
{
[Command("foo1")]
private static void Foo1() { }
[Command("foo2")]
private static void Foo2() { }
}
This example code would produce 2 commands, test.foo1 and test.foo2. This can be very useful for grouping together commands.
If no name is supplied, then just like [Command], it can use the caller name.
using QFSW.QC;
[CommandPrefix]
public static class MyClass
{
[Command]
private static void Foo1() { }
[Command]
private static void Foo2() { }
}
This will yield the commands MyClassFoo1 and MyClassFoo2.
The attribute also works with nested classes, and with multiple attributes on the same class.
using QFSW.QC;
[CommandPrefix("test1.")]
[CommandPrefix("test2.")]
public static class MyClass
{
[CommandPrefix("a.")]
private static class MyClass1
{
[Command("foo")]
private static void Foo() { }
}
[CommandPrefix("b.")]
private static class MyClass2
{
[Command("foo")]
private static void Foo() { }
}
}
This will yield the commands test1.test2.a.foo and test1.test2.b.foo
Command prefixes can also be applied to entire assemblies
using QFSW.QC;
[assembly: CommandPrefix("assembly.")]
[CommandPrefix("class1.")]
public static class MyClass1
{
[Command("foo1")]
private static void Foo1() { }
[Command("foo2")]
private static void Foo2() { }
}
[CommandPrefix("class2.")]
public static class MyClass2
{
[Command("foo1")]
private static void Foo1() { }
[Command("foo2")]
private static void Foo2() { }
}
This will yield the commands assembly.class1.foo1, assembly.class1.foo2, assembly.class2.foo1 and assembly.class2.foo2
[QcIgnore]
This attribute can be applied to any class or assembly and will instruct the Quantum Console Processor to ignore it when scanning for commands - this can be used to speed up the table generation if necessary