Update RecordController.cs
This commit is contained in:
@@ -55,10 +55,12 @@ namespace BoerseDataConvert
|
|||||||
foreach (var tagValue in record)
|
foreach (var tagValue in record)
|
||||||
{
|
{
|
||||||
string tag = CheckTagValue(tagValue.Key, tagValue.Value);
|
string tag = CheckTagValue(tagValue.Key, tagValue.Value);
|
||||||
|
if (tag != null)
|
||||||
|
{
|
||||||
writer.WriteStartElement(tag);
|
writer.WriteStartElement(tag);
|
||||||
writer.WriteValue(tagValue.Value);
|
writer.WriteValue(tagValue.Value);
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
count++;
|
count++;
|
||||||
@@ -72,7 +74,11 @@ namespace BoerseDataConvert
|
|||||||
}
|
}
|
||||||
private string CheckTagValue(int tag, string value)
|
private string CheckTagValue(int tag, string value)
|
||||||
{
|
{
|
||||||
if (tagsTable.CheckInvalidTag(tag)) warning.Add(tag);
|
if (tagsTable.CheckInvalidTag(tag))
|
||||||
|
{
|
||||||
|
warning.Add(tag);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
string tagname = tagsTable.GetTagName(tag);
|
string tagname = tagsTable.GetTagName(tag);
|
||||||
if (value == "") return tagname;
|
if (value == "") return tagname;
|
||||||
if (value != "NULL" && !tagsTable.HaveValueRanges(tag)) //Checks if the tag have not a value ranges
|
if (value != "NULL" && !tagsTable.HaveValueRanges(tag)) //Checks if the tag have not a value ranges
|
||||||
@@ -82,6 +88,7 @@ namespace BoerseDataConvert
|
|||||||
if (tagsTable.CheckStringLengthToBig(tag, value.Length))
|
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.WriteLine($"WARN: Too long value \"{tag}\", \"{value}\", max allowed \"{tagsTable.GetTagName(tag)}\", {cur_fileName} line {count + 1}");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else//Checks if value type is decimal
|
else//Checks if value type is decimal
|
||||||
@@ -94,6 +101,7 @@ namespace BoerseDataConvert
|
|||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"WARN: Value is not in a valid format for number \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
|
Console.WriteLine($"WARN: Value is not in a valid format for number \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,6 +110,7 @@ namespace BoerseDataConvert
|
|||||||
if (!tagsTable.CheckValidValue(tag, value))
|
if (!tagsTable.CheckValidValue(tag, value))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"WARN: Value not in range \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
|
Console.WriteLine($"WARN: Value not in range \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tagname;
|
return tagname;
|
||||||
|
|||||||
Reference in New Issue
Block a user