public static bool DirectoryExists(string aPath) { try { FatHelpers.Debug("DirectoryExists. Path = '" + aPath + "'"); //xDir = Path.GetDirectoryName(xDir); FatHelpers.Debug("Before VFSManager.GetDirectory"); var xDirectory = VFSManager.TryGetDirectory(aPath); if (xDirectory == null) { FatHelpers.Debug("Directory not found!"); FatHelpers.Debug(aPath); return(false); } FatHelpers.Debug("Directory.Name:"); FatHelpers.Debug(xDirectory.Name); return(xDirectory != null); } catch (Exception E) { FatHelpers.Debug("Exception occurred in VFSManager.DirectoryExists: "); FatHelpers.Debug(E.Message); return(false); } }
public static Listing.File TryGetFile(string aPath) { if (aPath == null) { throw new Exception("Path can not be null."); } FatHelpers.Debug("In VFSManager.TryGetFile"); FatHelpers.Debug(aPath); string xFileName = Path.GetFileName(aPath); string xDirectory = Path.GetDirectoryName(aPath); var xLastChar = xDirectory[xDirectory.Length - 1]; if (xLastChar != Path.DirectorySeparatorChar) { xDirectory = xDirectory + Path.DirectorySeparatorChar; } FatHelpers.Debug("Now Try to get directory listing"); var xList = GetDirectoryListing(xDirectory); for (int i = 0; i < xList.Count; i++) { var xEntry = xList[i]; var xFile = xEntry as Listing.File; if (xFile != null && String.Equals(xEntry.Name, xFileName, StringComparison.OrdinalIgnoreCase)) { FatHelpers.Debug("--- Returning file"); FatHelpers.Debug("Name"); FatHelpers.Debug(xFile.Name); return(xFile); } } return(null); }
public override List <Base> GetDirectoryListing(string aPath) { FatHelpers.Debug("In SentinelVFS.GetDirectoryListing"); var xFS = GetFileSystemFromPath(aPath); FatHelpers.Debug("Filesystem retrieved"); var xDirectory = DoGetDirectory(aPath, xFS); return(xFS.GetDirectoryListing(xDirectory)); }
public static Listing.Directory GetDirectory(string aPath) { if (string.IsNullOrEmpty(aPath)) { throw new Exception("Path can not be null."); } FatHelpers.Debug("In VFSManager.GetDirectory"); return(mVFS.GetDirectory(aPath)); }
public static Listing.Directory GetDirectory(string aPath) { if (string.IsNullOrEmpty(aPath)) { throw new ArgumentNullException("aPath"); } FatHelpers.Debug("In VFSManager.GetDirectory"); return(mVFS.GetDirectory(aPath)); }
protected virtual void InitializeFileSystems() { for (int i = 0; i < mPartitions.Count; i++) { string xRootPath = string.Concat(i, VolumeSeparatorChar, DirectorySeparatorChar); Cosmos.System.FileSystem.FileSystem xFileSystem = null; switch (Cosmos.System.FileSystem.FileSystem.GetFileSystemType(mPartitions[i])) { case FileSystemType.FAT: xFileSystem = new FatFileSystem(mPartitions[i]); mFileSystems.Add(new KVP <string, Cosmos.System.FileSystem.FileSystem>(xRootPath, xFileSystem)); break; default: FatHelpers.Debug("Unknown filesystem type!"); return; } //global::System.Console.Write("i = "); //global::System.Console.WriteLine(i.ToString()); //global::System.Console.Write("mFileSystems.Count = "); //global::System.Console.WriteLine(mFileSystems.Count); var xEntry = mFileSystems[i]; if (xEntry.Key == xRootPath) { var xFatFS = (FatFileSystem)xFileSystem; FatHelpers.Debug("-------File System--------"); FatHelpers.Debug("Bytes per Cluster: " + xFatFS.BytesPerCluster); FatHelpers.Debug("Bytes per Sector: " + xFatFS.BytesPerSector); FatHelpers.Debug("Cluster Count: " + xFatFS.ClusterCount); FatHelpers.Debug("Data Sector: " + xFatFS.DataSector); FatHelpers.Debug("Data Sector Count: " + xFatFS.DataSectorCount); FatHelpers.Debug("FAT Sector Count: " + xFatFS.FatSectorCount); FatHelpers.Debug("FAT Type: " + xFatFS.FatType); FatHelpers.Debug("Number of FATS: " + xFatFS.NumberOfFATs); FatHelpers.Debug("Reserved Sector Count: " + xFatFS.ReservedSectorCount); FatHelpers.Debug("Root Cluster: " + xFatFS.RootCluster); FatHelpers.Debug("Root Entry Count: " + xFatFS.RootEntryCount); FatHelpers.Debug("Root Sector: " + xFatFS.RootSector); FatHelpers.Debug("Root Sector Count: " + xFatFS.RootSectorCount); FatHelpers.Debug("Sectors per Cluster: " + xFatFS.SectorsPerCluster); FatHelpers.Debug("Total Sector Count: " + xFatFS.TotalSectorCount); //Console.WriteLine(); //Console.WriteLine("Mapping Drive C..."); //FatFileSystem.AddMapping("C", mFileSystem); //SentinelKernel.System.Filesystem.FAT.Listing.FatDirectory dir = new Sys.Filesystem.FAT.Listing.FatDirectory(mFileSystem, "Sentinel"); } else { FatHelpers.Debug("No filesystem found."); } } }
public static Listing.Directory TryGetDirectory(string aPath) { if (string.IsNullOrEmpty(aPath)) { throw new Exception("Path can not be null."); } FatHelpers.Debug("In VFSManager.TryGetFile"); string xFileName = Path.GetFileName(aPath); string xDirectory = Path.GetDirectoryName(aPath); FatHelpers.Debug("Filename: "); FatHelpers.Debug(xFileName); FatHelpers.Debug("Directory:"); FatHelpers.Debug(xDirectory); var xLastChar = xDirectory[xDirectory.Length - 1]; if (xLastChar != Path.DirectorySeparatorChar) { xDirectory = xDirectory + Path.DirectorySeparatorChar; } FatHelpers.Debug("Now Try to get directory listing"); var xList = GetDirectoryListing(xDirectory); FatHelpers.DebugNumber((uint)xList.Count); for (int i = 0; i < xList.Count; i++) { var xEntry = xList[i]; var xFile = xEntry as Listing.Directory; if (xFile != null && String.Equals(xEntry.Name, xFileName, StringComparison.OrdinalIgnoreCase)) { return(xFile); } else { FatHelpers.Debug("--Skipping item"); if (xFile == null) { FatHelpers.Debug(" File"); } else { FatHelpers.Debug(" Directory"); } FatHelpers.Debug(" Name"); FatHelpers.Debug(xEntry.Name); } } FatHelpers.Debug("Directory not found"); FatHelpers.Debug(xFileName); return(null); }
public FatDirectoryStream(Listing.FatDirectory aDirectory) { mDirectory = aDirectory; mFS = mDirectory.FileSystem; if (mFS == null) { FatHelpers.Debug("mFS is null!"); } if (mDirectory.Size > 0) { mFatTable = mFS.GetFatTable(mDirectory.FirstClusterNum); } }
//static void Init(IO::FileStream aThis, string path, IO::FileMode mode, IO::FileAccess access, int rights, bool useRights, IO::FileShare share, int bufferSize // , IO::FileOptions options, Microsoft.Win32.Win32Native.SECURITY_ATTRIBUTES secAttrs, string msgPath, bool bFromProxy) { } private static Stream InitializeStream(string aPath, FileMode aMode) { FatHelpers.Debug("In FileStream.InitializeStream"); if (aPath == null) { FatHelpers.Debug("In FileStream.Ctor: Path == null is true"); throw new Exception("The file path cannot be null."); } if (aPath.Length == 0) { FatHelpers.Debug("In FileStream.Ctor: Path.Length == 0 is true"); throw new Exception("The file path cannot be empty."); } return(VFSManager.GetFileStream(aPath)); }
private Directory DoGetDirectory(string aPath, Cosmos.System.FileSystem.FileSystem aFS) { if (aFS == null) { throw new Exception("File system can not be null."); } FatHelpers.Debug("In SentinelVFS.DoGetDirectory"); FatHelpers.Debug("Path = " + aPath); string[] xPathParts = VFSManager.SplitPath(aPath); if (xPathParts.Length == 1) { return(GetVolume(aFS, aPath)); } Directory xBaseDirectory = null; // start at index 1, because 0 is the volume for (int i = 1; i < xPathParts.Length; i++) { var xPathPart = xPathParts[i]; var xPartFound = false; var xListing = aFS.GetDirectoryListing(xBaseDirectory); for (int j = 0; j < xListing.Count; j++) { var xListingItem = xListing[j]; if (String.Equals(xListingItem.Name, xPathPart, StringComparison.OrdinalIgnoreCase)) { if (xListingItem is Directory) { xBaseDirectory = (Directory)xListingItem; xPartFound = true; } else { throw new Exception("Path part '" + xPathPart + "' found, but not a directory!"); } } } if (!xPartFound) { throw new Exception("Path part '" + xPathPart + "' not found!"); } } return(xBaseDirectory); }
public static bool DirectoryExists(string aPath) { try { FatHelpers.Debug("DirectoryExists. Path = '" + aPath + "'"); string xDir = aPath + VFSBase.DirectorySeparatorChar; //xDir = Path.GetDirectoryName(xDir); return(VFSManager.GetDirectory(xDir) != null); } catch (Exception E) { Console.Write("Exception occurred: "); Console.WriteLine(E.Message); return(false); } }
protected Cosmos.System.FileSystem.FileSystem GetFileSystemFromPath(string aPath) { FatHelpers.Debug("In SentinelVFS.GetFileSystemFromPath"); string xPath = Path.GetPathRoot(aPath); FatHelpers.Debug("PathRoot retrieved"); for (int i = 0; i < mFileSystems.Count; i++) { string xTest = mFileSystems[i].Key; if (String.Equals(xTest, xPath)) { return(mFileSystems[i].Value); } } throw new Exception("Unable to determine filesystem for path: " + aPath); }
public override Directory GetDirectory(string aPath) { FatHelpers.Debug("In SentinelVFS.GetDirectory"); var xFS = GetFileSystemFromPath(aPath); if (xFS == null) { FatHelpers.Debug("No FS found for path!"); } else { FatHelpers.Debug("Filesystem found."); } return(DoGetDirectory(aPath, xFS)); }
public static string ReadAllText(string aFile) { FatHelpers.Debug("In FileImpl.ReadAllText"); using (var xFS = new FileStream(aFile, FileMode.Open)) { var xBuff = new byte[(int)xFS.Length]; var xResult = xFS.Read(xBuff, 0, xBuff.Length); if (xResult != xBuff.Length) { throw new Exception("Couldn't read complete file!"); } FatHelpers.Debug("Bytes read"); var xResultStr = xBuff.GetUtf8String(0, (uint)xBuff.Length); FatHelpers.Debug("ResultString retrieved"); return(xResultStr); } }
public static bool FileExists(string aPath) { try { FatHelpers.Debug("In VFSManager.FileExists"); var xFile = VFSManager.TryGetFile(aPath); return(xFile != null); } catch (Exception E) { // don't ever remove this method, even if it doesn't contain any code! FatHelpers.Debug("Exception occurred in VFSManager.FileExists: "); // don't ever remove this method, even if it doesn't contain any code! FatHelpers.Debug(E.Message); return(false); } }
public static int GetRootLength(string aPath) { FatHelpers.Debug("In PathImpl.GetRootLength"); CheckInvalidPathChars(aPath, false); FatHelpers.Debug("Checked for invalid path characters"); FatHelpers.Debug("String length = " + aPath.Length); int i = 0; int length = aPath.Length; if (length >= 1 && IsDirectorySeparator(aPath[0])) { i = 1; if (length >= 2 && IsDirectorySeparator(aPath[1])) { i = 2; int num = 2; while (i < length) { if ((aPath[i] == VFSManager.GetDirectorySeparatorChar() || aPath[i] == VFSManager.GetAltDirectorySeparatorChar()) && --num <= 0) { break; } i++; } } } else { if (length >= 2 && aPath[1] == VFSManager.GetVolumeSeparatorChar()) { FatHelpers.Debug("Taking the '2' path"); i = 2; if (length >= 3 && IsDirectorySeparator(aPath[2])) { i++; } } } return(i); }
protected virtual void InitializePartitions() { for (int i = 0; i < BlockDevice.Devices.Count; i++) { var xBlockDevice = BlockDevice.Devices[i]; FatHelpers.Debug("BlockDevice found: "); FatHelpers.Debug(xBlockDevice.ToString()); var xItem = xBlockDevice as Partition; if (xItem == null && xBlockDevice.ToString() == "Partition") { FatHelpers.Debug("BlockDevice returns partition, but type check doesn't work!"); } else { FatHelpers.Debug("Partition found"); } xItem = xBlockDevice as Partition; if (xItem != null) { FatHelpers.Debug("Adding partition to list"); mPartitions.Add(xItem); break; } } if (mPartitions.Count > 0) { for (int i = 0; i < mPartitions.Count; i++) { FatHelpers.Debug("Partition #: " + (i + 1)); FatHelpers.Debug("Block Size: " + mPartitions[i].BlockSize + " bytes"); FatHelpers.Debug("Size: " + mPartitions[i].BlockCount * mPartitions[i].BlockSize / 1024 / 1024 + " MB"); } } else { FatHelpers.Debug("No partitions found!"); } }
public static string GetPathRoot(string aPath) { if (aPath == null) { return(null); } FatHelpers.Debug("In PathImpl.GetPathRoot"); aPath = NormalizePath(aPath, false); FatHelpers.Debug("Path normalized"); var xRootLength = GetRootLength(aPath); FatHelpers.Debug("RootLength retrieved"); FatHelpers.Debug("Value: " + xRootLength); var xResult = aPath.Substring(0, xRootLength); if (xResult[xResult.Length - 1] != Path.DirectorySeparatorChar) { FatHelpers.Debug("Adding directory separator"); xResult = String.Concat(xResult, Path.DirectorySeparatorChar); } return(xResult); }
public void SetFileLength(Base file, long value) { if (file == null) { throw new ArgumentNullException(nameof(file)); } FatHelpers.Debug("File.Name:"); FatHelpers.Debug(file.Name); var xIsFile = file is FatFile; var xIsDirectory = !xIsFile; using (var xDirectoryContents = new FatDirectoryStream((FatDirectory)file.BaseDirectory)) { FatHelpers.Debug("--SetFileLength"); FatHelpers.DebugNumber((uint)xDirectoryContents.Length); //TODO: Change xLongName to StringBuilder string xLongName = ""; string xName = ""; var xBuff = new byte[32]; while (xDirectoryContents.Position < xDirectoryContents.Length) { if (xDirectoryContents.Read(xBuff, 0, 32) != 32) { throw new Exception("Unable to read 32 bytes from stream!"); } FatHelpers.DevDebug("-------------------------------------------------"); byte xAttrib = xBuff[11]; byte xStatus = xBuff[0]; FatHelpers.DevDebug("Attrib = " + xAttrib.ToString() + ", Status = " + xStatus); if (xAttrib == DirectoryEntryAttributeConsts.LongName) { byte xType = xBuff[12]; byte xOrd = xBuff[0]; FatHelpers.DevDebug("Reading LFN with Seqnr " + xOrd.ToString() + ", Type = " + xType); if (xOrd == 0xE5) { FatHelpers.DevDebug("Skipping deleted entry"); continue; } if (xType == 0) { if ((xOrd & 0x40) > 0) { xLongName = ""; } //TODO: Check LDIR_Ord for ordering and throw exception // if entries are found out of order. // Also save buffer and only copy name if a end Ord marker is found. string xLongPart = xBuff.GetUtf16String(0 + 1, 5); // We have to check the length because 0xFFFF is a valid Unicode codepoint. // So we only want to stop if the 0xFFFF is AFTER a 0x0000. We can determin // this by also looking at the length. Since we short circuit the or, the length // is rarely evaluated. if (xBuff.ToUInt16(0 + 14) != 0xFFFF || xLongPart.Length == 5) { xLongPart = xLongPart + xBuff.GetUtf16String(0 + 14, 6); if (xBuff.ToUInt16(0 + 28) != 0xFFFF || xLongPart.Length == 11) { xLongPart = xLongPart + xBuff.GetUtf16String(0 + 28, 2); } } xLongName = xLongPart + xLongName; xLongPart = null; //TODO: LDIR_Chksum } } else { xName = xLongName; if (xStatus == 0x00) { // Empty slot, and no more entries after this break; } else if (xStatus == 0x05) { // Japanese characters - We dont handle these } else if (xStatus == 0xE5) { // Empty slot, skip it } else if (xStatus >= 0x20) { if (xLongName.Length > 0) { // Leading and trailing spaces are to be ignored according to spec. // Many programs (including Windows) pad trailing spaces although it // it is not required for long names. // As per spec, ignore trailing periods xName = xLongName.Trim(); //If there are trailing periods int nameIndex = xName.Length - 1; if (xName[nameIndex] == '.') { //Search backwards till we find the first non-period character for (; nameIndex > 0; nameIndex--) { if (xName[nameIndex] != '.') { break; } } //Substring to remove the periods xName = xName.Substring(0, nameIndex + 1); } xLongName = ""; } else { string xEntry = xBuff.GetAsciiString(0, 11); xName = xEntry.Substring(0, 8).TrimEnd(); string xExt = xEntry.Substring(8, 3).TrimEnd(); if (xExt.Length > 0) { xName = xName + "." + xExt; } } } } UInt32 xFirstCluster = (UInt32)(xBuff.ToUInt16(0 + 20) << 16 | xBuff.ToUInt16(0 + 26)); var xTest = xAttrib & (DirectoryEntryAttributeConsts.Directory | DirectoryEntryAttributeConsts.VolumeID); if (xAttrib == DirectoryEntryAttributeConsts.LongName) { // skip adding, as it's a LongFileName entry, meaning the next normal entry is the item with the name. FatHelpers.Debug("Entry was an Long FileName entry. Current LongName = '" + xLongName + "'"); } else if (xTest == 0) { if (xIsFile && String.Equals(file.Name, xName, StringComparison.OrdinalIgnoreCase)) { // found, now update size and write back xBuff.SetUInt32(28, (uint)value); xDirectoryContents.Position -= 32; xDirectoryContents.Write(xBuff, 0, 32); FatHelpers.Debug("--- File size changed!"); return; } } else if (xTest == DirectoryEntryAttributeConsts.Directory) { if (xIsDirectory && String.Equals(file.Name, xName, StringComparison.OrdinalIgnoreCase)) { xBuff.SetUInt32(28, (uint)value); xDirectoryContents.Position -= 32; xDirectoryContents.Write(xBuff, 0, 32); FatHelpers.Debug("--- Directory size changed!"); return; } } else if (xTest == DirectoryEntryAttributeConsts.VolumeID) { FatHelpers.DevDebug("Directory entry is VolumeID"); // } else { FatHelpers.DevDebug("Not sure what to do!"); } } } throw new Exception("Unable to find the file entry!"); }
private List <Base> ReadDirectoryContents(byte[] xData) { var xResult = new List <Base>(); //TODO: Change xLongName to StringBuilder string xLongName = ""; string xName = ""; for (UInt32 i = 0; i < xData.Length; i = i + 32) { FatHelpers.Debug("-------------------------------------------------"); byte xAttrib = xData[i + 11]; byte xStatus = xData[i]; FatHelpers.Debug("Attrib = " + xAttrib.ToString() + ", Status = " + xStatus); if (xAttrib == DirectoryEntryAttributeConsts.LongName) { byte xType = xData[i + 12]; byte xOrd = xData[i]; FatHelpers.Debug("Reading LFN with Seqnr " + xOrd.ToString() + ", Type = " + xType); if (xOrd == 0xE5) { FatHelpers.Debug("Skipping deleted entry"); continue; } if (xType == 0) { if ((xOrd & 0x40) > 0) { xLongName = ""; } //TODO: Check LDIR_Ord for ordering and throw exception // if entries are found out of order. // Also save buffer and only copy name if a end Ord marker is found. string xLongPart = xData.GetUtf16String(i + 1, 5); // We have to check the length because 0xFFFF is a valid Unicode codepoint. // So we only want to stop if the 0xFFFF is AFTER a 0x0000. We can determin // this by also looking at the length. Since we short circuit the or, the length // is rarely evaluated. if (xData.ToUInt16(i + 14) != 0xFFFF || xLongPart.Length == 5) { xLongPart = xLongPart + xData.GetUtf16String(i + 14, 6); if (xData.ToUInt16(i + 28) != 0xFFFF || xLongPart.Length == 11) { xLongPart = xLongPart + xData.GetUtf16String(i + 28, 2); } } xLongName = xLongPart + xLongName; xLongPart = null; //TODO: LDIR_Chksum } } else { xName = xLongName; if (xStatus == 0x00) { // Empty slot, and no more entries after this break; } else if (xStatus == 0x05) { // Japanese characters - We dont handle these } else if (xStatus == 0xE5) { // Empty slot, skip it } else if (xStatus >= 0x20) { if (xLongName.Length > 0) { // Leading and trailing spaces are to be ignored according to spec. // Many programs (including Windows) pad trailing spaces although it // it is not required for long names. // As per spec, ignore trailing periods xName = xLongName.Trim(); //If there are trailing periods int nameIndex = xName.Length - 1; if (xName[nameIndex] == '.') { //Search backwards till we find the first non-period character for (; nameIndex > 0; nameIndex--) { if (xName[nameIndex] != '.') { break; } } //Substring to remove the periods xName = xName.Substring(0, nameIndex + 1); } xLongName = ""; } else { string xEntry = xData.GetAsciiString(i, 11); xName = xEntry.Substring(0, 8).TrimEnd(); string xExt = xEntry.Substring(8, 3).TrimEnd(); if (xExt.Length > 0) { xName = xName + "." + xExt; } } } } UInt32 xFirstCluster = (UInt32)(xData.ToUInt16(i + 20) << 16 | xData.ToUInt16(i + 26)); var xTest = xAttrib & (DirectoryEntryAttributeConsts.Directory | DirectoryEntryAttributeConsts.VolumeID); if (xAttrib == DirectoryEntryAttributeConsts.LongName) { // skip adding, as it's a LongFileName entry, meaning the next normal entry is the item with the name. FatHelpers.Debug("Entry was an Long FileName entry. Current LongName = '" + xLongName + "'"); } else if (xTest == 0) { UInt32 xSize = xData.ToUInt32(i + 28); if (xSize == 0 && xName.Length == 0) { continue; } xResult.Add(new FatFile(this, xName, xSize, xFirstCluster)); FatHelpers.Debug("Returning file '" + xName + "'"); } else if (xTest == DirectoryEntryAttributeConsts.Directory) { UInt32 xSize = xData.ToUInt32(i + 28); var xFatDirectory = new FatDirectory(this, xName, xFirstCluster); FatHelpers.Debug("Returning directory '" + xFatDirectory.Name + "', FirstCluster = " + xFirstCluster); xResult.Add(xFatDirectory); } else if (xTest == DirectoryEntryAttributeConsts.VolumeID) { FatHelpers.Debug("Directory entry is VolumeID"); // } else { FatHelpers.Debug("Not sure what to do!"); } } return(xResult); }
protected void Write(byte[] aBuffer, long aOffset, long aCount) { if (aCount < 0) { throw new ArgumentOutOfRangeException("aCount"); } if (aOffset < 0) { throw new ArgumentOutOfRangeException("aOffset"); } if (aBuffer == null || aBuffer.Length - aOffset < aCount) { throw new ArgumentException("Invalid offset length!"); } ulong xCount = (ulong)aCount; var xCluster = mFS.NewClusterArray(); UInt32 xClusterSize = mFS.BytesPerCluster; long xTotalLength = (long)(mPosition + xCount); if (xTotalLength > Length) { SetLength(xTotalLength); } while (xCount > 0) { long xWriteSize; UInt64 xClusterIdx = mPosition / xClusterSize; UInt64 xPosInCluster = mPosition % xClusterSize; if (xPosInCluster + xCount > xClusterSize) { xWriteSize = (long)(xClusterSize - xPosInCluster - 1); } else { xWriteSize = (long)xCount; } mFS.ReadCluster(xClusterIdx, xCluster); FatHelpers.Debug("Writing to cluster idx"); Debugger.DoSendNumber((uint)xClusterIdx); FatHelpers.Debug("Writing to pos in cluster"); Debugger.DoSendNumber((uint)xPosInCluster); FatHelpers.Debug("Offset"); Debugger.DoSendNumber((uint)aOffset); FatHelpers.Debug("xWriteSize"); Debugger.DoSendNumber((uint)xWriteSize); FatHelpers.Debug("First byte"); Debugger.DoSendNumber((uint)aBuffer[0]); Array.Copy(aBuffer, aOffset, xCluster, (long)xPosInCluster, xWriteSize); mFS.WriteCluster((ulong)mFatTable[(int)xClusterIdx], xCluster); aOffset += xWriteSize; xCount -= (ulong)xWriteSize; } mPosition += (ulong)aOffset; }
// This plug basically forwards all calls to the $$InnerStream$$ stream, which is supplied by the file system. // public static unsafe void Ctor(String aThis, [FieldAccess(Name = "$$Storage$$")]ref Char[] aStorage, Char[] aChars, int aStartIndex, int aLength, public static void Ctor(IO::FileStream aThis, string aPathname, IO::FileMode aMode, [FieldAccess(Name = "$$InnerStream$$")] ref IO::Stream innerStream) { FatHelpers.Debug("In FileStream.Ctor"); innerStream = InitializeStream(aPathname, aMode); }