fix: Fixes compiling with .NET 7 SDK (#1176)
This commit is contained in:
parent
060edaa76a
commit
cd5541ec74
27 changed files with 106 additions and 1 deletions
|
|
@ -316,7 +316,11 @@ public ref struct PooledRefQueue<T>
|
|||
}
|
||||
|
||||
// Increments the index wrapping it if necessary.
|
||||
#if NET7_SDK
|
||||
private void MoveNext(scoped ref int index)
|
||||
#else
|
||||
private void MoveNext(ref int index)
|
||||
#endif
|
||||
{
|
||||
// It is tempting to use the remainder operator here but it is actually much slower
|
||||
// than a simple comparison and a rarely taken branch.
|
||||
|
|
|
|||
|
|
@ -36,7 +36,11 @@ public class GumpAlphaRegion : GumpEntry
|
|||
|
||||
public int Height { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.WriteAscii($"{{ checkertrans {X} {Y} {Width} {Height} }}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,11 @@ public class GumpBackground : GumpEntry
|
|||
|
||||
public int GumpID { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.WriteAscii($"{{ resizepic {X} {Y} {GumpID} {Width} {Height} }}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,11 @@ public class GumpButton : GumpEntry
|
|||
|
||||
public int Param { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.WriteAscii($"{{ button {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} }}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,11 @@ public class GumpCheck : GumpEntry
|
|||
|
||||
public int SwitchID { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
var initialState = InitialState ? "1" : "0";
|
||||
writer.WriteAscii($"{{ checkbox {X} {Y} {InactiveID} {ActiveID} {initialState} {SwitchID} }}");
|
||||
|
|
|
|||
|
|
@ -22,7 +22,11 @@ public class GumpECHandleInput : GumpEntry
|
|||
{
|
||||
private static byte[] _layout = Gump.StringToBuffer("{ echandleinput }");
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.Write(_layout);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,5 +25,9 @@ public abstract class GumpEntry
|
|||
|
||||
// TODO: Replace OrderedHashSet with InsertOnlyHashSet, a copy of HashSet that is ReadOnly compatible, but includes
|
||||
// a public AddIfNotPresent function that returns the index of the element
|
||||
#if NET7_SDK
|
||||
public abstract void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches);
|
||||
#else
|
||||
public abstract void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,11 @@ public class GumpGroup : GumpEntry
|
|||
|
||||
public int Group { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
if (Group == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,11 @@ public class GumpHtml : GumpEntry
|
|||
|
||||
public bool Scrollbar { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
var textIndex = strings.GetOrAdd(Text ?? "");
|
||||
var background = Background ? "1" : "0";
|
||||
|
|
|
|||
|
|
@ -101,7 +101,11 @@ public class GumpHtmlLocalized : GumpEntry
|
|||
public GumpHtmlLocalizedType Type { get; set; }
|
||||
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
var background = Background ? "1" : "0";
|
||||
var scrollbar = Scrollbar ? "1" : "0";
|
||||
|
|
|
|||
|
|
@ -39,7 +39,11 @@ public class GumpImage : GumpEntry
|
|||
|
||||
public string Class { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
var hasHue = Hue != 0;
|
||||
var hasClass = !string.IsNullOrEmpty(Class);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,11 @@ public class GumpImageTileButton : GumpEntry
|
|||
|
||||
public int Height { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.WriteAscii(
|
||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,11 @@ public class GumpImageTiled : GumpEntry
|
|||
|
||||
public int GumpID { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.WriteAscii($"{{ gumppictiled {X} {Y} {Width} {Height} {GumpID} }}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,11 @@ public class GumpItem : GumpEntry
|
|||
|
||||
public int Hue { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.WriteAscii(Hue == 0 ? $"{{ tilepic {X} {Y} {ItemID} }}" : $"{{ tilepichue {X} {Y} {ItemID} {Hue} }}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,11 @@ public class GumpItemProperty : GumpEntry
|
|||
|
||||
public Serial Serial { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.WriteAscii($"{{ itemproperty {Serial.Value} }}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,11 @@ public class GumpLabel : GumpEntry
|
|||
|
||||
public string Text { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
var textIndex = strings.GetOrAdd(Text ?? "");
|
||||
writer.WriteAscii($"{{ text {X} {Y} {Hue} {textIndex} }}");
|
||||
|
|
|
|||
|
|
@ -42,7 +42,11 @@ public class GumpLabelCropped : GumpEntry
|
|||
|
||||
public string Text { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
var textIndex = strings.GetOrAdd(Text ?? "");
|
||||
writer.WriteAscii($"{{ croppedtext {X} {Y} {Width} {Height} {Hue} {textIndex} }}");
|
||||
|
|
|
|||
|
|
@ -24,7 +24,11 @@ public class GumpMasterGump : GumpEntry
|
|||
|
||||
public int GumpID { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.WriteAscii($"{{ mastergump {GumpID} }}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,11 @@ public class GumpPage : GumpEntry
|
|||
|
||||
public int Page { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
if (Page == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -42,7 +42,11 @@ public class GumpRadio : GumpEntry
|
|||
|
||||
public int SwitchID { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
var initialState = InitialState ? "1" : "0";
|
||||
writer.WriteAscii($"{{ radio {X} {Y} {InactiveID} {ActiveID} {initialState} {SwitchID} }}");
|
||||
|
|
|
|||
|
|
@ -45,7 +45,11 @@ public class GumpSpriteImage : GumpEntry
|
|||
|
||||
public int SY { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.WriteAscii($"{{ picinpic {X} {Y} {GumpID} {Width} {Height} {SX} {SY} }}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,11 @@ public class GumpTextEntry : GumpEntry
|
|||
|
||||
public string InitialText { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
var textIndex = strings.GetOrAdd(InitialText ?? "");
|
||||
writer.WriteAscii($"{{ textentry {X} {Y} {Width} {Height} {Hue} {EntryID} {textIndex} }}");
|
||||
|
|
|
|||
|
|
@ -50,7 +50,11 @@ public class GumpTextEntryLimited : GumpEntry
|
|||
|
||||
public int Size { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
var textIndex = strings.GetOrAdd(InitialText ?? "");
|
||||
writer.WriteAscii($"{{ textentrylimited {X} {Y} {Width} {Height} {Hue} {EntryID} {textIndex} {Size} }}");
|
||||
|
|
|
|||
|
|
@ -32,7 +32,11 @@ public class GumpTooltip : GumpEntry
|
|||
|
||||
public string Args { get; set; }
|
||||
|
||||
#if NET7_SDK
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, scoped ref int entries, scoped ref int switches)
|
||||
#else
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
#endif
|
||||
{
|
||||
writer.WriteAscii(string.IsNullOrEmpty(Args) ? $"{{ tooltip {Number} }}" : $"{{ tooltip {Number} @{Args}@ }}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<PublishDir>..\..\Distribution</PublishDir>
|
||||
<OutDir>..\..\Distribution</OutDir>
|
||||
<Version>0.0.0</Version>
|
||||
<DefineConstants Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '7.0'))">NET7_SDK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<Target Name="CleanPub" AfterTargets="Clean">
|
||||
<Message Text="Removing distribution files..." />
|
||||
|
|
@ -22,7 +23,6 @@
|
|||
<Delete Files="..\..\Distribution\$(AssemblyName).runtimeconfig.dev.json" ContinueOnError="true" />
|
||||
<Delete Files="..\..\Distribution\$(AssemblyName).runtimeconfig.json" ContinueOnError="true" />
|
||||
<Delete Files="..\..\Distribution\ModernUO.Serialization.Annotations.dll" ContinueOnError="true" />
|
||||
<Delete Files="..\..\Distribution\ModernUO.SerializationGenerator.dll" ContinueOnError="true" />
|
||||
<Delete Files="..\..\Distribution\libz.dylib" ContinueOnError="true" />
|
||||
<Delete Files="..\..\Distribution\libz.so" ContinueOnError="true" />
|
||||
<Delete Files="..\..\Distribution\Microsoft.Toolkit.HighPerformance.dll" ContinueOnError="true" />
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<Product>ModernUO Content</Product>
|
||||
<PublishDir>..\..\Distribution\Assemblies</PublishDir>
|
||||
<OutDir>..\..\Distribution\Assemblies</OutDir>
|
||||
<DefineConstants Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '7.0'))">NET7_SDK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<Target Name="CleanPub" AfterTargets="Clean">
|
||||
<Message Text="Removing distribution assemblies..." />
|
||||
|
|
@ -33,6 +34,7 @@
|
|||
<Delete Files="..\..\Distribution\Assemblies\zstd" ContinueOnError="true" />
|
||||
<Delete Files="..\..\Distribution\Assemblies\zstd.exe" ContinueOnError="true" />
|
||||
<Delete Files="..\..\Distribution\Assemblies\Zstd.Binaries.dll" ContinueOnError="true" />
|
||||
<Delete Files="..\..\Distribution\Assemblies\ModernUO.Serialization.Annotations.dll" ContinueOnError="true" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Server\Server.csproj" Private="false" PrivateAssets="All" IncludeAssets="None">
|
||||
|
|
|
|||
7
global.json
Normal file
7
global.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "6.0.400",
|
||||
"rollForward": "latestMajor",
|
||||
"allowPrerelease": false
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue