continuity/Wonderking/Game/Reader/GenericReaderExtensions.cs
Timothy Schenk f5cd6c380e
Some checks failed
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 27s
Build, Package and Push Images / sonarqube (push) Has been skipped
Build, Package and Push Images / sbom-scan (push) Successful in 33s
Build, Package and Push Images / container-build (push) Failing after 1m10s
Build, Package and Push Images / container-sbom-scan (push) Has been skipped
feat: Itemdata pooling & benchmarks for storage options
2023-11-08 19:04:37 +01:00

37 lines
853 B
C#

/* Nicht gemergte Änderung aus Projekt "Wonderking(net7.0)"
Vor:
using System.Runtime.InteropServices;
using System.Text;
Nach:
using System.Text;
*/
using System.Text;
namespace Wonderking.Game.Reader;
public static class GenericReaderExtensions
{
public static string ReadString(this BinaryReader reader, int length)
{
var ret = Encoding.ASCII.GetString(reader.ReadBytes(length)).Replace("\0", "");
return ret;
}
public static T[] ReadArray<T>(this BinaryReader pReader, int pLength) where T : new()
{
var array = new T[pLength];
for (var index = 0; index < pLength; ++index)
{
array[index] = pReader.Read<T>();
}
return array;
}
public static T Read<T>(this BinaryReader br) where T : new()
{
return BinaryReader<T>.Read(br);
}
}