work 1
This commit is contained in:
@@ -9,6 +9,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using DataClient.Struct;
|
||||
|
||||
namespace Test2
|
||||
{
|
||||
@@ -60,35 +61,56 @@ namespace Test2
|
||||
var t = new NETClient("10.10.45.151", 1070);
|
||||
t.RetryCount = 10;
|
||||
t.RetryInterval = 0.1;
|
||||
var d_start = DateTime.Now;
|
||||
var d_end = new DateTime(2021, 01, 01);
|
||||
var count = 0;
|
||||
Directory.CreateDirectory(Directory.GetCurrentDirectory() + "/test");
|
||||
for (var d = d_start; d >= d_end; d = d.AddDays(-1))
|
||||
var work_dir = "D:/pasports";
|
||||
Directory.CreateDirectory(work_dir);
|
||||
var dir_year = t.Full_Dir_Browse();
|
||||
Console.WriteLine("Read main dir.");
|
||||
foreach (var a in dir_year)
|
||||
{
|
||||
var pasplist = t.Full_Dir_Browse(d.ToString("yyyy'/'MM'/'dd"));
|
||||
if (pasplist != null)
|
||||
foreach(var p in pasplist)
|
||||
if (a == "current") continue;
|
||||
Console.WriteLine(" Read dir " + a + ".");
|
||||
var dir_month = t.Full_Dir_Browse(a);
|
||||
foreach(var b in dir_month)
|
||||
{
|
||||
Console.WriteLine(" Read dir " + b + ".");
|
||||
var dir_day = t.Full_Dir_Browse(b);
|
||||
foreach(var c in dir_day)
|
||||
{
|
||||
var pasp = t.Full_Pasp_Download(p);
|
||||
|
||||
using (var file = new FileStream(Directory.GetCurrentDirectory() + "/test/pasp" + count.ToString() + ".txt", FileMode.Create, FileAccess.Write))
|
||||
Console.WriteLine(" Read dir " + c + ".");
|
||||
var pasports = t.Full_Dir_Browse(c);
|
||||
foreach(var d in pasports)
|
||||
{
|
||||
file.Write(pasp, 0, pasp.Length);
|
||||
var count = 0;
|
||||
Pasport pasp;
|
||||
do
|
||||
{
|
||||
Console.WriteLine(" Read " + count + " pasp: " + d);
|
||||
pasp = t.Full_Pasp_Download(d);
|
||||
count = (pasp.HasData && pasp.hasPasport) ? 3 : count + 1;
|
||||
} while (count < 3);
|
||||
Directory.CreateDirectory(work_dir + "/" + c);
|
||||
var res = pasp.PaspByte;
|
||||
var name = (pasp.hasPasport && !string.IsNullOrEmpty(pasp.nplav)) ? pasp.nplav : (pasp.numVDP.HasValue) ? pasp.numVDP.Value.ToString("D2") : "Jane_Doe";
|
||||
Console.Write(" Write pasp " + name + ": byte; ");
|
||||
using (var file = new FileStream(work_dir + "/" + c + "/" + name, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
file.Write(res, 0, res.Length);
|
||||
}
|
||||
Console.WriteLine("read;");
|
||||
using (var file = new StreamWriter(work_dir + "/" + c + "/" + name + "_read.txt"))
|
||||
{
|
||||
file.WriteLine(pasp.HasData); file.WriteLine(pasp.numVDP); file.WriteLine(pasp.dStart); file.WriteLine(pasp.dEnd);
|
||||
file.WriteLine(pasp.hasPasport); file.WriteLine(pasp.kod_npl); file.WriteLine(pasp.nplav); file.WriteLine(pasp.rm);
|
||||
file.WriteLine(pasp.splav); file.WriteLine(pasp.iS); file.WriteLine(pasp.notd); file.WriteLine(pasp.vessl);
|
||||
file.WriteLine(pasp.diam); file.WriteLine(pasp.prpl); file.WriteLine(pasp.tin); file.WriteLine(pasp.dzap);
|
||||
file.WriteLine(pasp.dlog); file.WriteLine(pasp.last); file.WriteLine(pasp.dlper); file.WriteLine(pasp.nazn);
|
||||
file.WriteLine(pasp.kompl); file.WriteLine(pasp.izl); file.WriteLine(pasp.robm); file.WriteLine(pasp.rizol);
|
||||
file.WriteLine(pasp.dkr); file.WriteLine(pasp.nkon); file.WriteLine(pasp.pos); file.WriteLine(pasp.ukaz);
|
||||
file.WriteLine(pasp.zakaz); file.WriteLine(pasp.kat); file.WriteLine(pasp.pril); file.WriteLine(pasp.rezerved);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
/*
|
||||
for(var i = 0; i < pasp.Length; i++)
|
||||
{
|
||||
Console.Write(" " + pasp[i].ToString("X2"));
|
||||
if ((i + 1) % 16 == 0) Console.WriteLine();
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.Write("Press button...");
|
||||
Console.ReadKey();
|
||||
Console.WriteLine();
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<History>True|2021-05-27T05:25:07.0935906Z;False|2021-05-27T10:24:29.8656359+05:00;True|2021-05-27T10:23:03.9710447+05:00;</History>
|
||||
<History>True|2021-06-05T18:21:31.7001275Z;True|2021-05-27T10:25:07.0935906+05:00;False|2021-05-27T10:24:29.8656359+05:00;True|2021-05-27T10:23:03.9710447+05:00;</History>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user