AngleSharp add

This commit is contained in:
Sergey Chebotar 2021-11-29 15:52:35 +03:00
parent 3eb118d6db
commit 198e5c886f
4 changed files with 63 additions and 40 deletions

View File

@ -1,41 +1,40 @@
//using System; using AngleSharp;
//using AngleSharp; using AngleSharp.Dom;
//using AngleSharp.Dom; using System.Linq;
//using System.Linq; using System.Net;
//using System.Net; using System.Net.Http;
//using System.Net.Http; using System.Threading.Tasks;
//using System.Threading.Tasks;
//namespace Rehau.Sku.Assist namespace Rehau.Sku.Assist
//{ {
// static class SkuAssist static class SkuAssist
// { {
// public async static Task<string> GetContent(string request, HttpClient httpClient) public async static Task<string> GetContent(string request, HttpClient httpClient)
// { {
// string uri = "https://shop-rehau.ru/catalogsearch/result/?q=" + request; string uri = "https://shop-rehau.ru/catalogsearch/result/?q=" + request;
// ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
// return await httpClient.GetStringAsync(uri); return await httpClient.GetStringAsync(uri);
// } }
// public async static Task<AngleSharp.Dom.IDocument> GetDocument(string source) public async static Task<IDocument> GetDocument(string source)
// { {
// IConfiguration config = Configuration.Default; IConfiguration config = Configuration.Default;
// IBrowsingContext context = BrowsingContext.New(config); IBrowsingContext context = BrowsingContext.New(config);
// return await context.OpenAsync(req => req.Content(source)); return await context.OpenAsync(req => req.Content(source));
// } }
// public static IProduct GetProductFromDocument(IDocument document) public static IProduct GetProductFromDocument(IDocument document)
// { {
// return document return document
// .All .All
// .Where(e => e.ClassName == "product-item__desc-top") .Where(e => e.ClassName == "product-item__desc-top")
// .Select(e => new Product(e.Children[0].TextContent, e.Children[1].TextContent.Trim(new[] { '\n', ' ' }))) .Select(e => new Product(e.Children[0].TextContent, e.Children[1].TextContent.Trim(new[] { '\n', ' ' })))
// // .Where(product => !product.Sku.Any(c => char.IsLetter(c))) // .Where(product => !product.Sku.Any(c => char.IsLetter(c)))
// .FirstOrDefault(); .FirstOrDefault();
// } }
// } }
//} }

View File

@ -34,6 +34,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="AngleSharp, Version=0.16.1.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea, processorArchitecture=MSIL">
<HintPath>packages\AngleSharp.0.16.1\lib\net472\AngleSharp.dll</HintPath>
</Reference>
<Reference Include="ExcelDna.Integration, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f225e9659857edbe, processorArchitecture=MSIL"> <Reference Include="ExcelDna.Integration, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f225e9659857edbe, processorArchitecture=MSIL">
<HintPath>packages\ExcelDna.Integration.1.5.0\lib\net452\ExcelDna.Integration.dll</HintPath> <HintPath>packages\ExcelDna.Integration.1.5.0\lib\net452\ExcelDna.Integration.dll</HintPath>
<Private>False</Private> <Private>False</Private>
@ -42,14 +45,29 @@
<HintPath>packages\ExcelDna.Registration.1.5.0\lib\net452\ExcelDna.Registration.dll</HintPath> <HintPath>packages\ExcelDna.Registration.1.5.0\lib\net452\ExcelDna.Registration.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.OracleClient" /> <Reference Include="System.Data.OracleClient" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net" /> <Reference Include="System.Net" />
<Reference Include="System.Numerics" /> <Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Caching" /> <Reference Include="System.Runtime.Caching" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security" /> <Reference Include="System.Security" />
<Reference Include="System.ServiceProcess" /> <Reference Include="System.ServiceProcess" />
<Reference Include="System.Text.Encoding.CodePages, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Text.Encoding.CodePages.6.0.0\lib\net461\System.Text.Encoding.CodePages.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" /> <Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration>

View File

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="AngleSharp" version="0.16.1" targetFramework="net48" />
<package id="ExcelDna.AddIn" version="1.5.0" targetFramework="net480" /> <package id="ExcelDna.AddIn" version="1.5.0" targetFramework="net480" />
<package id="ExcelDna.Integration" version="1.5.0" targetFramework="net480" /> <package id="ExcelDna.Integration" version="1.5.0" targetFramework="net480" />
<package id="ExcelDna.Registration" version="1.5.0" targetFramework="net480" /> <package id="ExcelDna.Registration" version="1.5.0" targetFramework="net480" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Memory" version="4.5.4" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
<package id="System.Text.Encoding.CodePages" version="6.0.0" targetFramework="net48" />
</packages> </packages>