public FatStream(FatDirectoryEntry aEntry) { mDirectoryEntry = aEntry; mFS = mDirectoryEntry.GetFileSystem(); mSize = mDirectoryEntry.mSize; if (mDirectoryEntry.mSize > 0) { mFatTable = mDirectoryEntry.GetFatTable(); } }
/// <summary> /// Set the length of the stream. /// </summary> /// <param name="value">Stream length.</param> /// <exception cref="Exception"> /// <list type="bullet"> /// <item>Thrown when trying to change root directory matadata.</item> /// <item>data size invalid.</item> /// <item>invalid directory entry type.</item> /// <item>FAT table not found.</item> /// <item>out of memory.</item> /// <item>invalid aData size.</item> /// </list> /// </exception> /// <exception cref="OverflowException">Thrown when data lenght is greater then Int32.MaxValue.</exception> /// <exception cref="ArgumentNullException"> /// <list type="bullet"> /// <item>Thrown when entrys aValue is null.</item> /// <item>Thrown when entrys aData is null.</item> /// <item>Out of memory.</item> /// </list> /// </exception> /// <exception cref="RankException">Thrown on fatal error (contact support).</exception> /// <exception cref="ArrayTypeMismatchException">Thrown on fatal error (contact support).</exception> /// <exception cref="InvalidCastException">Thrown when the data in aValue is corrupted.</exception> /// <exception cref="ArgumentOutOfRangeException"> /// <list type = "bullet" > /// <item>Thrown when the data length is 0 or greater then Int32.MaxValue.</item> /// <item>Entrys matadata offset value is invalid.</item> /// <item>Thrown when aSize is smaller than 0.</item> /// </list> /// </exception> /// <exception cref="ArgumentException"> /// <list type="bullet"> /// <item>Thrown when aName is null or empty string.</item> /// <item>aData length is 0.</item> /// <item>FAT type is unknown.</item> /// </list> /// </exception> /// <exception cref="NotSupportedException">Thrown when FAT type is unknown.</exception> public override void SetLength(long value) { Global.mFileSystemDebugger.SendInternal("-- FatStream.SetLength --"); Global.mFileSystemDebugger.SendInternal("value ="); Global.mFileSystemDebugger.SendInternal(value); Global.mFileSystemDebugger.SendInternal("mFatTable.Length ="); Global.mFileSystemDebugger.SendInternal(mFatTable.Length); mDirectoryEntry.SetSize(value); mSize = value; mFatTable = mDirectoryEntry.GetFatTable(); }
public FatStream(FatDirectoryEntry aEntry) { mDirectoryEntry = aEntry ?? throw new ArgumentNullException(nameof(aEntry)); mFS = aEntry.GetFileSystem(); mFatTable = aEntry.GetFatTable(); mSize = aEntry.mSize; if (mFatTable == null) { throw new Exception("The fat chain returned for the directory entry was null."); } }
public FatStream(FatDirectoryEntry aEntry) { Global.mFileSystemDebugger.SendInternal("FatStream with entry " + aEntry); mDirectoryEntry = aEntry; mFS = mDirectoryEntry.GetFileSystem(); mSize = mDirectoryEntry.mSize; if (mDirectoryEntry.mSize > 0) { mFatTable = mDirectoryEntry.GetFatTable(); } }
public FatStream(FatDirectoryEntry aEntry) { Global.mFileSystemDebugger.SendInternal("FatStream.Ctor"); mDirectoryEntry = aEntry; mFS = mDirectoryEntry.GetFileSystem(); mSize = mDirectoryEntry.mSize; Global.mFileSystemDebugger.SendInternal("mSize ="); Global.mFileSystemDebugger.SendInternal(mSize.ToString()); // We get always the FatTable if the file is empty too mFatTable = mDirectoryEntry.GetFatTable(); // What to do if this should happen? Throw exception? if (mFatTable == null) { Global.mFileSystemDebugger.SendInternal("FatTable got but it is null!"); } }