mirror of https://bitbucket.org/anguist/ntpa
Code cleanup
This commit is contained in:
parent
f55fa07a23
commit
b875178758
|
@ -100,6 +100,7 @@ FILES = \
|
|||
Changes/Change03.cs \
|
||||
DatabaseInitializer.cs \
|
||||
DataFace.cs \
|
||||
Import/TimeServers.cs \
|
||||
Import/TimeServerImporter.cs \
|
||||
Import/TimeServerLoader.cs \
|
||||
Log/LogExtensions.cs \
|
||||
|
|
|
@ -87,6 +87,7 @@ FILES = \
|
|||
../Shared/AssemblyInfo.cs \
|
||||
Changes/Change03.cs \
|
||||
DataFace.cs \
|
||||
Import/TimeServers.cs \
|
||||
Import/TimeServerImporter.cs \
|
||||
Import/TimeServerLoader.cs \
|
||||
Log/LogExtensions.cs \
|
||||
|
|
|
@ -91,6 +91,13 @@ internal static void JobInitStart(this LogBase log)
|
|||
log.WriteLine("Initializing jobs.", Severity.Info);
|
||||
}
|
||||
|
||||
internal static void KnownServer(this LogBase log, int id, string name)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Found known time server {name} with id {id} in list.",
|
||||
Severity.Info);
|
||||
}
|
||||
|
||||
internal static void ListenerError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine("Error during initialization of command channels.", Severity.Warn);
|
||||
|
@ -116,13 +123,6 @@ internal static void NewPeer(this LogBase log, AssociationEntry entry)
|
|||
Severity.Info);
|
||||
}
|
||||
|
||||
internal static void KnownServer(this LogBase log, int id, string name)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Found known time server {name} with id {id} in list.",
|
||||
Severity.Info);
|
||||
}
|
||||
|
||||
internal static void NoConfig(this LogBase log, string file)
|
||||
{
|
||||
log.WriteLine($"Cannot find configuration file {file}", Severity.Error);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Ntp.Analyzer.Config.Syntax
|
|||
public abstract class SyntaxNode<T> : ISyntaxNode
|
||||
where T : ConfigurationNode
|
||||
{
|
||||
protected SyntaxNode(Symbol symbol, string name, int line, bool requirePath)
|
||||
protected SyntaxNode(Symbol symbol, string name, int line, bool requirePath = false)
|
||||
{
|
||||
Symbol = symbol;
|
||||
Name = name;
|
||||
|
@ -44,17 +44,12 @@ protected SyntaxNode(Symbol symbol, string name, int line, bool requirePath)
|
|||
errors = new List<string>();
|
||||
}
|
||||
|
||||
protected SyntaxNode(Symbol symbol, string name, int line)
|
||||
: this(symbol, name, line, false)
|
||||
{
|
||||
}
|
||||
|
||||
private readonly List<string> errors;
|
||||
private T compiledNode;
|
||||
|
||||
protected List<ISyntaxNode> Nodes { get; }
|
||||
|
||||
public string Name { get; }
|
||||
protected string Name { get; }
|
||||
|
||||
public Symbol Symbol { get; }
|
||||
|
||||
|
|
Binary file not shown.
|
@ -47,7 +47,7 @@ public static Uri Append(this Uri uri, Uri relativeUri, params string[] paths)
|
|||
string relativeUriText = relativeUri.IsAbsoluteUri
|
||||
? relativeUri.AbsolutePath
|
||||
: relativeUri.ToString();
|
||||
var list = new List<string> { relativeUriText };
|
||||
var list = new List<string> {relativeUriText};
|
||||
list.AddRange(paths);
|
||||
return uri.Append(list.ToArray());
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public static Uri Append(this Uri uri, Uri relativeUri, string path)
|
|||
string relativeUriText = relativeUri.IsAbsoluteUri
|
||||
? relativeUri.AbsolutePath
|
||||
: relativeUri.ToString();
|
||||
var list = new List<string> { relativeUriText, path};
|
||||
var list = new List<string> {relativeUriText, path};
|
||||
return uri.Append(list.ToArray());
|
||||
}
|
||||
|
||||
|
@ -73,33 +73,15 @@ public static Uri AppendExtension(this Uri uri, string extension)
|
|||
return newUri;
|
||||
}
|
||||
|
||||
public static string ToHtmlString(this Uri uri)
|
||||
{
|
||||
return Uri.EscapeUriString(uri.ToString());
|
||||
}
|
||||
|
||||
private static void GetBase(Uri uri, out string basePath, out UriKind uriKind)
|
||||
{
|
||||
string orig = uri.OriginalString.TrimStart();
|
||||
if (orig.StartsWith("/") && !orig.StartsWith("//")) {
|
||||
basePath = uri.IsAbsoluteUri
|
||||
? uri.AbsolutePath
|
||||
: uri.ToString();
|
||||
uriKind = UriKind.Relative;
|
||||
} else {
|
||||
basePath = uri.ToString();
|
||||
uriKind = UriKind.Absolute;
|
||||
}
|
||||
}
|
||||
|
||||
public static string DebugInfo(this Uri uri)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.AppendLine($"ToString(): {uri.ToString()}");
|
||||
b.AppendLine($"ToString(): {uri}");
|
||||
b.AppendLine($"IsAbsoluteUri: {uri.IsAbsoluteUri}");
|
||||
b.AppendLine($"OriginalString: {uri.OriginalString}");
|
||||
|
||||
if (uri.IsAbsoluteUri) {
|
||||
if (uri.IsAbsoluteUri)
|
||||
{
|
||||
b.AppendLine($"AbsolutePath: {uri.AbsolutePath}");
|
||||
b.AppendLine($"AbsoluteUri: {uri.AbsoluteUri}");
|
||||
b.AppendLine($"Authority: {uri.Authority}");
|
||||
|
@ -123,5 +105,27 @@ public static string DebugInfo(this Uri uri)
|
|||
|
||||
return b.ToString();
|
||||
}
|
||||
|
||||
public static string ToHtmlString(this Uri uri)
|
||||
{
|
||||
return Uri.EscapeUriString(uri.ToString());
|
||||
}
|
||||
|
||||
private static void GetBase(Uri uri, out string basePath, out UriKind uriKind)
|
||||
{
|
||||
string orig = uri.OriginalString.TrimStart();
|
||||
if (orig.StartsWith("/") && !orig.StartsWith("//"))
|
||||
{
|
||||
basePath = uri.IsAbsoluteUri
|
||||
? uri.AbsolutePath
|
||||
: uri.ToString();
|
||||
uriKind = UriKind.Relative;
|
||||
}
|
||||
else
|
||||
{
|
||||
basePath = uri.ToString();
|
||||
uriKind = UriKind.Absolute;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -116,12 +116,12 @@ internal static void SchemaVersionError(this LogBase log, int database, int appl
|
|||
|
||||
log.WriteLine(
|
||||
$"Application version is {application} but database version is {database}.",
|
||||
Severity.Error);
|
||||
Severity.Error);
|
||||
|
||||
if (database > application)
|
||||
{
|
||||
log.WriteLine("Update NTP Analyzer to resolve this problem.", Severity.Info);
|
||||
}
|
||||
}
|
||||
else if (database < application)
|
||||
{
|
||||
log.WriteLine("Upgrade your database to resolve this problem.", Severity.Info);
|
||||
|
|
|
@ -25,4 +25,4 @@
|
|||
[assembly: AssemblyVersion("0.7.7.0")]
|
||||
[assembly: AssemblyCopyright("Copyright (c) 2013-2016 Carsten Sonne Larsen <cs@innolan.dk>")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: ComVisible(false)]
|
Loading…
Reference in New Issue