This project is read-only.
Each argument has a Argument.FullDescription property that can be used to give more information abut the argument to the user.

Because values of these strings can be quite long, it is useful tu store them separately in resource files. Assigning the value of a property from a resource file is no problem when arguments are defined programatically.

However, when you use declarative syntax, the resources cannot be accessed directly, this is simply not possible to compile (CommandlineArguments is the resource class):

[DirectoryArgument('o', "outputDir", Description = "Output directory", FullDescription = CommandlineArguments.ARG_OUTPUTDIR)]
public DirectoryInfo OutputDir { get; set; }

Nevertheless, workaround is provided. Use this declaration instead:

[DirectoryArgument('o', "outputDir", Description = "Output directory", FullDescription = "ARG_OUTPUTDIR")]
public DirectoryInfo OutputDir { get; set; }

When initializing the parser, use these calls:

parser.ExtractArgumentAttributes(this);
parser.FillDescFromResource(new CommandlineArguments());

You will have to manually edit the CommandlineArguments.Designer.cs code-behind file and add the IResource interface to the resource class and implement the only required property like this:

internal class CommandlineArguments : IResource  
{
    // 
    //...
    // 

    ResourceManager IResource.ResourceManager
    {    
        get { return ResourceManager; }
    }
}

Last edited Apr 26, 2009 at 6:43 PM by Trupik, version 1

Comments

No comments yet.