aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerghei Cebotari <serghei@cebotari.ru>2023-11-02 23:31:43 +0300
committerSerghei Cebotari <serghei@cebotari.ru>2023-11-02 23:31:43 +0300
commit1b72c00b1e2c29117616dcd3da83e1fea68b892d (patch)
tree97d93ddf7c78ad78e61106a559c3b5d87222e7ed
parent8a8fc397bfb8cb9d2eed1f1c87b93aece0274c74 (diff)
parent6d6e91867ce67f2c4e3f3db47a14173fa3bb598d (diff)
Merge branch 'experimental'
-rw-r--r--RhSolutions.AddIn/RhSolutions-AddIn.dna10
-rw-r--r--RhSolutions.AddIn/RhSolutions.AddIn.csproj11
-rw-r--r--RhSolutions.AddIn/Services/DatabaseClient.cs12
3 files changed, 12 insertions, 21 deletions
diff --git a/RhSolutions.AddIn/RhSolutions-AddIn.dna b/RhSolutions.AddIn/RhSolutions-AddIn.dna
index 63149ff..1ece3ec 100644
--- a/RhSolutions.AddIn/RhSolutions-AddIn.dna
+++ b/RhSolutions.AddIn/RhSolutions-AddIn.dna
@@ -1,32 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<DnaLibrary Name="RhSolutions Add-In" RuntimeVersion="v4.0" xmlns="http://schemas.excel-dna.net/addin/2020/07/dnalibrary">
<ExternalLibrary Path="RhSolutions.AddIn.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" IncludePdb="false" />
- <Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
- <Reference Path="Microsoft.AspNetCore.Http.Abstractions.dll" Pack="true" />
- <Reference Path="Microsoft.AspNetCore.Http.Extensions.dll" Pack="true" />
- <Reference Path="Microsoft.AspNetCore.Http.Features.dll" Pack="true" />
<Reference Path="Microsoft.Bcl.AsyncInterfaces.dll" Pack="true" />
<Reference Path="Microsoft.Bcl.HashCode.dll" Pack="true" />
<Reference Path="Microsoft.Extensions.Caching.Abstractions.dll" Pack="true" />
<Reference Path="Microsoft.Extensions.Caching.Memory.dll" Pack="true" />
<Reference Path="Microsoft.Extensions.DependencyInjection.Abstractions.dll" Pack="true" />
<Reference Path="Microsoft.Extensions.DependencyInjection.dll" Pack="true" />
- <Reference Path="Microsoft.Extensions.FileProviders.Abstractions.dll" Pack="true" />
<Reference Path="Microsoft.Extensions.Http.dll" Pack="true" />
<Reference Path="Microsoft.Extensions.Logging.Abstractions.dll" Pack="true" />
<Reference Path="Microsoft.Extensions.Logging.dll" Pack="true" />
<Reference Path="Microsoft.Extensions.Options.dll" Pack="true" />
<Reference Path="Microsoft.Extensions.Primitives.dll" Pack="true" />
- <Reference Path="Microsoft.Net.Http.Headers.dll" Pack="true" />
- <Reference Path="netDxf.dll" Pack="true" />
+ <Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
<Reference Path="Newtonsoft.Json.dll" Pack="true" />
+ <Reference Path="netDxf.dll" Pack="true" />
<Reference Path="RhSolutions.ProductSku.dll" Pack="true" />
<Reference Path="System.Buffers.dll" Pack="true" />
<Reference Path="System.Diagnostics.DiagnosticSource.dll" Pack="true" />
<Reference Path="System.Memory.dll" Pack="true" />
<Reference Path="System.Numerics.Vectors.dll" Pack="true" />
<Reference Path="System.Runtime.CompilerServices.Unsafe.dll" Pack="true" />
- <Reference Path="System.Text.Encodings.Web.dll" Pack="true" />
<Reference Path="System.Threading.Tasks.Extensions.dll" Pack="true" />
<Reference Path="System.ValueTuple.dll" Pack="true" />
</DnaLibrary>
diff --git a/RhSolutions.AddIn/RhSolutions.AddIn.csproj b/RhSolutions.AddIn/RhSolutions.AddIn.csproj
index ff5db43..d73b404 100644
--- a/RhSolutions.AddIn/RhSolutions.AddIn.csproj
+++ b/RhSolutions.AddIn/RhSolutions.AddIn.csproj
@@ -14,25 +14,24 @@
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net472|AnyCPU'">
- <NoWarn>1701;1702</NoWarn>
+ <NoWarn>1701;1702</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net472|AnyCPU'">
- <NoWarn>1701;1702</NoWarn>
+ <NoWarn>1701;1702</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-windows7.0|AnyCPU'">
- <NoWarn>1701;1702</NoWarn>
+ <NoWarn>1701;1702</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-windows7.0|AnyCPU'">
- <NoWarn>1701;1702</NoWarn>
+ <NoWarn>1701;1702</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ExcelDna.AddIn" Version="1.6.0">
- <TreatAsUsed>true</TreatAsUsed>
+ <TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="ExcelDna.Integration" Version="1.6.0" />
<PackageReference Include="ExcelDna.IntelliSense" Version="1.6.0" />
<PackageReference Include="ExcelDna.Interop" Version="15.0.1" />
- <PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
diff --git a/RhSolutions.AddIn/Services/DatabaseClient.cs b/RhSolutions.AddIn/Services/DatabaseClient.cs
index 3036e51..69f7fc1 100644
--- a/RhSolutions.AddIn/Services/DatabaseClient.cs
+++ b/RhSolutions.AddIn/Services/DatabaseClient.cs
@@ -1,10 +1,8 @@
using Microsoft.Extensions.Caching.Memory;
using Newtonsoft.Json;
-using System.Web;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http.Extensions;
namespace RhSolutions.Services;
@@ -55,13 +53,13 @@ public class DatabaseClient : IDatabaseClient
}
else
- {
- QueryBuilder qb = new()
+ {
+ UriBuilder builder = new(@"https://rh.cebotari.ru/api/search")
{
- {"query", line}
+ Query = $"query={line.Replace("&", "%26")}"
};
- string request = @"https://rh.cebotari.ru/api/search" + qb.ToQueryString();
-
+ string request = builder.Uri.AbsoluteUri;
+
if (!_memoryCache.TryGetValue(line, out IEnumerable<Product> products))
{
var response = await _httpClient.GetAsync(request);