mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-12 11:11:45 +00:00
Ongoing FAT work.
This commit is contained in:
parent
3e5dd5f34b
commit
2beb8b3e18
4 changed files with 23 additions and 4 deletions
|
|
@ -80,6 +80,7 @@
|
|||
<Compile Include="FileSystem\FAT\FatFileStream.cs" />
|
||||
<Compile Include="FileSystem\FAT\Listing\FatDirectory.cs" />
|
||||
<Compile Include="FileSystem\FAT\Listing\FatFile.cs" />
|
||||
<Compile Include="FileSystem\FAT\TestFatDirectoryStream.cs" />
|
||||
<Compile Include="FileSystem\FileSystem.cs" />
|
||||
<Compile Include="FileSystem\Listing\Base.cs" />
|
||||
<Compile Include="FileSystem\Listing\Directory.cs" />
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ namespace Cosmos.System.FileSystem.FAT
|
|||
mFirstClusterNumber = firstClusterNumber;
|
||||
mFileSystem = fileSystem;
|
||||
|
||||
if (mFileOrDirectory.Size > 0)
|
||||
mSize = mFileOrDirectory.Size;
|
||||
if (mSize > 0)
|
||||
{
|
||||
mFatTable = mFileSystem.GetFatTable(firstClusterNumber);
|
||||
}
|
||||
|
|
@ -66,11 +67,12 @@ namespace Cosmos.System.FileSystem.FAT
|
|||
{
|
||||
FatHelpers.Debug("No FileOrDirectory!");
|
||||
}
|
||||
return (long) mFileOrDirectory.Size;
|
||||
return (long) mSize;
|
||||
}
|
||||
}
|
||||
|
||||
protected UInt64 mPosition;
|
||||
private ulong mSize;
|
||||
|
||||
public override sealed long Position
|
||||
{
|
||||
|
|
@ -112,7 +114,7 @@ namespace Cosmos.System.FileSystem.FAT
|
|||
// FirstSector can be 0 for 0 length files
|
||||
return 0;
|
||||
}
|
||||
if (mPosition == mFileOrDirectory.Size)
|
||||
if (mPosition == mSize)
|
||||
{
|
||||
// EOF
|
||||
return 0;
|
||||
|
|
@ -120,7 +122,7 @@ namespace Cosmos.System.FileSystem.FAT
|
|||
|
||||
// reduce count, so that no out of bound exception occurs if not existing
|
||||
// entry is used in line mFS.ReadCluster(mFatTable[(int)xClusterIdx], xCluster);
|
||||
ulong xMaxReadableBytes = mFileOrDirectory.Size - mPosition;
|
||||
ulong xMaxReadableBytes = mSize - mPosition;
|
||||
ulong xCount = (ulong) aCount;
|
||||
if (xCount > xMaxReadableBytes)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -412,6 +412,7 @@ namespace Cosmos.System.FileSystem.FAT
|
|||
}
|
||||
|
||||
using (var xStream = new FatDirectoryStream((FatDirectory)baseDirectory))
|
||||
//using(var xStream = new TestFatDirectoryStream((FatDirectory)baseDirectory))
|
||||
{
|
||||
return GetDirectoryContents((FatDirectory) baseDirectory, xStream);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Cosmos.System.FileSystem.FAT.Listing;
|
||||
|
||||
namespace Cosmos.System.FileSystem.FAT
|
||||
{
|
||||
public class TestFatDirectoryStream: BaseFatStream
|
||||
{
|
||||
public TestFatDirectoryStream(FatDirectory directory) : base(directory, directory.FileSystem, directory.FirstClusterNum)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue