Add keepOpen parameter to AsStream and AsStorage

This commit is contained in:
Alex Barney 2018-12-11 13:59:46 -06:00
parent b5c9e13df3
commit 9e3c41ed2c

View file

@ -42,6 +42,7 @@ namespace LibHac.IO
}
public static Stream AsStream(this IStorage storage) => new StorageStream(storage, true);
public static Stream AsStream(this IStorage storage, bool keepOpen) => new StorageStream(storage, keepOpen);
public static void CopyTo(this IStorage input, IStorage output, IProgressReport progress = null)
{
@ -112,6 +113,12 @@ namespace LibHac.IO
return new StreamStorage(stream, true);
}
public static Storage AsStorage(this Stream stream, bool keepOpen)
{
if (stream == null) return null;
return new StreamStorage(stream, keepOpen);
}
public static Storage AsStorage(this Stream stream, long start)
{
if (stream == null) return null;
@ -123,5 +130,11 @@ namespace LibHac.IO
if (stream == null) return null;
return new StreamStorage(stream, true).Slice(start, length);
}
public static Storage AsStorage(this Stream stream, long start, int length, bool keepOpen)
{
if (stream == null) return null;
return new StreamStorage(stream, keepOpen).Slice(start, length);
}
}
}