Skip to content

Commit

Permalink
Merge branch '3.0-poc' into 3.0-poc-draft
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-visionaid committed Oct 20, 2024
2 parents e3dd49d + 7391580 commit 1ef3a73
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions OpenMcdf3.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35327.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenMcdf3", "D:\OpenMcdf3\OpenMcdf3\OpenMcdf3.csproj", "{B90DDE7E-803A-4890-82F0-09DAD0FF66D8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenMcdf3", "OpenMcdf3\OpenMcdf3.csproj", "{B90DDE7E-803A-4890-82F0-09DAD0FF66D8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenMcdf3.Tests", "D:\OpenMcdf3\OpenMcdf3.Tests\OpenMcdf3.Tests.csproj", "{96A9DA9C-E4C2-4531-A2E4-154F1FBF7532}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenMcdf3.Tests", "OpenMcdf3.Tests\OpenMcdf3.Tests.csproj", "{96A9DA9C-E4C2-4531-A2E4-154F1FBF7532}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{34030FA7-0A06-43D1-85DD-ADD39D502C3C}"
ProjectSection(SolutionItems) = preProject
Expand Down
6 changes: 3 additions & 3 deletions OpenMcdf3/DirectoryEntryEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace OpenMcdf3;

/// <summary>
/// Enumerates <see cref="DirectoryEntry"/> instances from a <see cref="FatSectorChainEnumerator"/>.
/// Enumerates <see cref="DirectoryEntry"/> instances from a <see cref="FatChainEnumerator"/>.
/// </summary>
internal sealed class DirectoryEntryEnumerator : IEnumerator<DirectoryEntry>
{
private readonly IOContext ioContext;
private readonly Version version;
private readonly int entryCount;
private readonly FatSectorChainEnumerator chainEnumerator;
private readonly FatChainEnumerator chainEnumerator;
private int entryIndex = -1;
private DirectoryEntry? current;

Expand All @@ -19,7 +19,7 @@ public DirectoryEntryEnumerator(IOContext ioContext)
this.ioContext = ioContext;
this.version = (Version)ioContext.Header.MajorVersion;
this.entryCount = ioContext.Header.SectorSize / DirectoryEntry.Length;
this.chainEnumerator = new FatSectorChainEnumerator(ioContext, ioContext.Header.FirstDirectorySectorId);
this.chainEnumerator = new FatChainEnumerator(ioContext, ioContext.Header.FirstDirectorySectorId);
}

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ namespace OpenMcdf3;
/// <summary>
/// Enumerates the <see cref="Sector"/>s in a FAT sector chain.
/// </summary>
internal sealed class FatSectorChainEnumerator : IEnumerator<Sector>
internal sealed class FatChainEnumerator : IEnumerator<Sector>
{
private readonly IOContext ioContext;
private readonly FatSectorEnumerator fatEnumerator;
private readonly uint startId;
private bool start = true;
private Sector current = Sector.EndOfChain;

public FatSectorChainEnumerator(IOContext ioContext, uint startSectorId)
public FatChainEnumerator(IOContext ioContext, uint startSectorId)
{
this.ioContext = ioContext;
this.startId = startSectorId;
Expand Down
3 changes: 3 additions & 0 deletions OpenMcdf3/FatSectorEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public bool MoveNext()
/// </summary>
public bool MoveTo(uint sectorId)
{
if (sectorId > SectorType.Maximum)
throw new ArgumentOutOfRangeException(nameof(sectorId));

if (sectorId < id)
Reset();

Expand Down
2 changes: 1 addition & 1 deletion OpenMcdf3/FatStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
internal class FatStream : Stream
{
readonly IOContext ioContext;
readonly FatSectorChainEnumerator chain;
readonly FatChainEnumerator chain;
readonly long length;
long position;
bool disposed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ namespace OpenMcdf3;
/// <summary>
/// Enumerates the <see cref="MiniSector"/>s in a Mini FAT sector chain.
/// </summary>
internal sealed class MiniFatSectorChainEnumerator : IEnumerator<MiniSector>
internal sealed class MiniFatChainEnumerator : IEnumerator<MiniSector>
{
private readonly MiniFatSectorEnumerator miniFatEnumerator;
private readonly uint startId;
private bool start = true;
private MiniSector current = MiniSector.EndOfChain;

public MiniFatSectorChainEnumerator(IOContext ioContext, uint startSectorId)
public MiniFatChainEnumerator(IOContext ioContext, uint startSectorId)
{
this.startId = startSectorId;
miniFatEnumerator = new(ioContext);
Expand Down
2 changes: 1 addition & 1 deletion OpenMcdf3/MiniFatSectorEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace OpenMcdf3;
internal sealed class MiniFatSectorEnumerator : IEnumerator<MiniSector>
{
private readonly IOContext ioContext;
private readonly FatSectorChainEnumerator fatChain;
private readonly FatChainEnumerator fatChain;
bool start = true;
MiniSector current = MiniSector.EndOfChain;

Expand Down
2 changes: 1 addition & 1 deletion OpenMcdf3/MiniFatStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
internal sealed class MiniFatStream : Stream
{
readonly IOContext ioContext;
readonly MiniFatSectorChainEnumerator chain;
readonly MiniFatChainEnumerator chain;
readonly FatStream fatStream;
readonly long length;
long position;
Expand Down

0 comments on commit 1ef3a73

Please sign in to comment.