wabbajack/Wabbajack.Paths.IO/BinaryReaderExtensions.cs

23 lines
534 B
C#
Raw Permalink Normal View History

2021-09-27 12:42:46 +00:00
using System.IO;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.Paths.IO;
public static class BinaryReaderExtensions
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
public static IPath ReadIPath(this BinaryReader rdr)
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
if (rdr.ReadBoolean()) return rdr.ReadAbsolutePath();
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
return rdr.ReadRelativePath();
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public static AbsolutePath ReadAbsolutePath(this BinaryReader rdr)
{
return rdr.ReadString().ToAbsolutePath();
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public static RelativePath ReadRelativePath(this BinaryReader rdr)
{
return rdr.ReadString().ToRelativePath();
2021-09-27 12:42:46 +00:00
}
}