CommandLineSwitchAttribute.cs :  » Bloggers » dasBlog » RJH » CommandLineHelper » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Bloggers » dasBlog 
dasBlog » RJH » CommandLineHelper » CommandLineSwitchAttribute.cs
// Original code borrowed from Ray Hayes and downloaded from 
// http://www.codeproject.com/csharp/commandlineparser.asp.

// Revisions
// 1. Updates were made to support double quotes.
//
// Note, this should probably be moved to it's own GDN workspace and then the
// DLL be referenced in this workspace.  However, there is a similar workspace
// called Eas.Console that serves a similar purpose and should be investigated
// before another command line parser workspace is created.

using System;

namespace RJH.CommandLineHelper{
  /// <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 CommandLineSwitchAttribute : System.Attribute
  {
    #region Private Variables
    private string m_name = "";
    private string m_description = "";
    #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; } }

    #endregion

    #region Constructors
    /// <summary>Attribute constructor.</summary>
    public CommandLineSwitchAttribute( string name,
                            string description )
    {
      m_name = name;
      m_description = description;
    }
    #endregion
  }

  /// <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 CommandLineAliasAttribute : System.Attribute
  {
    #region Private Variables
    protected string m_Alias = "";
    #endregion

    #region Public Properties
    public string Alias 
    {
      get { return m_Alias; }
    }

    #endregion

    #region Constructors
    public CommandLineAliasAttribute( string alias ) 
    {
      m_Alias = alias;
    }
    #endregion
  }

}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.