Skip to content

Commit 094ff81

Browse files
committed
DiscFileSystem.RawStream implementation
1 parent 3613972 commit 094ff81

File tree

32 files changed

+104
-33
lines changed

32 files changed

+104
-33
lines changed

Library/DiscUtils.Btrfs/Context.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public Context(BtrfsFileSystemOptions options)
4242

4343
public BtrfsFileSystemOptions Options { get; private set; }
4444

45-
public Stream RawStream { get; set; }
45+
public override Stream RawStream { get; set; }
4646

4747
public SuperBlock SuperBlock { get; set; }
4848

Library/DiscUtils.Core/DiscFileSystem.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ protected DiscFileSystem(DiscFileSystemOptions defaultOptions)
7676
/// <returns>true if the file system is read-write.</returns>
7777
public abstract bool CanWrite { get; }
7878

79+
/// <summary>
80+
/// Gets underlying raw volume stream, if available.
81+
/// </summary>
82+
/// <returns>Underlying raw volume stream, or null if not available.</returns>
83+
public abstract Stream RawStream { get; }
84+
7985
private DiscDirectoryInfo _root;
8086

8187
/// <summary>

Library/DiscUtils.Core/FileSystemParameters.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// DEALINGS IN THE SOFTWARE.
2121
//
2222

23+
using System.Collections.Specialized;
2324
using System.Text;
2425

2526
namespace DiscUtils;
@@ -45,4 +46,9 @@ public sealed class FileSystemParameters
4546
/// time (local time where the file system is authored) to UTC time. This parameter determines
4647
/// the algorithm to use.</remarks>
4748
public TimeConverter TimeConverter { get; set; }
49+
50+
/// <summary>
51+
/// Other string parameters for file systems.
52+
/// </summary>
53+
public StringDictionary Parameters { get; } = new();
4854
}

Library/DiscUtils.Core/NativeFileSystem.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public class NativeFileSystem : DiscFileSystem
3939
{
4040
private readonly bool _readOnly;
4141

42+
public override Stream RawStream { get; }
43+
4244
/// <summary>
4345
/// Initializes a new instance of the NativeFileSystem class.
4446
/// </summary>

Library/DiscUtils.Core/Vfs/VfsContext.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020
// DEALINGS IN THE SOFTWARE.
2121
//
2222

23+
using System.IO;
24+
2325
namespace DiscUtils.Vfs;
2426

2527
/// <summary>
2628
/// Base class for a context object that holds global state for file system implementations.
2729
/// </summary>
28-
public abstract class VfsContext {}
30+
public abstract class VfsContext
31+
{
32+
public abstract Stream RawStream { get; set; }
33+
}

Library/DiscUtils.Core/Vfs/VfsFileSystem.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
// DEALINGS IN THE SOFTWARE.
2121
//
2222

23+
using DiscUtils.Internal;
24+
using DiscUtils.Streams;
2325
using System;
2426
using System.Collections.Generic;
2527
using System.Diagnostics;
28+
using System.Drawing;
2629
using System.IO;
2730
using System.Linq;
28-
using DiscUtils.Internal;
29-
using DiscUtils.Streams;
3031

3132
namespace DiscUtils.Vfs;
3233

@@ -72,6 +73,8 @@ protected VfsFileSystem(DiscFileSystemOptions defaultOptions)
7273
/// </summary>
7374
public abstract override string VolumeLabel { get; }
7475

76+
public override Stream RawStream => Context.RawStream;
77+
7578
/// <summary>
7679
/// Copies a file - not supported on read-only file systems.
7780
/// </summary>

Library/DiscUtils.Core/Vfs/VfsFileSystemFacade.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
// DEALINGS IN THE SOFTWARE.
2121
//
2222

23+
using DiscUtils.Streams;
2324
using System;
2425
using System.Collections.Generic;
2526
using System.IO;
26-
using DiscUtils.Streams;
2727

2828
namespace DiscUtils.Vfs;
2929

@@ -38,6 +38,8 @@ public abstract class VfsFileSystemFacade : DiscFileSystem
3838
{
3939
private readonly DiscFileSystem _wrapped;
4040

41+
public override Stream RawStream => _wrapped.RawStream;
42+
4143
/// <summary>
4244
/// Initializes a new instance of the VfsFileSystemFacade class.
4345
/// </summary>

Library/DiscUtils.Ext/Context.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal class Context : VfsContext
2929
{
3030
public ExtFileSystemOptions Options { get; set; }
3131

32-
public Stream RawStream { get; set; }
32+
public override Stream RawStream { get; set; }
3333

3434
public SuperBlock SuperBlock { get; set; }
3535

Library/DiscUtils.Fat/FatFileSystem.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ public FatFileSystem(Stream data, Ownership ownsData, FileSystemParameters param
164164
_ownsData = ownsData;
165165
}
166166

167+
public override Stream RawStream => _data;
168+
167169
/// <summary>
168170
/// Gets the active FAT (zero-based index).
169171
/// </summary>

Library/DiscUtils.HfsPlus/Context.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ internal sealed class Context : VfsContext
3434
public BTree<ExtentKey> ExtentsOverflow { get; set; }
3535

3636
public VolumeHeader VolumeHeader { get; set; }
37-
public Stream VolumeStream { get; set; }
37+
38+
public override Stream RawStream { get; set; }
3839
}

0 commit comments

Comments
 (0)