mirror of
https://bitbucket.org/anguist/ntpa
synced 2025-10-05 18:41:13 +00:00
Code cleanup
This commit is contained in:
@ -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 @@ namespace Ntp.Analyzer.Process.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 @@ namespace Ntp.Analyzer.Process.Log
|
||||
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 @@ namespace Ntp.Analyzer.Config.Syntax
|
||||
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; }
|
||||
|
||||
|
BIN
Ntp.Common/GlobalSuppressions.cs
Normal file
BIN
Ntp.Common/GlobalSuppressions.cs
Normal file
Binary file not shown.
@ -47,7 +47,7 @@ namespace Ntp.Common.Web
|
||||
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 @@ namespace Ntp.Common.Web
|
||||
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 @@ namespace Ntp.Common.Web
|
||||
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 @@ namespace Ntp.Common.Web
|
||||
|
||||
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,7 +116,7 @@ namespace Ntp.Data.Log
|
||||
|
||||
log.WriteLine(
|
||||
$"Application version is {application} but database version is {database}.",
|
||||
Severity.Error);
|
||||
Severity.Error);
|
||||
|
||||
if (database > application)
|
||||
{
|
||||
|
Reference in New Issue
Block a user