Skip to content

Commit

Permalink
fix: Fixes .net 6 compilation (#860)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman authored Nov 22, 2021
1 parent c8043e8 commit c8a6d4c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Authors>Kamron Batman</Authors>
<Company>ModernUO</Company>
<Copyright>2019-2020</Copyright>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64</Platforms>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>preview</LangVersion>
Expand Down Expand Up @@ -56,7 +56,7 @@
<ItemGroup>
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<Version>3.4.244</Version>
<PrivateAssets>all</PrivateAssets>
Expand Down
14 changes: 8 additions & 6 deletions Projects/SerializationGenerator/SerializationGenerator.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>preview</LangVersion>
<BuildOutputTargetFolder>analyzers</BuildOutputTargetFolder>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" />
<PackageReference Include="Humanizer.Core" Version="2.11.10" GeneratePathProperty="true" PrivateAssets="all" />
<PackageReference Include="System.Text.Json" Version="5.0.0" GeneratePathProperty="true" PrivateAssets="all" />
<PackageReference Include="System.Text.Encodings.Web" Version="5.0.0" GeneratePathProperty="true" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
<PackageReference Include="Humanizer.Core" Version="2.13.14" GeneratePathProperty="true" PrivateAssets="all" />
<PackageReference Include="System.Text.Json" Version="6.0.0" GeneratePathProperty="true" PrivateAssets="all" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" GeneratePathProperty="true" PrivateAssets="all" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" GeneratePathProperty="true" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup>
Expand All @@ -22,6 +23,7 @@
<TargetPathWithTargetPlatformMoniker Include="$(PKGHumanizer_Core)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
<TargetPathWithTargetPlatformMoniker Include="$(PKGSystem_Text_Json)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
<TargetPathWithTargetPlatformMoniker Include="$(PKGSystem_Text_Encodings_Web)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
<TargetPathWithTargetPlatformMoniker Include="$(PKGMicrosoft_Bcl_AsyncInterfaces)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
</ItemGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<OutDir>Output</OutDir>
</PropertyGroup>

Expand All @@ -14,7 +13,10 @@

<ItemGroup>
<PackageReference Include="Microsoft.Build.Locator" Version="1.4.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.0.1" />
<PackageReference Include="System.Text.Json" Version="6.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Projects/Server/Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Delete Files="..\..\Distribution\zlib.dll" ContinueOnError="true" />
</Target>
<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.HighPerformance" Version="7.1.0" />
<PackageReference Include="Microsoft.Toolkit.HighPerformance" Version="7.1.2" />
<PackageReference Include="PollGroup" Version="1.1.0" />
<PackageReference Include="Zlib.Bindings" Version="1.5.0" />
</ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions Projects/Server/Utilities/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,21 @@ public static int RandomMinMax(int min, int max)
return min + (int)RandomSources.Source.Next((uint)(max - min + 1));
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static long RandomMinMax(long min, long max)
{
if (min > max)
{
(min, max) = (max, min);
}
else if (min == max)
{
return min;
}

return min + RandomSources.Source.Next(max - min + 1);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Random(int from, int count) => RandomSources.Source.Next(from, count);

Expand Down
8 changes: 4 additions & 4 deletions Projects/UOContent/Items/Construction/Ankhs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public override void OnClick()
[Serializable(0, false)]
public partial class AnkhWest : Item
{
[SerializableField(0)]
[SerializableField(0, getter: "private", setter: "private")]
private InternalItem _item;

[Constructible]
Expand Down Expand Up @@ -184,7 +184,7 @@ public override void OnAfterDelete()
}

[Serializable(0, false)]
private class InternalItem : Item
private partial class InternalItem : Item
{
[SerializableField(0)]
private AnkhWest _item;
Expand Down Expand Up @@ -260,7 +260,7 @@ public override void OnDoubleClickDead(Mobile m)
[Serializable(0, false)]
public partial class AnkhNorth : Item
{
[SerializableField(0)]
[SerializableField(0, getter: "private", setter: "private")]
private InternalItem _item;

[Constructible]
Expand Down Expand Up @@ -332,7 +332,7 @@ public override void OnAfterDelete()

[TypeAlias("Server.Items.AnkhEast+InternalItem")]
[Serializable(0, false)]
private class InternalItem : Item
private partial class InternalItem : Item
{
[SerializableField(0)]
private AnkhNorth _item;
Expand Down
2 changes: 1 addition & 1 deletion Projects/UOContent/UOContent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</ProjectReference>
<PackageReference Include="MailKit" Version="2.15.0" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="6.0.0" />
<PackageReference Include="Microsoft.Toolkit.HighPerformance" Version="7.1.0" />
<PackageReference Include="Microsoft.Toolkit.HighPerformance" Version="7.1.2" />
<PackageReference Include="Zlib.Bindings" Version="1.5.0" />
<PackageReference Include="Argon2.Bindings" Version="1.9.1" />
<PackageReference Include="Zstd.Binaries" Version="1.0.0" />
Expand Down

0 comments on commit c8a6d4c

Please sign in to comment.