Bugfixes
This commit is contained in:
@@ -24,10 +24,10 @@ namespace BoerseDataConvert
|
|||||||
tagsTable = new TagsTable(tags);
|
tagsTable = new TagsTable(tags);
|
||||||
XmlWriterSettings settings = new XmlWriterSettings();
|
XmlWriterSettings settings = new XmlWriterSettings();
|
||||||
settings.Indent = true;
|
settings.Indent = true;
|
||||||
XmlWriter writer = XmlWriter.Create($@"{address}/{cur_fileName}.xml", settings);
|
writer = XmlWriter.Create($@"{address}/{cur_fileName}.xml", settings);
|
||||||
writer.WriteStartDocument();
|
writer.WriteStartDocument();
|
||||||
writer.WriteStartElement("table");
|
writer.WriteStartElement("table");
|
||||||
writer.WriteAttributeString("name", null, "file");
|
writer.WriteAttributeString("name", null, cur_fileName);
|
||||||
}
|
}
|
||||||
public static void NextFile(string fileName)
|
public static void NextFile(string fileName)
|
||||||
{
|
{
|
||||||
@@ -36,10 +36,13 @@ namespace BoerseDataConvert
|
|||||||
writer.Close();
|
writer.Close();
|
||||||
cur_fileName = fileName.Split('.').First();
|
cur_fileName = fileName.Split('.').First();
|
||||||
count = 1;
|
count = 1;
|
||||||
cur_fileName = fileName;
|
Console.WriteLine(cur_fileName + " start");
|
||||||
|
XmlWriterSettings settings = new XmlWriterSettings();
|
||||||
|
settings.Indent = true;
|
||||||
|
writer = XmlWriter.Create($@"{address}/{cur_fileName}.xml", settings);
|
||||||
writer.WriteStartDocument();
|
writer.WriteStartDocument();
|
||||||
writer.WriteStartElement("table");
|
writer.WriteStartElement("table");
|
||||||
writer.WriteAttributeString("name", null, "file");
|
writer.WriteAttributeString("name", null, cur_fileName);
|
||||||
}
|
}
|
||||||
public void WriteXmlRecord (Record record)
|
public void WriteXmlRecord (Record record)
|
||||||
{
|
{
|
||||||
@@ -70,11 +73,10 @@ namespace BoerseDataConvert
|
|||||||
}
|
}
|
||||||
private string CheckTagValue(int tag, string value)
|
private string CheckTagValue(int tag, string value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(tagsTable.CheckInvalidTag(tag)) throw new ArgumentException($"WARN: Invalid tag \"{tag}\", {cur_fileName} line {count + 1}");
|
if(tagsTable.CheckInvalidTag(tag)) throw new ArgumentException($"WARN: Invalid tag \"{tag}\", {cur_fileName} line {count + 1}");
|
||||||
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
|
||||||
{
|
{
|
||||||
if (tagsTable.IsString(tag))//Checks if value type is string
|
if (tagsTable.IsString(tag))//Checks if value type is string
|
||||||
{
|
{
|
||||||
@@ -92,13 +94,16 @@ namespace BoerseDataConvert
|
|||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
throw new ArgumentException($"WARN: Value is not in a valid format for number \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
|
throw new ArgumentException($"WARN: Value is not in a valid format for number \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else//Checks if the tag have a value ranges
|
else//Checks if the tag have a value ranges
|
||||||
{
|
{
|
||||||
if(!tagsTable.CheckValidValue(tag,value))throw new ArgumentException($"WARN: Value not in range \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
|
if (!tagsTable.CheckValidValue(tag, value))
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"WARN: Value not in range \"{tag}\", \"{value}\", {cur_fileName} line {count + 1}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return tagname;
|
return tagname;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace BoerseDataConvert
|
|||||||
if (input.Length == 3)
|
if (input.Length == 3)
|
||||||
{
|
{
|
||||||
valueRanges = input[2].Split('#').ToArray();
|
valueRanges = input[2].Split('#').ToArray();
|
||||||
|
haveValueRanges = true;
|
||||||
}
|
}
|
||||||
else haveValueRanges = false;
|
else haveValueRanges = false;
|
||||||
}
|
}
|
||||||
@@ -48,7 +49,7 @@ namespace BoerseDataConvert
|
|||||||
}
|
}
|
||||||
public bool ValidValue(string value)
|
public bool ValidValue(string value)
|
||||||
{
|
{
|
||||||
foreach (string validValue in valueRanges)
|
foreach (string validValue in valueRanges)
|
||||||
{
|
{
|
||||||
if (validValue == value)
|
if (validValue == value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace BoerseDataConvert
|
|||||||
public TagsTable(string tags)
|
public TagsTable(string tags)
|
||||||
{
|
{
|
||||||
reader = new StreamReader(tags);
|
reader = new StreamReader(tags);
|
||||||
table = new Tag[int.Parse(reader.ReadLine())];
|
table = new Tag[int.Parse(reader.ReadLine()) + 1];
|
||||||
LoadInfo();
|
LoadInfo();
|
||||||
}
|
}
|
||||||
private void LoadInfo()
|
private void LoadInfo()
|
||||||
|
|||||||
Reference in New Issue
Block a user