Move OcrClient to AddIn project
This commit is contained in:
parent
ac20bbfc05
commit
2026e2a4e2
@ -1,28 +0,0 @@
|
|||||||
namespace OcrClient.Models;
|
|
||||||
|
|
||||||
public class OcrResponse
|
|
||||||
{
|
|
||||||
public Result? Result { get; set; }
|
|
||||||
}
|
|
||||||
public class Result
|
|
||||||
{
|
|
||||||
public TextAnnotation? TextAnnotation { get; set; }
|
|
||||||
}
|
|
||||||
public class TextAnnotation
|
|
||||||
{
|
|
||||||
public List<Table>? Tables { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Table
|
|
||||||
{
|
|
||||||
public string? RowCount { get; set; }
|
|
||||||
public string? ColumnCount { get; set; }
|
|
||||||
public List<Cell>? Cells { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Cell
|
|
||||||
{
|
|
||||||
public string? RowIndex { get; set; }
|
|
||||||
public string? ColumnIndex { get; set; }
|
|
||||||
public string? Text { get; set; }
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFrameworks>net472;net6.0-windows</TargetFrameworks>
|
|
||||||
<LangVersion>10</LangVersion>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,5 +1,4 @@
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using OcrClient.Services;
|
|
||||||
|
|
||||||
namespace RhSolutions.AddIn;
|
namespace RhSolutions.AddIn;
|
||||||
|
|
||||||
|
28
RhSolutions.AddIn/Models/OcrResponse.cs
Normal file
28
RhSolutions.AddIn/Models/OcrResponse.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
namespace RhSolutions.Models;
|
||||||
|
|
||||||
|
public class OcrResponse
|
||||||
|
{
|
||||||
|
public Result Result { get; set; }
|
||||||
|
}
|
||||||
|
public class Result
|
||||||
|
{
|
||||||
|
public TextAnnotation TextAnnotation { get; set; }
|
||||||
|
}
|
||||||
|
public class TextAnnotation
|
||||||
|
{
|
||||||
|
public List<Table> Tables { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Table
|
||||||
|
{
|
||||||
|
public string RowCount { get; set; }
|
||||||
|
public string ColumnCount { get; set; }
|
||||||
|
public List<Cell> Cells { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Cell
|
||||||
|
{
|
||||||
|
public string RowIndex { get; set; }
|
||||||
|
public string ColumnIndex { get; set; }
|
||||||
|
public string Text { get; set; }
|
||||||
|
}
|
@ -22,7 +22,7 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.10" />
|
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
||||||
<PackageReference Include="netDxf" Version="2022.11.2" />
|
<PackageReference Include="netDxf" Version="2022.11.2" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
@ -32,7 +32,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\RhSolutions.ProductSku\RhSolutions.ProductSku.csproj" />
|
<ProjectReference Include="..\RhSolutions.ProductSku\RhSolutions.ProductSku.csproj" />
|
||||||
<ProjectReference Include="..\SnippingTool\SnippingTool.csproj" />
|
<ProjectReference Include="..\SnippingTool\SnippingTool.csproj" />
|
||||||
<ProjectReference Include="..\OcrClient\OcrClient.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Images\Coupling.png">
|
<None Update="Images\Coupling.png">
|
||||||
|
@ -20,12 +20,8 @@ public class AddInConfiguration : IAddInConfiguration
|
|||||||
|
|
||||||
public AddInConfiguration()
|
public AddInConfiguration()
|
||||||
{
|
{
|
||||||
// EmbeddedFileProvider embeddedProvider = new (typeof(RhSolutionsAddIn).Assembly);
|
|
||||||
// using Stream stream = embeddedProvider.GetFileInfo("appsettings.json").CreateReadStream();
|
|
||||||
|
|
||||||
_configuration = new ConfigurationBuilder()
|
_configuration = new ConfigurationBuilder()
|
||||||
.AddUserSecrets<RhSolutionsAddIn>()
|
.AddUserSecrets<RhSolutionsAddIn>()
|
||||||
// .AddJsonStream(stream)
|
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_rootKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\RhSolutions\RhSolutions-AddIn");
|
_rootKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\RhSolutions\RhSolutions-AddIn");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using OcrClient.Models;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OcrClient.Services;
|
namespace RhSolutions.Services;
|
||||||
|
|
||||||
public interface IOcrClient
|
public interface IOcrClient
|
||||||
{
|
{
|
@ -1,10 +1,10 @@
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using OcrClient.Models;
|
|
||||||
|
|
||||||
namespace OcrClient.Services;
|
namespace RhSolutions.Services;
|
||||||
|
|
||||||
public class YandexOcrClient : IOcrClient
|
public class YandexOcrClient : IOcrClient
|
||||||
{
|
{
|
||||||
@ -35,7 +35,7 @@ public class YandexOcrClient : IOcrClient
|
|||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
string jsonResponse = await response.Content.ReadAsStringAsync();
|
string jsonResponse = await response.Content.ReadAsStringAsync();
|
||||||
OcrResponse? deserialized = JsonConvert.DeserializeObject<OcrResponse>(jsonResponse);
|
OcrResponse deserialized = JsonConvert.DeserializeObject<OcrResponse>(jsonResponse);
|
||||||
|
|
||||||
if (deserialized != null)
|
if (deserialized != null)
|
||||||
{
|
{
|
@ -1,6 +1,5 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SnippingTool;
|
using SnippingTool;
|
||||||
using OcrClient.Services;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Application = Microsoft.Office.Interop.Excel.Application;
|
using Application = Microsoft.Office.Interop.Excel.Application;
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RhSolutions.ProductSku", "R
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SnippingTool", "SnippingTool\SnippingTool.csproj", "{DDB517C7-DF61-4C26-B691-956D0E5906C3}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SnippingTool", "SnippingTool\SnippingTool.csproj", "{DDB517C7-DF61-4C26-B691-956D0E5906C3}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OcrClient", "OcrClient\OcrClient.csproj", "{53F322B3-F477-4831-8E16-EA76934A0D59}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Loading…
Reference in New Issue
Block a user