Skip to content

Commit

Permalink
Utilities: ReadItems: Set Central package management - Update NugetPa…
Browse files Browse the repository at this point in the history
…ckages
  • Loading branch information
Xian55 committed Sep 9, 2024
1 parent 4d27958 commit 3da252f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
15 changes: 9 additions & 6 deletions Utilities/ReadItems/ConsoleApp10/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace ConsoleApp10
{
internal sealed class Program
internal sealed partial class Program
{
internal sealed class Creature
{
Expand Down Expand Up @@ -64,7 +64,7 @@ private static void ExtractItemTemplate(string file, string template, Action<str
line = line.Trim();
if (line.StartsWith(template))
{
var rx = new Regex(@"\(\d.*?\)(,|;)");
var rx = MyRegex();
MatchCollection matches = rx.Matches(line);
foreach(var match in matches)
{
Expand Down Expand Up @@ -106,18 +106,18 @@ private static string[] splitLine(string line)

if (line.Substring(i, 1) == ",")
{
var value = line.Substring(startIndex, i - startIndex);
if (value.StartsWith("'"))
var value = line[startIndex..i];
if (value.StartsWith('\''))
{
value = value.Substring(1, value.Length - 2);
value = value[1..^1];
}

result.Add(value);
startIndex = i + 1;
}
}
}
return result.ToArray();
return [.. result];
}

private static int FindIndex(List<string> columnIndexs, string v)
Expand All @@ -131,5 +131,8 @@ private static int FindIndex(List<string> columnIndexs, string v)
}
throw new ArgumentOutOfRangeException(v);
}

[GeneratedRegex(@"\(\d.*?\)(,|;)")]
public static partial Regex MyRegex();
}
}
5 changes: 2 additions & 3 deletions Utilities/ReadItems/ConsoleApp10/ReadWowDb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions Utilities/ReadItems/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>

0 comments on commit 3da252f

Please sign in to comment.