diff --git a/src/LibHac/IO/StorageExtensions.cs b/src/LibHac/IO/StorageExtensions.cs index 2b362ca4..f4d5bcd7 100644 --- a/src/LibHac/IO/StorageExtensions.cs +++ b/src/LibHac/IO/StorageExtensions.cs @@ -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); + } } }