mirror of
https://bitbucket.org/anguist/ntpa
synced 2025-10-05 10:30:56 +00:00
Code cleanup
This commit is contained in:
@ -21,6 +21,6 @@
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("0.7.1.0")]
|
||||
[assembly: AssemblyVersion("0.7.2.0")]
|
||||
[assembly: AssemblyCopyright("Copyright (c) 2013-2016 Carsten Sonne Larsen <cs@innolan.dk>")]
|
||||
[assembly: AssemblyCulture("")]
|
@ -23,7 +23,6 @@ using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using Ntp.Analyzer.Common;
|
||||
using Ntp.Analyzer.Process;
|
||||
using Ntp.Common.IO;
|
||||
using Ntp.Common.Log;
|
||||
@ -33,54 +32,41 @@ namespace Ntp.Analyzer.Cli
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
private static bool usage;
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// Neutralize.
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
|
||||
string name = "ntpa";
|
||||
string tempDir = Directory.GetCurrentDirectory();
|
||||
string configFile = null;
|
||||
string pidFile = null;
|
||||
bool exit = false;
|
||||
|
||||
LogGroup initlog = LogFactory.CreateErrorLog(name);
|
||||
var initlog = LogFactory.CreateErrorLog(name);
|
||||
initlog.Add(LogFactory.CreateSysLog(name));
|
||||
|
||||
var p = new OptionSet
|
||||
{
|
||||
{
|
||||
"h|?|help", v =>
|
||||
{
|
||||
ShowUsage();
|
||||
exit = true;
|
||||
}
|
||||
},
|
||||
{
|
||||
"daemon=", v => { name = v; }
|
||||
},
|
||||
{
|
||||
"config=", v => { configFile = v; }
|
||||
},
|
||||
{
|
||||
"writepid=", v => { pidFile = v; }
|
||||
},
|
||||
{
|
||||
"temp=", v => { tempDir = v; }
|
||||
}
|
||||
{"h|?|help", v => { ShowUsage(); }},
|
||||
{"daemon=", v => { name = v; }},
|
||||
{"config=", v => { configFile = v; }},
|
||||
{"writepid=", v => { pidFile = v; }},
|
||||
{"temp=", v => { tempDir = v; }}
|
||||
};
|
||||
|
||||
string[] rem = p.Parse(args).ToArray();
|
||||
var rem = p.Parse(args).ToArray();
|
||||
|
||||
if (exit)
|
||||
if (usage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (rem.Length > 0)
|
||||
{
|
||||
initlog.WriteLine("Unknown option: " + rem[0], Severity.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (configFile == null)
|
||||
{
|
||||
initlog.WriteLine("Please specify configuration file with option --config", Severity.Error);
|
||||
@ -104,8 +90,9 @@ namespace Ntp.Analyzer.Cli
|
||||
|
||||
private static void ShowUsage()
|
||||
{
|
||||
Console.WriteLine("NTP Analyzer " + VersionInfo.Text);
|
||||
Console.WriteLine("NTP Analyzer v0.7.2");
|
||||
Console.WriteLine("Usage: ntpa --config file [--temp dir] [--writepid file] [--daemon name]");
|
||||
usage = true;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user