Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating all projects in the primary solution to net8.0 #551

Merged
merged 4 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bat/link_json_to_blazorserver_release_publish_8.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mklink /J "..\BlazorServer\bin\Release\net8.0\publish\Json" "..\Json"
PAUSE
2 changes: 2 additions & 0 deletions .bat/link_json_to_headlessserver_release_publish_8.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mklink /J "..\HeadlessServer\bin\Release\net8.0\publish\Json" "..\Json"
PAUSE
2 changes: 1 addition & 1 deletion .github/workflows/dotnet_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions BlazorServer/BlazorServer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<nullable>enable</nullable>
<UserSecretsId>84fcf2b0-dc89-4b31-b09b-fdd65679d1d2</UserSecretsId>
<ApplicationManifest>app.manifest</ApplicationManifest>
Expand Down Expand Up @@ -36,7 +36,7 @@
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.3.0" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.2" />
<PackageReference Include="Serilog.Expressions" Version="3.4.1" />
<PackageReference Include="Serilog.Expressions" Version="4.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
</ItemGroup>

Expand Down
16 changes: 8 additions & 8 deletions Core/AddonComponent/BuffStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void Update(IAddonDataProvider reader)
public bool Mark_of_the_Wild() => v[Mask._10];
public bool Thorns() => v[Mask._11];

[Names(new[] { "Tiger's Fury" })]
[Names(["Tiger's Fury"])]
public bool Tigers_Fury() => v[Mask._12];
public bool Prowl() => v[Mask._13];
public bool Rejuvenation() => v[Mask._14];
Expand Down Expand Up @@ -74,11 +74,11 @@ public void Update(IAddonDataProvider reader)
public bool Divine_Shield() => v[Mask._23];

// Mage
[Names(new[] {
[Names([
"Frost Armor",
"Ice Armor",
"Molten Armor",
"Mage Armor" })]
"Mage Armor"])]
public bool Frost_Armor() => v[Mask._10];
public bool Arcane_Intellect() => v[Mask._11];
public bool Ice_Barrier() => v[Mask._12];
Expand All @@ -97,9 +97,9 @@ public void Update(IAddonDataProvider reader)
public bool Bloodrage() => v[Mask._11];

// Warlock
[Names(new[] {
[Names([
"Demon Skin",
"Demon Armor" })]
"Demon Armor"])]
public bool Demon_Skin() => v[Mask._10]; //Skin and Armor
public bool Soul_Link() => v[Mask._11];
public bool Soulstone_Resurrection() => v[Mask._12];
Expand All @@ -112,9 +112,9 @@ public void Update(IAddonDataProvider reader)
// Shaman
public bool Lightning_Shield() => v[Mask._10];
public bool Water_Shield() => v[Mask._11];
[Names(new[] {
[Names([
"Shamanistic Focus",
"Focused" })]
"Focused"])]
public bool Shamanistic_Focus() => v[Mask._12];
public bool Stoneskin() => v[Mask._13];

Expand All @@ -135,7 +135,7 @@ public void Update(IAddonDataProvider reader)
public bool Horn_of_Winter() => v[Mask._11];
public bool Icebound_Fortitude() => v[Mask._12];
public bool Path_of_Frost() => v[Mask._13];
[Names(new[] { "Anti-Magic Shell" })]
[Names(["Anti-Magic Shell"])]
public bool Anti_Magic_Shell() => v[Mask._14];
public bool Army_of_the_Dead() => v[Mask._15];
public bool Vampiric_Blood() => v[Mask._16];
Expand Down
8 changes: 4 additions & 4 deletions Core/AddonComponent/TargetDebuffStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override string ToString()
}

// Priest
[Names(new[] { "Shadow Word: Pain" })]
[Names(["Shadow Word: Pain"])]
public bool Shadow_Word_Pain() => v[Mask._0];

// Druid
Expand Down Expand Up @@ -53,21 +53,21 @@ public override string ToString()
public bool Charge_Stun() => v[Mask._3];

// Warlock
[Names(new[] {
[Names([
"Curse of Weakness",
"Curse of Elements",
"Curse of Recklessness",
"Curse of Shadow",
"Curse of Agony",
"Curse of" })]
"Curse of"])]
public bool Curse_of() => v[Mask._0];
public bool Corruption() => v[Mask._1];
public bool Immolate() => v[Mask._2];
public bool Siphon_Life() => v[Mask._3];

// Hunter
public bool Serpent_Sting() => v[Mask._0];
[Names(new[] { "Hunter's Mark" })]
[Names(["Hunter's Mark"])]
public bool Hunters_Mark() => v[Mask._1];
public bool Viper_Sting() => v[Mask._2];
public bool Explosive_Shot() => v[Mask._3];
Expand Down
14 changes: 10 additions & 4 deletions Core/Configurator/AddonConfigurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Core;

public sealed class AddonConfigurator
public sealed partial class AddonConfigurator
{
private readonly ILogger<AddonConfigurator> logger;
private readonly WowProcess process;
Expand Down Expand Up @@ -56,7 +56,7 @@ public bool Validate()
// this will appear in the lua code so
// special character not allowed
// also numbers not allowed
Config.Title = Regex.Replace(Config.Title, @"[^\u0000-\u007F]+", string.Empty);
Config.Title = RegexTitle().Replace(Config.Title, string.Empty);
Config.Title = new string(Config.Title.Where(char.IsLetter).ToArray());
Config.Title =
Config.Title.Trim()
Expand Down Expand Up @@ -197,7 +197,7 @@ private void EditMainLua()
.Replace("dc", Config.Command)
.Replace("DC", Config.Command);

Regex cellSizeRegex = new(@"^local CELL_SIZE = (?<SIZE>[0-9]+)", RegexOptions.Multiline);
Regex cellSizeRegex = RegexCellSize();
text = text.Replace(cellSizeRegex, "SIZE", Config.CellSize);

File.WriteAllText(mainLuaPath, text);
Expand Down Expand Up @@ -313,12 +313,18 @@ public bool UpdateAvailable()
return null;

string begin = "## Version: ";
var line = File
string? line = File
.ReadLines(tocPath)
.SkipWhile(line => !line.StartsWith(begin))
.FirstOrDefault();

string? versionStr = line?.Split(begin)[1];
return Version.TryParse(versionStr, out Version? version) ? version : null;
}

[GeneratedRegex(@"[^\u0000-\u007F]+")]
private static partial Regex RegexTitle();

[GeneratedRegex(@"^local CELL_SIZE = (?<SIZE>[0-9]+)", RegexOptions.Multiline)]
private static partial Regex RegexCellSize();
}
8 changes: 4 additions & 4 deletions Core/Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64;x86</Platforms>
<nullable>enable</nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
Expand All @@ -13,10 +13,10 @@

<ItemGroup>
<PackageReference Include="GameOverlay.Net" Version="4.3.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 5 additions & 2 deletions Core/Goals/GoapGoal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Core.Goals;

public abstract class GoapGoal
public abstract partial class GoapGoal
{
public Dictionary<GoapKey, bool> Preconditions { get; } = new();
public Dictionary<GoapKey, bool> Effects { get; } = new();
Expand All @@ -33,7 +33,7 @@ protected set

protected GoapGoal(string name)
{
string output = Regex.Replace(name.Replace("Goal", ""), @"\p{Lu}", m => " " + m.Value.ToUpperInvariant());
string output = RegexGoalName().Replace(name.Replace("Goal", ""), m => " " + m.Value.ToUpperInvariant());
DisplayName = Name = string.Concat(output[0].ToString().ToUpper(), output.AsSpan(1));
}

Expand All @@ -58,4 +58,7 @@ protected void AddEffect(GoapKey key, bool value)
{
Effects[key] = value;
}

[GeneratedRegex(@"\p{Lu}")]
private static partial Regex RegexGoalName();
}
4 changes: 2 additions & 2 deletions Core/Requirement/RequirementFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ public Requirement CreateRequirement(string requirement)
return r;
}

if (!boolVariables.ContainsKey(requirement))
if (!boolVariables.TryGetValue(requirement, out Func<bool>? value))
{
LogUnknown(logger, requirement, string.Join(", ", boolVariables.Keys));
return new Requirement
Expand All @@ -694,7 +694,7 @@ public Requirement CreateRequirement(string requirement)
string s() => requirement;
Requirement req = new()
{
HasRequirement = boolVariables[requirement],
HasRequirement = value,
LogMessage = s
};

Expand Down
2 changes: 1 addition & 1 deletion Core/Session/LocalGrindSessionDAO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public IEnumerable<GrindSession> Load()
.OrderByDescending(grindingSession => grindingSession.SessionStart)
.ToList();

if (sessions.Any())
if (sessions.Count != 0)
{
int[] expList = ExperienceProvider.Get(dataConfig);
foreach (GrindSession? s in sessions)
Expand Down
6 changes: 3 additions & 3 deletions CoreTests/CoreTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64;x86</Platforms>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
Expand Down
10 changes: 7 additions & 3 deletions CoreTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public static void Main()
});

// its expected to have at least 2 DataFrame
DataFrame[] mockFrames = new DataFrame[2]
{
DataFrame[] mockFrames =
[
new DataFrame(0, 0, 0),
new DataFrame(1, 0, 0),
};
];

cts = new CancellationTokenSource();
process = new(cts);
Expand Down Expand Up @@ -83,6 +83,8 @@ private static void Test_NPCNameFinder()

Log.Logger.Information($"running {count} samples...");

screen.Enabled = true;

while (i < count)
{
if (LogOverallTimes)
Expand All @@ -97,6 +99,8 @@ private static void Test_NPCNameFinder()
Thread.Sleep(4);
}

screen.Enabled = false;

if (LogOverallTimes)
{
Log.Logger.Information($"overall | sample: {count:D4} | avg: {sample.Average():F2} | min: {sample.Min():F2} | max: {sample.Max():000.000} | total: {sample.Sum():F2}");
Expand Down
2 changes: 1 addition & 1 deletion DataConfig/DataConfig.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions Frontend/Frontend.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x64;x86</Platforms>
Expand All @@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="BlazorTable" Version="1.17.0" />
<PackageReference Include="MatBlazor" Version="2.10.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Game/Game.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64;x86</Platforms>
</PropertyGroup>

Expand Down
6 changes: 3 additions & 3 deletions Game/Input/WowProcessInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public sealed partial class WowProcessInput : IMouseInput

private readonly WowProcess process;
private readonly InputWindowsNative nativeInput;
private readonly IInput simulatorInput;
private readonly InputSimulator simulatorInput;

private readonly BitArray keysDown;

Expand All @@ -39,8 +39,8 @@ public WowProcessInput(ILogger<WowProcessInput> logger, CancellationTokenSource

keysDown = new((int)ConsoleKey.OemClear);

nativeInput = new InputWindowsNative(process, cts, InputDuration.FastPress);
simulatorInput = new InputSimulator(process, cts, InputDuration.FastPress);
nativeInput = new(process, cts, InputDuration.FastPress);
simulatorInput = new(process, cts, InputDuration.FastPress);
}

public void Reset()
Expand Down
10 changes: 5 additions & 5 deletions HeadlessServer/HeadlessServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ApplicationManifest>app.manifest</ApplicationManifest>
Expand All @@ -11,11 +11,11 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Serilog.Expressions" Version="3.4.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Serilog.Expressions" Version="4.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
Expand Down
Loading