Compare commits

...

7 Commits

Author SHA1 Message Date
Sergey Chebotar
6484cac4f0 Move Sku class to nuget package 2023-02-13 07:20:18 +03:00
Sergey Chebotar
6fe49f6ad1 Additional target net472 2023-02-09 10:05:50 +03:00
Sergey Chebotar
2c0dee774c Set supported platform to Windows 2023-02-09 08:58:01 +03:00
Sergey Chebotar
e5944bf114 Remove references 2023-02-09 08:46:22 +03:00
Sergey Chebotar
d2ec4f076f Remove duplicate package reference 2023-02-08 16:21:05 +03:00
Sergey Chebotar
db3353759d Update version 2023-02-08 16:04:27 +03:00
Sergey Chebotar
01b2e46651 Move to .net6 2023-02-08 15:59:30 +03:00
13 changed files with 33 additions and 249 deletions

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Dialog = RhSolutions.Models.Dialog;
using Range = Microsoft.Office.Interop.Excel.Range;
namespace RhSolutions.Controllers
{

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using RhSolutions.Models;
using System.Linq;
using Range = Microsoft.Office.Interop.Excel.Range;
namespace RhSolutions.Controllers
{

View File

@ -7,6 +7,7 @@ using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Range = Microsoft.Office.Interop.Excel.Range;
namespace RhSolutions.Controllers
{

View File

@ -5,6 +5,7 @@ using RhSolutions.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using Range = Microsoft.Office.Interop.Excel.Range;
namespace RhSolutions.Controllers
{

View File

@ -1,116 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using System;
using System.Text.RegularExpressions;
namespace RhSolutions.Models
{
public class Sku
{
private const string matchPattern = @"([1\D]|\b)(?<Article>\d{6})([1\s-]|)(?<Variant>\d{3})\b";
private string _article;
private string _variant;
public Sku(string article, string variant)
{
Article = article;
Variant = variant;
}
public string Id
{
get
{
return $"1{Article}1{Variant}";
}
set
{
if (TryParse(value, out IEnumerable<Sku> skus))
{
if (skus.Count() > 1)
{
throw new ArgumentException($"More than one valid sku detected: {value}");
}
else
{
this.Article = skus.First().Article;
this.Variant = skus.First().Variant;
}
}
else
{
throw new ArgumentException($"Invalid sku input: {value}");
}
}
}
public string Article
{
get
{
return _article;
}
set
{
if (value == null || value.Length != 6 || value.Where(c => char.IsDigit(c)).Count() != 6)
{
throw new ArgumentException($"Wrong Article: {Article}");
}
else
{
_article = value;
}
}
}
public string Variant
{
get
{
return _variant;
}
set
{
if (value == null || value.Length != 3 || value.Where(c => char.IsDigit(c)).Count() != 3)
{
throw new ArgumentException($"Wrong Variant: {Variant}");
}
else _variant = value;
}
}
public static IEnumerable<Sku> GetValidSkus(string line)
{
MatchCollection matches = Regex.Matches(line, matchPattern);
if (matches.Count == 0)
{
yield break;
}
else
{
foreach (Match m in matches)
{
yield return new Sku(m.Groups["Article"].Value, m.Groups["Variant"].Value);
}
}
}
public static bool TryParse(string line, out IEnumerable<Sku> skus)
{
MatchCollection matches = Regex.Matches(line, matchPattern);
if (matches.Count == 0)
{
skus = Enumerable.Empty<Sku>();
return false;
}
else
{
skus = GetValidSkus(line);
return true;
}
}
public override string ToString()
{
return $"1{Article}1{Variant}";
}
}
}

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Range = Microsoft.Office.Interop.Excel.Range;
namespace RhSolutions.Models
{

View File

@ -2,6 +2,7 @@
using System;
using System.IO;
using System.Linq;
using Range = Microsoft.Office.Interop.Excel.Range;
namespace RhSolutions.Models
{

View File

@ -1,6 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@ -32,5 +33,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.3.1")]
[assembly: AssemblyFileVersion("1.2.3.1")]
[assembly: AssemblyVersion("1.2.4.0")]
[assembly: AssemblyFileVersion("1.2.4.0")]

View File

@ -0,0 +1,9 @@
{
"profiles": {
"Excel": {
"commandName": "Executable",
"executablePath": "C:\\Program Files\\Microsoft Office\\root\\Office16\\EXCEL.EXE",
"commandLineArgs": "RhSolutions-AddIn64.xll"
}
}
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<DnaLibrary Name="RhXlPLugin" RuntimeVersion="v4.0" xmlns="http://schemas.excel-dna.net/addin/2020/07/dnalibrary">
<ExternalLibrary Path="RhXlPLugin.dll" ExplicitRegistration="true" LoadFromBytes="true" Pack="true" IncludePdb="false" />
<Reference Path="ExcelDna.Registration.dll" Pack="true" />
<Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
</DnaLibrary>

View File

@ -3,8 +3,10 @@
<ExternalLibrary Path="RhSolutions.AddIn.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" IncludePdb="false" />
<Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
<Reference Path="Newtonsoft.Json.dll" Pack="true" />
<Reference Path="RhSolutions.Sku.dll" Pack="true" />
<!--
<!--
The RuntimeVersion attribute above allows only the following setting:
* RuntimeVersion="v4.0" - for .NET 4.5 or higher

View File

@ -1,126 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.props" Condition="Exists('..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{18A2FF67-0E46-4A86-B872-29F2B3F23ADF}</ProjectGuid>
<TargetFrameworks>net472;net6.0-windows</TargetFrameworks>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RhSolutions.AddIn</RootNamespace>
<AssemblyName>RhSolutions.AddIn</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="ExcelDna.Integration, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f225e9659857edbe, processorArchitecture=MSIL">
<HintPath>..\packages\ExcelDna.Integration.1.6.0\lib\net452\ExcelDna.Integration.dll</HintPath>
</Reference>
<Reference Include="ExcelDna.IntelliSense, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f225e9659857edbe, processorArchitecture=MSIL">
<HintPath>..\packages\ExcelDna.IntelliSense.1.6.0\lib\net452\ExcelDna.IntelliSense.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\ExcelDna.Interop.15.0.0\lib\net452\Microsoft.Office.Interop.Excel.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.Vbe.Interop, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\ExcelDna.Interop.15.0.0\lib\net452\Microsoft.Vbe.Interop.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\ExcelDna.Interop.15.0.0\lib\net452\Office.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.OracleClient" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.Caching" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<PackageReference Include="ExcelDna.AddIn" Version="1.6.0" />
<PackageReference Include="ExcelDna.IntelliSense" Version="1.6.0" />
<PackageReference Include="ExcelDna.Interop" Version="15.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="RhSolutions.Sku" Version="0.1.1" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Compile Include="Services\EventsUtil.cs" />
<Compile Include="Services\RhDatabaseClient.cs" />
<Compile Include="Models\Sku.cs" />
<Compile Include="Models\StatusbarBase.cs" />
<Compile Include="Models\Dialog.cs" />
<Compile Include="Services\RegistryUtil.cs" />
<Compile Include="Models\ProgressBar.cs" />
<Compile Include="Models\ResultBar.cs" />
<Compile Include="Controllers\CombineTool.cs" />
<Compile Include="Controllers\ConvertTool.cs" />
<Compile Include="Models\Product.cs" />
<Compile Include="Controllers\ToolBase.cs" />
<Compile Include="Controllers\MergeTool.cs" />
<Compile Include="Models\PriceListBase.cs" />
<Compile Include="Models\PriceListHeaders.cs" />
<Compile Include="Models\SourcePriceList.cs" />
<Compile Include="Models\TargetPriceList.cs" />
<Compile Include="Controllers\RibbonController.cs" />
<Compile Include="Controllers\ExportTool.cs" />
<Compile Include="AddIn\RhSolutionsAddIn.cs" />
<Compile Include="AddIn\Functions.cs" />
<Compile Include="Models\WorksheetExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="RhSolutions-AddIn.dna" />
<None Include="packages.config" />
<None Include="Properties\ExcelDna.Build.props" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\ExcelDna.AddIn.1.5.1\build\ExcelDna.AddIn.targets" Condition="Exists('packages\ExcelDna.AddIn.1.5.1\build\ExcelDna.AddIn.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\ExcelDna.Interop.15.0.0\build\ExcelDna.Interop.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ExcelDna.Interop.15.0.0\build\ExcelDna.Interop.targets'))" />
<Error Condition="!Exists('..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.props'))" />
<Error Condition="!Exists('..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.targets'))" />
</Target>
<Import Project="..\packages\ExcelDna.Interop.15.0.0\build\ExcelDna.Interop.targets" Condition="Exists('..\packages\ExcelDna.Interop.15.0.0\build\ExcelDna.Interop.targets')" />
<Import Project="..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.targets" Condition="Exists('..\packages\ExcelDna.AddIn.1.6.0\build\ExcelDna.AddIn.targets')" />
</Project>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ExcelDna.AddIn" version="1.6.0" targetFramework="net48" />
<package id="ExcelDna.Integration" version="1.6.0" targetFramework="net48" />
<package id="ExcelDna.IntelliSense" version="1.6.0" targetFramework="net48" />
<package id="ExcelDna.Interop" version="15.0.0" targetFramework="net48" />
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net48" />
</packages>