diff --git a/OcrClient/Models/OcrResponse.cs b/OcrClient/Models/OcrResponse.cs deleted file mode 100644 index 2b26ab7..0000000 --- a/OcrClient/Models/OcrResponse.cs +++ /dev/null @@ -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? Tables { get; set; } -} - -public class Table -{ - public string? RowCount { get; set; } - public string? ColumnCount { get; set; } - public List? Cells { get; set; } -} - -public class Cell -{ - public string? RowIndex { get; set; } - public string? ColumnIndex { get; set; } - public string? Text { get; set; } -} diff --git a/OcrClient/OcrClient.csproj b/OcrClient/OcrClient.csproj deleted file mode 100644 index cdd654f..0000000 --- a/OcrClient/OcrClient.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - net472;net6.0-windows - 10 - enable - enable - - - - - - - - diff --git a/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs b/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs index 58ffdf2..0615da1 100644 --- a/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs +++ b/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs @@ -1,5 +1,4 @@ using System.Net; -using OcrClient.Services; namespace RhSolutions.AddIn; diff --git a/RhSolutions.AddIn/Models/OcrResponse.cs b/RhSolutions.AddIn/Models/OcrResponse.cs new file mode 100644 index 0000000..9b6f294 --- /dev/null +++ b/RhSolutions.AddIn/Models/OcrResponse.cs @@ -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
Tables { get; set; } +} + +public class Table +{ + public string RowCount { get; set; } + public string ColumnCount { get; set; } + public List Cells { get; set; } +} + +public class Cell +{ + public string RowIndex { get; set; } + public string ColumnIndex { get; set; } + public string Text { get; set; } +} diff --git a/RhSolutions.AddIn/RhSolutions.AddIn.csproj b/RhSolutions.AddIn/RhSolutions.AddIn.csproj index 9ba0622..67ef543 100644 --- a/RhSolutions.AddIn/RhSolutions.AddIn.csproj +++ b/RhSolutions.AddIn/RhSolutions.AddIn.csproj @@ -22,7 +22,7 @@ - + @@ -32,7 +32,6 @@ - diff --git a/RhSolutions.AddIn/Services/AddInConfiguration.cs b/RhSolutions.AddIn/Services/AddInConfiguration.cs index 860b6c1..5fa4c1a 100644 --- a/RhSolutions.AddIn/Services/AddInConfiguration.cs +++ b/RhSolutions.AddIn/Services/AddInConfiguration.cs @@ -20,12 +20,8 @@ public class AddInConfiguration : IAddInConfiguration public AddInConfiguration() { - // EmbeddedFileProvider embeddedProvider = new (typeof(RhSolutionsAddIn).Assembly); - // using Stream stream = embeddedProvider.GetFileInfo("appsettings.json").CreateReadStream(); - _configuration = new ConfigurationBuilder() .AddUserSecrets() - // .AddJsonStream(stream) .Build(); _rootKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\RhSolutions\RhSolutions-AddIn"); diff --git a/OcrClient/Services/IOcrClient.cs b/RhSolutions.AddIn/Services/IOcrClient.cs similarity index 69% rename from OcrClient/Services/IOcrClient.cs rename to RhSolutions.AddIn/Services/IOcrClient.cs index 9b281c9..0233d14 100644 --- a/OcrClient/Services/IOcrClient.cs +++ b/RhSolutions.AddIn/Services/IOcrClient.cs @@ -1,6 +1,6 @@ -using OcrClient.Models; +using System.Threading.Tasks; -namespace OcrClient.Services; +namespace RhSolutions.Services; public interface IOcrClient { diff --git a/OcrClient/Services/YandexOcrClient.cs b/RhSolutions.AddIn/Services/YandexOcrClient.cs similarity index 93% rename from OcrClient/Services/YandexOcrClient.cs rename to RhSolutions.AddIn/Services/YandexOcrClient.cs index 3146e84..c79dda4 100644 --- a/OcrClient/Services/YandexOcrClient.cs +++ b/RhSolutions.AddIn/Services/YandexOcrClient.cs @@ -1,10 +1,10 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Text; +using System.Threading.Tasks; using Newtonsoft.Json; -using OcrClient.Models; -namespace OcrClient.Services; +namespace RhSolutions.Services; public class YandexOcrClient : IOcrClient { @@ -35,7 +35,7 @@ public class YandexOcrClient : IOcrClient response.EnsureSuccessStatusCode(); string jsonResponse = await response.Content.ReadAsStringAsync(); - OcrResponse? deserialized = JsonConvert.DeserializeObject(jsonResponse); + OcrResponse deserialized = JsonConvert.DeserializeObject(jsonResponse); if (deserialized != null) { diff --git a/RhSolutions.AddIn/Tools/OcrTool.cs b/RhSolutions.AddIn/Tools/OcrTool.cs index 89a6fee..2869537 100644 --- a/RhSolutions.AddIn/Tools/OcrTool.cs +++ b/RhSolutions.AddIn/Tools/OcrTool.cs @@ -1,6 +1,5 @@ using System.Threading.Tasks; using SnippingTool; -using OcrClient.Services; using System.Windows.Forms; using Application = Microsoft.Office.Interop.Excel.Application; diff --git a/RhSolutions.sln b/RhSolutions.sln index 54c4ab1..aa534ab 100644 --- a/RhSolutions.sln +++ b/RhSolutions.sln @@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RhSolutions.ProductSku", "R EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SnippingTool", "SnippingTool\SnippingTool.csproj", "{DDB517C7-DF61-4C26-B691-956D0E5906C3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OcrClient", "OcrClient\OcrClient.csproj", "{53F322B3-F477-4831-8E16-EA76934A0D59}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU