|
// -- FILE ------------------------------------------------------------------
// name : ApplicationArguments.cs
// project : System Framelet
// created : Jani Giannoudis - 2008.06.03
// language : c#
// environment: .NET 2.0
// copyright : (c) 2004-2013 by Jani Giannoudis, Switzerland
// --------------------------------------------------------------------------
using System;
namespace Itenso.Sys.Application
{
// ------------------------------------------------------------------------
public class ApplicationArguments
{
// ----------------------------------------------------------------------
public ArgumentCollection Arguments
{
get { return arguments; }
} // Arguments
// ----------------------------------------------------------------------
public bool IsValid
{
get { return arguments.IsValid; }
} // IsValid
// ----------------------------------------------------------------------
public bool IsHelpMode
{
get
{
foreach ( IArgument argument in arguments )
{
if ( argument is HelpModeArgument )
{
return (bool)argument.Value;
}
}
return false;
}
} // IsHelpMode
// ----------------------------------------------------------------------
public void Load()
{
string[] commandLineArgs = Environment.GetCommandLineArgs();
// skip zeron index which contians the program name
for ( int i = 1; i < commandLineArgs.Length; i++ )
{
string commandLineArg = commandLineArgs[ i ];
foreach ( IArgument argument in arguments )
{
if ( argument.IsLoaded )
{
continue;
}
argument.Load( commandLineArg );
if ( argument.IsLoaded )
{
break;
}
}
}
} // Load
// ----------------------------------------------------------------------
// members
private readonly ArgumentCollection arguments = new ArgumentCollection();
} // class ApplicationArguments
} // namespace Itenso.Sys.Application
// -- EOF -------------------------------------------------------------------
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
👨 Senior .NET Software Engineer
🚀 My Open Source Projects
-
Time Period Library 👉
GitHub
-
Payroll Engine 👉
GitHub
Feedback and contributions are welcome.