Argument input and help cmd
This commit is contained in:
@@ -25,7 +25,7 @@ namespace BoerseDataConvert
|
|||||||
public string ConvertToXml(Record record)
|
public string ConvertToXml(Record record)
|
||||||
{
|
{
|
||||||
StringBuilder xmlRecord = new StringBuilder();
|
StringBuilder xmlRecord = new StringBuilder();
|
||||||
xmlRecord.Append($" <record id=”{count}”>\n");
|
xmlRecord.Append($" <record id=\"{count}\">\n");
|
||||||
foreach (var tagValue in record.TagsValues)
|
foreach (var tagValue in record.TagsValues)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -15,8 +15,27 @@ namespace BoerseDataConvert
|
|||||||
// -d directory or --dir directory
|
// -d directory or --dir directory
|
||||||
// -o directory or --output direcory
|
// -o directory or --output direcory
|
||||||
// -h - help
|
// -h - help
|
||||||
|
// Console.OutputEncoding = System.Text.Encoding.UTF8;
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Reader reader = new Reader(@"E:\Downloads\TestData-2021_07_02", new string[1] { "subtype910.txt" });
|
if (args.Contains("-i") || args.Contains("--input"))
|
||||||
|
{
|
||||||
|
string zipfile = args[Array.IndexOf(args, "-i") + 1];
|
||||||
|
}
|
||||||
|
if (args.Contains("-d") || args.Contains("--directory"))
|
||||||
|
{
|
||||||
|
string inputDir = args[Array.IndexOf(args, "-d" + 1)];
|
||||||
|
}
|
||||||
|
if (args.Contains("-o") || args.Contains("--output"))
|
||||||
|
{
|
||||||
|
string outputDir = args[Array.IndexOf(args, "-o" + 1)];
|
||||||
|
}
|
||||||
|
if (args.Contains("-h") || args.Contains("--help"))
|
||||||
|
{
|
||||||
|
Help();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Reader reader = new Reader(@"E:\Downloads\TestData-2021_07_02", new string[1] { "subtype910.txt" });
|
||||||
|
Reader reader = new Reader(@"D:\Code\ИТ Кариера\Стаж\задача\TestData-2021_07_02", new string[1] { "subtype910.txt" });
|
||||||
RecordController a = new RecordController("");
|
RecordController a = new RecordController("");
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -32,5 +51,14 @@ namespace BoerseDataConvert
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void Help()
|
||||||
|
{
|
||||||
|
Console.WriteLine("BoerseDataConvert v1.0.0");
|
||||||
|
Console.WriteLine("D. Delchev and D. Byalkov, 2021");
|
||||||
|
Console.WriteLine("---");
|
||||||
|
Console.WriteLine("-i <input zip file> or --input <input zip file>");
|
||||||
|
Console.WriteLine("-d <working directory> or --directory <working directory>");
|
||||||
|
Console.WriteLine("-o <output directory> or --output <output directory>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace BoerseDataConvert
|
|||||||
public Reader(string adr, string[] filesNames)
|
public Reader(string adr, string[] filesNames)
|
||||||
{
|
{
|
||||||
fileInd = 0;
|
fileInd = 0;
|
||||||
reader = new StreamReader($@"{adr}/{filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252), true);
|
reader = new StreamReader($@"{adr}/{filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252));
|
||||||
this.adr = adr;
|
this.adr = adr;
|
||||||
this.filesNames = filesNames;
|
this.filesNames = filesNames;
|
||||||
reader.ReadLine();
|
reader.ReadLine();
|
||||||
@@ -28,7 +28,7 @@ namespace BoerseDataConvert
|
|||||||
{
|
{
|
||||||
fileInd++;
|
fileInd++;
|
||||||
reader.Close();
|
reader.Close();
|
||||||
reader = new StreamReader($@"{adr}/{filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252), true);
|
reader = new StreamReader($@"{adr}/{filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252));
|
||||||
RecordController.NextFile(filesNames[fileInd]);
|
RecordController.NextFile(filesNames[fileInd]);
|
||||||
s = reader.ReadLine();
|
s = reader.ReadLine();
|
||||||
s = reader.ReadLine();
|
s = reader.ReadLine();
|
||||||
|
|||||||
Reference in New Issue
Block a user