Execution time and warnings
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"profiles": {
|
||||
"BoerseDataConvert": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "-i smalldata.zip -d input -o output"
|
||||
"commandLineArgs": "-i bigdata.zip -d input -o output"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using Mono.Options;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace BoerseDataConvert
|
||||
{
|
||||
@@ -79,7 +80,8 @@ namespace BoerseDataConvert
|
||||
|
||||
Reader reader = new Reader(inputDirectory, fileNames);
|
||||
RecordController a = new RecordController(outputDirectory, fileNames[0], tagsFile);
|
||||
|
||||
Stopwatch totalRunTime = new Stopwatch();
|
||||
totalRunTime.Start();
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
@@ -89,12 +91,12 @@ namespace BoerseDataConvert
|
||||
}
|
||||
catch (IndexOutOfRangeException)
|
||||
{
|
||||
Reader.EndFile();
|
||||
RecordController.EndFile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Console.WriteLine("INFO: Successful conversion, exiting");
|
||||
totalRunTime.Stop();
|
||||
Console.WriteLine($"INFO: Successful conversion in {totalRunTime.Elapsed:c}, exiting");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
static void CheckFreeDisk(string zipFile, string outputDirectory)
|
||||
|
||||
@@ -5,22 +5,25 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace BoerseDataConvert
|
||||
{
|
||||
public class Reader
|
||||
{
|
||||
private string[] filesNames;
|
||||
static Stopwatch stopwatch = new Stopwatch();
|
||||
private static string[] filesNames;
|
||||
private static StreamReader reader;
|
||||
private int fileInd;
|
||||
private static int fileInd;
|
||||
private string adr;
|
||||
public Reader(string adr, string[] filesNames)
|
||||
public Reader(string adr, string[] _filesNames)
|
||||
{
|
||||
fileInd = 0;
|
||||
reader = new StreamReader($@"{adr}/{filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252));
|
||||
reader = new StreamReader($@"{adr}/{_filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252));
|
||||
this.adr = adr;
|
||||
this.filesNames = filesNames;
|
||||
filesNames = _filesNames;
|
||||
string date = reader.ReadLine();
|
||||
stopwatch.Start();
|
||||
CheckFirstLine(date);
|
||||
}
|
||||
public Record ReadLineRecord()
|
||||
@@ -29,9 +32,9 @@ namespace BoerseDataConvert
|
||||
if (reader.EndOfStream)
|
||||
{
|
||||
CheckFinalLine(s);
|
||||
Console.WriteLine($"INFO: { filesNames[fileInd] } was converted successfully");
|
||||
fileInd++;
|
||||
EndFile();
|
||||
fileInd++;
|
||||
stopwatch.Start();
|
||||
reader = new StreamReader($@"{adr}/{filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252));
|
||||
RecordController.NextFile(filesNames[fileInd]);
|
||||
string date = reader.ReadLine();
|
||||
@@ -88,6 +91,9 @@ namespace BoerseDataConvert
|
||||
internal static void EndFile()
|
||||
{
|
||||
reader.Close();
|
||||
stopwatch.Stop();
|
||||
Console.WriteLine($"INFO: { filesNames[fileInd] } was converted successfully in {stopwatch.Elapsed:c}");
|
||||
stopwatch.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user