git_bsmd/nsw/Source/bsmd.Tool/Program.cs

55 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using log4net;
namespace bsmd.Tool
{
class Program
{
private static ILog log = LogManager.GetLogger("Tool");
static int Main(string[] args)
{
log4net.Config.XmlConfigurator.Configure();
Options options = new Options();
if (CommandLine.Parser.Default.ParseArguments(args, options))
{
try
{
if (options.CheckRules)
{
Guid coreId;
if (Guid.TryParse(options.MessageCoreId, out coreId))
{
CheckRules.Check(coreId);
}
else
{
Console.WriteLine("cannot parse message core id");
log.FatalFormat("CheckRules: cannot parse message core id");
}
}
else
{
// .. anderes
}
return 0;
}
catch (Exception ex)
{
log.ErrorFormat("an exception occurred: {0}", ex.Message);
return 1;
}
}
else
{
Console.WriteLine(options.GetUsage());
return 1;
}
}
}
}