Обновление библиотек + порция рефакторинга

This commit is contained in:
YPermitin
2020-12-29 23:29:59 +05:00
parent 2356337be8
commit 7e24c16e45
13 changed files with 57 additions and 66 deletions
@@ -1,7 +1,6 @@
using System;
using System.Threading;
using Microsoft.Extensions.Configuration;
using YY.TechJournalExportAssistant;
using YY.TechJournalExportAssistant.ClickHouse;
using YY.TechJournalExportAssistant.Core;
using YY.TechJournalReaderAssistant;
@@ -95,43 +94,6 @@ namespace YY.TechJournalExportAssistantConsoleApp
}
}
using (TechJournalExportMaster exporter = new TechJournalExportMaster())
{
exporter.SetTechJournalPath(techJournalPath);
TechJournalOnClickHouse target = new TechJournalOnClickHouse(connectionString, portion);
target.SetInformationSystem(new TechJournalLogBase()
{
Name = techJournalName,
Description = techJournalDescription
});
exporter.SetTarget(target);
exporter.BeforeExportData += BeforeExportData;
exporter.AfterExportData += AfterExportData;
exporter.OnErrorExportData += OnErrorExportData;
_beginPortionExport = DateTime.Now;
if (useWatchMode)
{
while (true)
{
if (Console.KeyAvailable)
if (Console.ReadKey().KeyChar == 'q')
break;
while (exporter.NewDataAvailable())
{
exporter.SendData();
Thread.Sleep(watchPeriodSecondsMs);
}
}
}
else
while (exporter.NewDataAvailable())
exporter.SendData();
}
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Для выхода нажмите любую клавишу...");
@@ -19,14 +19,10 @@ namespace YY.TechJournalExportAssistant.ClickHouse
{
#region Private Static Members
private static readonly string _emptyGuidAsString = Guid.Empty.ToString();
private static readonly DateTime _minDateTime = new DateTime(1970, 1, 1);
#endregion
#region Private Members
private string _databaseName;
private ClickHouseConnection _connection;
private long logFileLastId = -1;
@@ -306,7 +302,7 @@ namespace YY.TechJournalExportAssistant.ClickHouse
{
ParameterName = "LastStreamPosition",
DbType = DbType.Int64,
Value = position?.StreamPosition ?? 0
Value = position.StreamPosition ?? 0
});
commandAddLogInfo.ExecuteNonQuery();
@@ -400,10 +396,6 @@ namespace YY.TechJournalExportAssistant.ClickHouse
private void CheckDatabaseSettings(string connectionSettings)
{
var connectionParams = ClickHouseHelpers.GetConnectionParams(connectionSettings);
var databaseParam = connectionParams.FirstOrDefault(e => e.Key.ToUpper() == "DATABASE");
_databaseName = databaseParam.Value;
ClickHouseHelpers.CreateDatabaseIfNotExist(connectionSettings);
}
@@ -2,6 +2,16 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.0.1</Version>
<Authors>Permitin Yuriy</Authors>
<Product>Technological journal's export assistant to ClickHouse</Product>
<Description>Library for exporting 1C:Enterprise 8.x platform's technological journal files to ClickHouse</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>https://github.com/YPermitin/YY.TechJournalExportAssistant</RepositoryUrl>
<RepositoryType>GIT</RepositoryType>
<PackageTags>technological, journal, log, 1C, enterprise, ClickHouse</PackageTags>
</PropertyGroup>
<ItemGroup>
@@ -30,4 +40,11 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="..\..\Nuget\icon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>
@@ -1,6 +1,6 @@
using YY.TechJournalReaderAssistant;
namespace YY.TechJournalExportAssistant
namespace YY.TechJournalExportAssistant.Core
{
public sealed class AfterExportDataEventArgs
{
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using YY.TechJournalReaderAssistant.Models;
namespace YY.TechJournalExportAssistant
namespace YY.TechJournalExportAssistant.Core
{
public sealed class BeforeExportDataEventArgs
{
@@ -26,7 +26,7 @@ namespace YY.TechJournalExportAssistant.Core.Helpers
+ "-"
+ value.Substring(4, 12);
if (Guid.TryParse(GUIDAsString, out Guid parseResult))
if (Guid.TryParse(GUIDAsString, out _))
return GUIDAsString;
else
return _emptyGuid;
@@ -1,10 +1,9 @@
using System.Collections.Generic;
using System.IO;
using YY.TechJournalExportAssistant.Core;
using YY.TechJournalReaderAssistant;
using YY.TechJournalReaderAssistant.Models;
namespace YY.TechJournalExportAssistant
namespace YY.TechJournalExportAssistant.Core
{
public interface ITechJournalOnTarget
{
@@ -1,6 +1,6 @@
using System;
namespace YY.TechJournalExportAssistant
namespace YY.TechJournalExportAssistant.Core
{
public class OnErrorExportDataEventArgs
{
@@ -12,7 +12,6 @@ namespace YY.TechJournalExportAssistant.Core
#region Private Member Variables
private string _eventLogPath;
private string _referenceDataHash;
private ITechJournalOnTarget _target;
private TechJournalReader _reader;
private readonly List<EventData> _dataToSend;
@@ -31,7 +30,6 @@ namespace YY.TechJournalExportAssistant.Core
public TechJournalExportMaster()
{
_referenceDataHash = string.Empty;
_dataToSend = new List<EventData>();
_portionSize = 0;
}
@@ -2,10 +2,27 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.0.1</Version>
<Authors>Permitin Yuriy</Authors>
<Product>Technological journal's export assistant. Core library</Product>
<Description>Core library for exporting 1C:Enterprise 8.x platform's technological journal files to different storage</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>https://github.com/YPermitin/YY.TechJournalExportAssistant</RepositoryUrl>
<PackageTags>technological, journal, log, 1C, enterprise, Core</PackageTags>
<RepositoryType>GIT</RepositoryType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="YY.TechJournalReaderAssistant" Version="1.0.0.10" />
<PackageReference Include="YY.TechJournalReaderAssistant" Version="1.0.0.11" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\Nuget\icon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

@@ -1,4 +1,3 @@
using System;
using Xunit;
namespace YY.TechJournalExportAssistant.Tests
@@ -8,7 +7,8 @@ namespace YY.TechJournalExportAssistant.Tests
[Fact]
public void Test1()
{
// TODO: We need more tests :)
Assert.True(true);
}
}
}
+14 -8
View File
@@ -3,12 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30709.132
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{72A12147-1EE9-4331-ACB0-53415C1FACC2}"
ProjectSection(SolutionItems) = preProject
..\LICENSE = ..\LICENSE
..\README.md = ..\README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libs", "Libs", "{274A8CD4-5F80-4164-B0F6-1F2ACBB8E00B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Apps", "Apps", "{81F37230-D7FE-4190-A939-B5AE8A71494B}"
@@ -19,9 +13,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{67285ED0
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YY.TechJournalExportAssistant.Tests", "Tests\YY.TechJournalExportAssistant.Tests\YY.TechJournalExportAssistant.Tests.csproj", "{380AF8FF-4374-4177-914A-20707683FBA4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YY.TechJournalExportAssistant.Core", "Libs\YY.TechJournalExportAssistant.Core\YY.TechJournalExportAssistant.Core.csproj", "{2A6385AB-F109-4D3C-9BDE-E2DC6B518812}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YY.TechJournalExportAssistant.Core", "Libs\YY.TechJournalExportAssistant.Core\YY.TechJournalExportAssistant.Core.csproj", "{2A6385AB-F109-4D3C-9BDE-E2DC6B518812}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YY.TechJournalExportAssistant.ClickHouse", "Libs\YY.TechJournalExportAssistant.ClickHouse\YY.TechJournalExportAssistant.ClickHouse.csproj", "{62CDAE77-D687-423E-B88C-25967ECC2353}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YY.TechJournalExportAssistant.ClickHouse", "Libs\YY.TechJournalExportAssistant.ClickHouse\YY.TechJournalExportAssistant.ClickHouse.csproj", "{62CDAE77-D687-423E-B88C-25967ECC2353}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{300AD5BD-47CB-4AA8-B823-9B061C7654D1}"
ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Nuget", "Nuget", "{56E62BAA-09E0-4119-AA48-0F3B6E80C1F7}"
ProjectSection(SolutionItems) = preProject
Nuget\icon.png = Nuget\icon.png
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -54,6 +59,7 @@ Global
{380AF8FF-4374-4177-914A-20707683FBA4} = {67285ED0-345C-4482-98F8-E5305D9C9A0E}
{2A6385AB-F109-4D3C-9BDE-E2DC6B518812} = {274A8CD4-5F80-4164-B0F6-1F2ACBB8E00B}
{62CDAE77-D687-423E-B88C-25967ECC2353} = {274A8CD4-5F80-4164-B0F6-1F2ACBB8E00B}
{56E62BAA-09E0-4119-AA48-0F3B6E80C1F7} = {300AD5BD-47CB-4AA8-B823-9B061C7654D1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B3DABD43-6E3B-4871-B426-2C4BDD6018CC}