Conforming stdout and stderr messages

This commit is contained in:
Dimitar Byalkov
2021-07-12 17:35:55 +03:00
parent 07fe1a8e26
commit 238ac39175
5 changed files with 14 additions and 15 deletions

View File

@@ -41,7 +41,7 @@ namespace BoerseDataConvert
warning = new WarningStat(fileName);
cur_fileName = fileName.Split('.').First();
count = 1;
Console.WriteLine(cur_fileName + " start");
Console.WriteLine($"INFO: Converting {cur_fileName}");
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.CheckCharacters = false;
@@ -89,7 +89,7 @@ namespace BoerseDataConvert
{
if (tagsTable.CheckStringLengthToBig(tag, value.Length))
{
Console.WriteLine($"WARN: Too long value \"{tag}\", \"{value}\", max allowed \"{tagsTable.GetTagName(tag)}\", {cur_fileName} line {count + 1}");
Console.Error.WriteLine($"WARN: Too long value \"{tag}\", \"{value}\", max allowed \"{tagsTable.GetTagName(tag)}\", {cur_fileName} line {count + 1}");
return null;
}
}
@@ -102,7 +102,7 @@ namespace BoerseDataConvert
}
catch (FormatException)
{
Console.WriteLine($"WARN: Value is not in a valid format for number \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
Console.Error.WriteLine($"WARN: Value is not in a valid format for number \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
return null;
}
}
@@ -111,7 +111,7 @@ namespace BoerseDataConvert
{
if (!tagsTable.CheckValidValue(tag, value))
{
Console.WriteLine($"WARN: Value not in range \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
Console.Error.WriteLine($"WARN: Value not in range \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
return null;
}
}

View File

@@ -30,16 +30,16 @@ namespace BoerseDataConvert
{
if (tableWarnings.Count == 0)
{
Console.WriteLine($"There is no warnings in file {curFile}");
Console.WriteLine($"INFO: No warnings in {curFile}");
}
else
{
Console.WriteLine($"Warnings in file {curFile}");
Console.WriteLine($"INFO: Warnings in {curFile}");
foreach (var warning in tableWarnings)
{
int tag = warning.Key;
int count = warning.Value;
Console.WriteLine($"Invalid tag \"{tag}\": {count} times.");
Console.WriteLine($"INFO: Invalid tag \"{tag}\": {count} times.");
}
}
}

View File

@@ -88,7 +88,7 @@ namespace BoerseDataConvert
break;
}
}
Console.WriteLine("INFO: Success, exiting");
Console.WriteLine("INFO: Successful conversion, exiting");
Environment.Exit(0);
}
static void CheckFreeDisk(string zipFile, string outputDirectory)

View File

@@ -26,7 +26,7 @@ namespace BoerseDataConvert
string s = reader.ReadLine();
if (s.Substring(0, 11) == "Datensaetze")
{
Console.WriteLine($"File{ filesNames[fileInd]}.xml was converted successfully");
Console.WriteLine($"INFO: { filesNames[fileInd] } was converted successfully");
fileInd++;
EndFile();
reader = new StreamReader($@"{adr}/{filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252));