diff --git a/GoRogue.Debugger/GoRogue.Debugger.csproj b/GoRogue.Debugger/GoRogue.Debugger.csproj
index 2e06592f..2d6fcfa2 100644
--- a/GoRogue.Debugger/GoRogue.Debugger.csproj
+++ b/GoRogue.Debugger/GoRogue.Debugger.csproj
@@ -62,7 +62,7 @@
-
+
all
diff --git a/GoRogue.PerformanceTests/GoRogue.PerformanceTests.csproj b/GoRogue.PerformanceTests/GoRogue.PerformanceTests.csproj
index e69f592b..30d6cbaf 100644
--- a/GoRogue.PerformanceTests/GoRogue.PerformanceTests.csproj
+++ b/GoRogue.PerformanceTests/GoRogue.PerformanceTests.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/GoRogue.Snippets/HowTos/FOV.cs b/GoRogue.Snippets/HowTos/FOV.cs
index d7d72197..54d0ce8d 100644
--- a/GoRogue.Snippets/HowTos/FOV.cs
+++ b/GoRogue.Snippets/HowTos/FOV.cs
@@ -1,4 +1,5 @@
-#region Usings
+// ReSharper disable NotAccessedPositionalProperty.Local
+#region Usings
using GoRogue.FOV;
using GoRogue.MapGeneration;
using SadRogue.Primitives;
diff --git a/GoRogue.UnitTests/GoRogue.UnitTests.csproj b/GoRogue.UnitTests/GoRogue.UnitTests.csproj
index a44840e1..e7075374 100644
--- a/GoRogue.UnitTests/GoRogue.UnitTests.csproj
+++ b/GoRogue.UnitTests/GoRogue.UnitTests.csproj
@@ -18,10 +18,10 @@
-
+
all
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/GoRogue/DisjointSet.cs b/GoRogue/DisjointSet.cs
index 50811602..0531859d 100644
--- a/GoRogue/DisjointSet.cs
+++ b/GoRogue/DisjointSet.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
+using SadRogue.Primitives;
namespace GoRogue
{
diff --git a/GoRogue/Effects/EffectTriggerBase.cs b/GoRogue/Effects/EffectTriggerBase.cs
index c7a680c3..b3783cac 100644
--- a/GoRogue/Effects/EffectTriggerBase.cs
+++ b/GoRogue/Effects/EffectTriggerBase.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
+using SadRogue.Primitives;
namespace GoRogue.Effects
{
diff --git a/GoRogue/Factories/ItemNotDefinedException.cs b/GoRogue/Factories/ItemNotDefinedException.cs
index bda771c4..ac81e538 100644
--- a/GoRogue/Factories/ItemNotDefinedException.cs
+++ b/GoRogue/Factories/ItemNotDefinedException.cs
@@ -1,5 +1,4 @@
using System;
-using System.Runtime.Serialization;
using JetBrains.Annotations;
namespace GoRogue.Factories
@@ -28,15 +27,6 @@ public ItemNotDefinedException(string message, Exception innerException)
: base(message, innerException)
{ }
- ///
- /// Creates an exception based on serialization context.
- ///
- ///
- ///
- protected ItemNotDefinedException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- { }
-
///
/// Creates an exception with a message based on the specified factory ID.
///
diff --git a/GoRogue/GameFramework/MapIterators.cs b/GoRogue/GameFramework/MapIterators.cs
index 52460de2..f08f328d 100644
--- a/GoRogue/GameFramework/MapIterators.cs
+++ b/GoRogue/GameFramework/MapIterators.cs
@@ -67,7 +67,9 @@ public bool MoveNext()
if (_entitiesEnumerator.MoveNext())
{
- _current = _entitiesEnumerator.Current;
+ // Suppression is required by .NET 8
+ // ReSharper disable once RedundantSuppressNullableWarningExpression
+ _current = _entitiesEnumerator.Current!;
return true;
}
diff --git a/GoRogue/GoRogue.csproj b/GoRogue/GoRogue.csproj
index 7fd7aec7..adacd06f 100644
--- a/GoRogue/GoRogue.csproj
+++ b/GoRogue/GoRogue.csproj
@@ -1,7 +1,7 @@
- netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0
+ netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0
GoRogue
Chris3606
Copyright © 2023 Christopher Ridley (Chris3606)
@@ -11,7 +11,7 @@
Configure versioning information, making sure to append "debug" to Debug version to allow publishing
to NuGet seperately from Release version.
-->
- 3.0.0-beta08
+ 3.0.0-beta09
$(Version)-debug
@@ -79,10 +79,10 @@
-
+
all
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/GoRogue/Utility.cs b/GoRogue/Utility.cs
index 49816e62..7ded369b 100644
--- a/GoRogue/Utility.cs
+++ b/GoRogue/Utility.cs
@@ -1,10 +1,7 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-using System.Text;
using JetBrains.Annotations;
-using SadRogue.Primitives.GridViews;
namespace GoRogue
{
@@ -28,238 +25,6 @@ public static ReadOnlyDictionary AsReadOnly(
where TKey : notnull
=> new ReadOnlyDictionary(dictionary);
- ///
- /// Extension method for that allows retrieving a string
- /// representing the contents.
- ///
- ///
- /// Built-in C# data structures like implement ,
- /// and as such this method can be used to stringify the contents of C# built-in data structures.
- /// When no customization parameters are specified, it defaults to a representation looking something
- /// like [elem1, elem2, elem3].
- ///
- ///
- ///
- /// Character(s) that should precede the string representation of the IEnumerable's elements.
- ///
- /// Function to use to get the string representation of each element. Specifying null uses the ToString
- /// function of type T.
- ///
- /// Characters to separate the IEnumerable's elements by.
- /// Character(s) that should follow the string representation of the IEnumerable's elements.
- /// A string representation of the IEnumerable.
- public static string ExtendToString(this IEnumerable enumerable, string begin = "[",
- Func? elementStringifier = null, string separator = ", ",
- string end = "]")
- {
- elementStringifier ??= obj => obj?.ToString() ?? "null";
-
- var result = new StringBuilder(begin);
- var first = true;
- foreach (var item in enumerable)
- {
- if (first)
- first = false;
- else
- result.Append(separator);
-
- result.Append(elementStringifier(item));
- }
-
- result.Append(end);
-
- return result.ToString();
- }
-
- ///
- /// Extension method for that allows retrieving a string representing the
- /// contents.
- ///
- ///
- /// Built-in C# data structures like implement ,
- /// and as such this method can be used to stringify the contents of C# built-in set structures.
- /// When no customization parameters are specified, it defaults to a representation looking something
- /// like set(elem1, elem2, elem3).
- ///
- ///
- ///
- /// Character(s) that should precede the string representation of the set's elements.
- ///
- /// Function to use to get the string representation of each element. Specifying null uses the ToString
- /// function of type T.
- ///
- /// Characters to separate the set's items by.
- /// Character(s) that should follow the string representation of the set's elements.
- /// A string representation of the ISet.
- public static string ExtendToString(this ISet set, string begin = "set(",
- Func? elementStringifier = null, string separator = ", ",
- string end = ")")
- => ExtendToString((IEnumerable)set, begin, elementStringifier, separator, end);
-
- ///
- /// Extension method for dictionaries that allows retrieving a string representing the dictionary's contents.
- ///
- ///
- /// Built-in C# data structures like implement ,
- /// and as such this method can be used to stringify the contents of C# built-in dictionary structures.
- /// When no customization parameters are specified, it defaults to a representation looking something
- /// like {key1 : value, key2 : value}.
- ///
- ///
- ///
- ///
- /// Character(s) that should precede the string representation of the dictionary's elements.
- ///
- /// Function to use to get the string representation of each key. Specifying null uses the ToString
- /// function of type K.
- ///
- ///
- /// Function to use to get the string representation of each value. Specifying null uses the ToString
- /// function of type V.
- ///
- /// Characters used to separate each value from its key.
- /// Characters used to separate each key-value pair from the next.
- /// Character(s) that should follow the string representation of the dictionary's elements.
- /// A string representation of the IDictionary.
- public static string ExtendToString(this IDictionary dictionary, string begin = "{",
- Func? keyStringifier = null,
- Func? valueStringifier = null,
- string kvSeparator = " : ", string pairSeparator = ", ",
- string end = "}")
- where TKey : notnull
- {
- keyStringifier ??= obj => obj.ToString() ?? "null";
-
- valueStringifier ??= obj => obj?.ToString() ?? "null";
-
- var result = new StringBuilder(begin);
- var first = true;
- foreach (var (key, value) in dictionary)
- {
- if (first)
- first = false;
- else
- result.Append(pairSeparator);
-
- result.Append(keyStringifier(key) + kvSeparator + valueStringifier(value));
- }
-
- result.Append(end);
-
- return result.ToString();
- }
-
- ///
- /// Extension method for 2D arrays that allows retrieving a string representing the contents.
- ///
- ///
- ///
- /// Character(s) that should precede the string representation of the 2D array.
- /// Character(s) that should precede the string representation of each row.
- ///
- /// Function to use to get the string representation of each value. Specifying null uses the ToString
- /// function of type T.
- ///
- /// Character(s) used to separate each row from the next.
- /// Character(s) used to separate each element from the next.
- /// Character(s) that should follow the string representation of each row.
- /// Character(s) that should follow the string representation of the 2D array.
- /// A string representation of the 2D array.
- public static string ExtendToString(this T[,] array, string begin = "[\n", string beginRow = "\t[",
- Func? elementStringifier = null,
- string rowSeparator = ",\n", string elementSeparator = ", ",
- string endRow = "]", string end = "\n]")
- {
- elementStringifier ??= obj => obj?.ToString() ?? "null";
-
- var result = new StringBuilder(begin);
- for (var x = 0; x < array.GetLength(0); x++)
- {
- result.Append(beginRow);
- for (var y = 0; y < array.GetLength(1); y++)
- {
- result.Append(elementStringifier(array[x, y]));
- if (y != array.GetLength(1) - 1) result.Append(elementSeparator);
- }
-
- result.Append(endRow);
- if (x != array.GetLength(0) - 1) result.Append(rowSeparator);
- }
-
- result.Append(end);
- return result.ToString();
- }
-
- ///
- /// Extension method for 2D arrays that allows retrieving a string representing the contents,
- /// formatted as if the 2D array represents a coordinate plane/grid.
- ///
- ///
- /// This differs from
- ///
- /// in that this method prints the array
- /// such that array[x+1, y] is printed to the RIGHT of array[x, y], rather than BELOW it.
- /// Effectively it assumes the indexes being used are grid/coordinate plane coordinates.
- ///
- ///
- ///
- /// Character(s) that should precede the string representation of the 2D array.
- /// Character(s) that should precede the string representation of each row.
- ///
- /// Function to use to get the string representation of each value. Specifying null uses the ToString
- /// function of type T.
- ///
- /// Character(s) used to separate each row from the next.
- /// Character(s) used to separate each element from the next.
- /// Character(s) that should follow the string representation of each row.
- /// Character(s) that should follow the string representation of the 2D array.
- ///
- /// A string representation of the 2D array, formatted as if the array represents a 2D coordinate plane/grid map.
- ///
- public static string ExtendToStringGrid(this T[,] array, string begin = "", string beginRow = "",
- Func? elementStringifier = null,
- string rowSeparator = "\n", string elementSeparator = " ",
- string endRow = "", string end = "")
- => new ArrayView2D(array).ExtendToString(begin, beginRow, elementStringifier, rowSeparator,
- elementSeparator, endRow, end);
-
- ///
- /// Extension method for 2D arrays that allows retrieving a string representing the contents,
- /// formatted as if the 2D array represents a coordinate plane/grid.
- ///
- ///
- /// This differs from
- ///
- /// in that this method prints the array such that array[x+1, y] is printed to the RIGHT of array[x, y], rather than BELOW
- /// it.
- /// Effectively it assumes the indexes being used are grid/coordinate plane coordinates.
- ///
- ///
- ///
- ///
- /// The amount of space each element should take up in characters. A positive number aligns
- /// the text to the right of the space, while a negative number aligns the text to the left.
- ///
- /// Character(s) that should precede the string representation of the 2D array.
- /// Character(s) that should precede the string representation of each row.
- ///
- /// Function to use to get the string representation of each value. Specifying null uses the ToString
- /// function of type T.
- ///
- /// Character(s) used to separate each row from the next.
- /// Character(s) used to separate each element from the next.
- /// Character(s) that should follow the string representation of each row.
- /// Character(s) that should follow the string representation of the 2D array.
- ///
- /// A string representation of the 2D array, formatted as if the array represents a 2D coordinate plane/grid map.
- ///
- public static string ExtendToStringGrid(this T[,] array, int fieldSize, string begin = "",
- string beginRow = "", Func? elementStringifier = null,
- string rowSeparator = "\n", string elementSeparator = " ",
- string endRow = "", string end = "")
- => new ArrayView2D(array).ExtendToString(fieldSize, begin, beginRow, elementStringifier, rowSeparator,
- elementSeparator, endRow, end);
-
///
/// "Multiplies", aka repeats, a string the given number of times.
///
diff --git a/changelog.md b/changelog.md
index 0c9f8a1b..514cb037 100644
--- a/changelog.md
+++ b/changelog.md
@@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- None
+## [3.0.0-beta09] - 2023-12-05
+### Removed
+- `ExtendToString` and `ExtendToStringGrid` extension methods from `Utility` class are removed (they now exist in the primitives library instead)
+
## [3.0.0-beta08] - 2023-07-12
### Added