wabbajack/Wabbajack.Paths.IO/BinaryReaderExtensions.cs
2021-09-27 06:42:46 -06:00

24 lines
600 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();
}
}
}