wabbajack/Wabbajack.Paths.IO/BinaryReaderExtensions.cs
2021-10-23 10:51:17 -06:00

23 lines
534 B
C#

using System.IO;
namespace Wabbajack.Paths.IO;
public static class BinaryReaderExtensions
{
public static IPath ReadIPath(this BinaryReader rdr)
{
if (rdr.ReadBoolean()) return rdr.ReadAbsolutePath();
return rdr.ReadRelativePath();
}
public static AbsolutePath ReadAbsolutePath(this BinaryReader rdr)
{
return rdr.ReadString().ToAbsolutePath();
}
public static RelativePath ReadRelativePath(this BinaryReader rdr)
{
return rdr.ReadString().ToRelativePath();
}
}