This commit is contained in:
zmjack 2021-03-10 01:27:18 +08:00
parent e57ec23521
commit 1abd0a5691
12 changed files with 13 additions and 123 deletions

View File

@ -1,4 +1,4 @@
using PortProxyGUI._extern.NStandard;
using NStandard;
using System;
using System.Data;
using System.Linq;

View File

@ -1,4 +1,4 @@
using PortProxyGUI._extern.NStandard;
using NStandard;
using System;
using System.Linq;
using System.Text.RegularExpressions;

View File

@ -12,6 +12,9 @@
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@ -27,9 +30,6 @@
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -174,11 +174,11 @@
</ItemGroup>
<Import Project="..\PortProxyGUI.Shared\PortProxyGUI.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net45\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net45\Stub.System.Data.SQLite.Core.NetFramework.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\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net45\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net45\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
</Target>
<Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net45\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net45\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
</Project>

View File

@ -1,4 +1,4 @@
using PortProxyGUI._extern.NStandard;
using NStandard;
using System;
using System.Data;
using System.Linq;

View File

@ -1,4 +1,4 @@
using PortProxyGUI._extern.NStandard;
using NStandard;
using System;
using System.Linq;
using System.Text.RegularExpressions;

View File

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
</configuration>

View File

@ -1,4 +1,4 @@
using PortProxyGUI._extern.NStandard;
using NStandard;
using PortProxyGUI.Data;
using System;
using System.Linq;
@ -22,7 +22,7 @@ namespace PortProxyGUI
var proxies = types.SelectMany(type =>
{
var typeProxies = output
.Project(new Regex($@"{type.From}:[^\n]+?{type.To}:\r\n\r\n.+?\r\n--------------- ---------- --------------- ----------\r\n(.+?)\r\n\r\n", RegexOptions.Singleline))
.ExtractFirst(new Regex($@"{type.From}:[^\n]+?{type.To}:\r\n\r\n.+?\r\n--------------- ---------- --------------- ----------\r\n(.+?)\r\n\r\n", RegexOptions.Singleline))
?.Split(new[] { Environment.NewLine }, StringSplitOptions.None)
.Select(line =>
{

View File

@ -18,7 +18,5 @@
<Compile Include="$(MSBuildThisFileDirectory)Data\Rule.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ListViewColumnSorter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ProxyType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)~extern\NStandard\XString.cs" />
<Compile Include="$(MSBuildThisFileDirectory)~extern\NStandard\XObject.cs" />
</ItemGroup>
</Project>

View File

@ -1,23 +0,0 @@
using System;
using System.ComponentModel;
namespace PortProxyGUI._extern.NStandard
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class XObject
{
/// <summary>
/// Do a task for itself, then return itself.
/// </summary>
/// <typeparam name="TSelf"></typeparam>
/// <param name="this"></param>
/// <param name="task"></param>
/// <returns></returns>
public static TSelf Then<TSelf>(this TSelf @this, Action<TSelf> task)
{
task(@this);
return @this;
}
}
}

View File

@ -1,74 +0,0 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Text.RegularExpressions;
namespace PortProxyGUI._extern.NStandard
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class XString
{
/// <summary>
/// Indicates whether the string matches the specified regular expression.
/// </summary>
/// <param name="this"></param>
/// <param name="regex"></param>
/// <returns></returns>
public static bool IsMatch(this string @this, Regex regex) => regex.Match(@this).Success;
/// <summary>
/// Projects the specified string to a new string by using regular expressions.
/// If there is no match, this method returns null.
/// </summary>
/// <param name="this"></param>
/// <param name="regex"></param>
/// <param name="target"></param>
/// <returns></returns>
public static string Project(this string @this, Regex regex, string target = null)
{
var match = regex.Match(@this);
if (match.Success)
{
if (target is null)
return string.Join("", match.Groups.OfType<Group>().Skip(1).Select(g => g.Value).ToArray());
else return regex.Replace(match.Groups[0].Value, target);
}
else return null;
}
/// <summary>
/// Projects the specified string to an array by using regular expressions.
/// </summary>
/// <param name="this"></param>
/// <param name="regex"></param>
/// <returns></returns>
public static string[][] Resolve(this string @this, Regex regex)
{
if (TryResolve(@this, regex, out var ret)) return ret;
else throw new ArgumentNullException("Can not match the sepecifed Regex.");
}
/// <summary>
/// Projects the specified string to an array by using regular expressions.
/// </summary>
/// <param name="this"></param>
/// <param name="regex"></param>
/// <returns></returns>
public static bool TryResolve(this string @this, Regex regex, out string[][] ret)
{
var match = regex.Match(@this);
if (match.Success)
{
ret = match.Groups.OfType<Group>()
.Select(g => g.Captures.OfType<Capture>().Select(c => c.Value).ToArray()).ToArray();
return true;
}
else
{
ret = null;
return false;
}
}
}
}

View File

@ -1,4 +1,4 @@
using PortProxyGUI._extern.NStandard;
using NStandard;
using System;
using System.Data;
using System.Linq;

View File

@ -1,4 +1,4 @@
using PortProxyGUI._extern.NStandard;
using NStandard;
using System;
using System.Linq;
using System.Text.RegularExpressions;