59 lines
1.8 KiB
C#
59 lines
1.8 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 if((options.CleanupFolderRoot != null) && (options.CleanupFolderRoot.Length > 0))
|
|
{
|
|
CleanupFiles.Cleanup(options.CleanupFolderRoot, options.StaleDays, options.CleanupRecursive);
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
return 0;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.ErrorFormat("an exception occurred: {0}", ex.Message);
|
|
return 1;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine(options.GetUsage());
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
}
|