mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 14:02:03 +00:00
- code refactoring
- made more and more easily extensible: * commands automatically loaded from plugins dlls * declarative and automatic command parameter parsing * common code moved to base classes - other fixes svn path=/trunk/; revision=33344
This commit is contained in:
parent
e3407fdd9c
commit
d7b2077ed8
42 changed files with 2263 additions and 1689 deletions
35
irc/TechBot/TechBot.Library/Attributes/CommandAttribute.cs
Normal file
35
irc/TechBot/TechBot.Library/Attributes/CommandAttribute.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
public class CommandAttribute : Attribute
|
||||
{
|
||||
private string m_Name = null;
|
||||
private string m_Help = "No help for this command is available";
|
||||
private string m_Desc = "No description for this command is available";
|
||||
|
||||
public CommandAttribute(string name)
|
||||
{
|
||||
m_Name = name;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return m_Name; }
|
||||
}
|
||||
|
||||
public string Help
|
||||
{
|
||||
get { return m_Help; }
|
||||
set { m_Help = value; }
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return m_Desc; }
|
||||
set { m_Desc = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// This class implements an alias attribute to work in conjunction
|
||||
/// with the <see cref="CommandLineSwitchAttribute">CommandLineSwitchAttribute</see>
|
||||
/// attribute. If the CommandLineSwitchAttribute exists, then this attribute
|
||||
/// defines an alias for it.
|
||||
/// </summary>
|
||||
[AttributeUsage( AttributeTargets.Property )]
|
||||
public class CommandParameterAliasAttribute : Attribute
|
||||
{
|
||||
#region Private Variables
|
||||
protected string m_Alias = "";
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
public string Alias
|
||||
{
|
||||
get { return m_Alias; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public CommandParameterAliasAttribute(string alias)
|
||||
{
|
||||
m_Alias = alias;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
/// <summary>Implements a basic command-line switch by taking the
|
||||
/// switching name and the associated description.</summary>
|
||||
/// <remark>Only currently is implemented for properties, so all
|
||||
/// auto-switching variables should have a get/set method supplied.</remark>
|
||||
[AttributeUsage( AttributeTargets.Property )]
|
||||
public class CommandParameterAttribute : Attribute
|
||||
{
|
||||
#region Private Variables
|
||||
private string m_name = "";
|
||||
private string m_description = "";
|
||||
private bool m_Required = true;
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
/// <summary>Accessor for retrieving the switch-name for an associated
|
||||
/// property.</summary>
|
||||
public string Name { get { return m_name; } }
|
||||
|
||||
/// <summary>Accessor for retrieving the description for a switch of
|
||||
/// an associated property.</summary>
|
||||
public string Description { get { return m_description; } }
|
||||
|
||||
public bool Required { get { return m_Required; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Attribute constructor.
|
||||
/// </summary>
|
||||
public CommandParameterAttribute(string name, string description)
|
||||
{
|
||||
m_name = name;
|
||||
m_description = description;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue