Skip to content

Commit 1014736

Browse files
committed
misc: net8->net6.
1 parent 0d5895c commit 1014736

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

src/Irihi.Rough.NET/Dependencies/HachureFill/HachureFillFunctions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private static List<RoughLine> StraightHachureLines(IList<List<PointF>> polygons
103103
ix = i;
104104
}
105105

106-
var removed = edges[..(ix + 1)].ToList();
106+
var removed = edges.GetRange(0, ix + 1);
107107
activeEdges.AddRange(removed.Select(edge => new ActiveEdgeEntry { S = y, Edge = edge }));
108108
edges.RemoveRange(0, ix + 1);
109109
}

src/Irihi.Rough.NET/Dependencies/PathDataParser/PathDataParserFunctions.cs

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33

44
namespace Irihi.Rough.NET.Dependencies.PathDataParser;
55

6-
internal partial class RegexHelper
6+
internal static class RegexHelper
77
{
8-
[GeneratedRegex(@"^([ \t\r\n,]+)")]
9-
internal static partial Regex WhiteSpaceRegex();
10-
11-
[GeneratedRegex(@"^([aAcChHlLmMqQsStTvVzZ])")]
12-
internal static partial Regex CommandRegex();
13-
14-
[GeneratedRegex(@"^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)")]
15-
internal static partial Regex NumberRegex();
8+
internal static readonly Regex WhiteSpaceRegex = new(@"^([ \t\r\n,]+)", RegexOptions.Compiled);
9+
internal static readonly Regex CommandRegex = new(@"^([aAcChHlLmMqQsStTvVzZ])", RegexOptions.Compiled);
10+
internal static readonly Regex NumberRegex = new(@"^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)", RegexOptions.Compiled);
1611
}
1712

1813
public static class PathDataParserFunctions
@@ -30,33 +25,31 @@ internal static List<PathToken> Tokenize(string d)
3025

3126
while (span.Length > 0)
3227
{
33-
if (RegexHelper.WhiteSpaceRegex().IsMatch(span))
28+
var spanStr = span.ToString();
29+
if (RegexHelper.WhiteSpaceRegex.IsMatch(spanStr))
3430
{
35-
foreach (var match in RegexHelper.WhiteSpaceRegex().EnumerateMatches(span))
31+
var match = RegexHelper.WhiteSpaceRegex.Match(spanStr);
32+
if (match.Length > 0)
3633
{
37-
if (match.Length == 0) continue;
3834
span = span[match.Length..];
39-
break;
4035
}
4136
}
42-
else if (RegexHelper.CommandRegex().IsMatch(span))
37+
else if (RegexHelper.CommandRegex.IsMatch(spanStr))
4338
{
44-
foreach (var match in RegexHelper.CommandRegex().EnumerateMatches(span))
39+
var match = RegexHelper.CommandRegex.Match(spanStr);
40+
if (match.Length > 0)
4541
{
46-
if (match.Length == 0) continue;
4742
tokens.Add(new PathToken(TokenType.Command, span.Slice(match.Index, match.Length).ToString()));
4843
span = span[match.Length..];
49-
break;
5044
}
5145
}
52-
else if (RegexHelper.NumberRegex().IsMatch(span))
46+
else if (RegexHelper.NumberRegex.IsMatch(spanStr))
5347
{
54-
foreach (var match in RegexHelper.NumberRegex().EnumerateMatches(span))
48+
var match = RegexHelper.NumberRegex.Match(spanStr);
49+
if (match.Length > 0)
5550
{
56-
if (match.Length == 0) continue;
5751
tokens.Add(new PathToken(TokenType.Number, span.Slice(match.Index, match.Length).ToString()));
5852
span = span[match.Length..];
59-
break;
6053
}
6154
}
6255
else
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
global using System;
2+
global using System.Linq;
3+
global using System.Collections.Generic;
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
5-
<LangVersion>latestmajor</LangVersion>
6-
<ImplicitUsings>enable</ImplicitUsings>
4+
<TargetFramework>net6.0</TargetFramework>
75
<Nullable>enable</Nullable>
6+
<LangVersion>latest</LangVersion>
7+
<Version>0.0.1</Version>
8+
<Authors>IRIHI Technology Co., Ltd.</Authors>
9+
<Description>Roughjs for .NET</Description>
10+
<RepositoryUrl>https://github.com/irihitech/Irihi.Rough.NET</RepositoryUrl>
11+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
12+
<PackageIcon>irihi.png</PackageIcon>
13+
<PackageProjectUrl>https://github.com/irihitech/Irihi.Rough.NET</PackageProjectUrl>
814
</PropertyGroup>
915

1016
</Project>

0 commit comments

Comments
 (0)