internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, uint aValue) { if (mParent != null) { var xData = ((FatDirectoryEntry)mParent).GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; xValue.SetUInt32(0, aValue); uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); Global.mFileSystemDebugger.SendInternal($"FatDirectoryEntry.SetDirectoryEntryMetadataValue : DataLength = {aEntryMetadata.DataLength}"); Global.mFileSystemDebugger.SendInternal($"FatDirectoryEntry.SetDirectoryEntryMetadataValue : DataOffset = {aEntryMetadata.DataOffset}"); Global.mFileSystemDebugger.SendInternal($"FatDirectoryEntry.SetDirectoryEntryMetadataValue : EntryHeaderDataOffset = {mEntryHeaderDataOffset}"); Global.mFileSystemDebugger.SendInternal($"FatDirectoryEntry.SetDirectoryEntryMetadataValue : TotalOffset = {offset}"); Global.mFileSystemDebugger.SendInternal($"FatDirectoryEntry.SetDirectoryEntryMetadataValue : aValue = {aValue}"); ((FatDirectoryEntry)mParent).SetDirectoryEntryData(xData); } } else { throw new Exception("Root directory metadata can not be changed using the file stream."); } }
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, uint aValue) { if (mParent != null) { var xData = mParent.GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; xValue.SetUInt32(0, aValue); uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); FileSystemHelpers.Debug("SetDirectoryEntryMetadataValue: DataLength =", aEntryMetadata.DataLength); FileSystemHelpers.Debug("SetDirectoryEntryMetadataValue: DataOffset =", aEntryMetadata.DataOffset); FileSystemHelpers.Debug("SetDirectoryEntryMetadataValue: EntryHeaderDataOffset =", mEntryHeaderDataOffset); FileSystemHelpers.Debug("SetDirectoryEntryMetadataValue: TotalOffset =", offset); FileSystemHelpers.Debug("SetDirectoryEntryMetadataValue: aValue =", aValue); mParent.SetDirectoryEntryData(xData); } } else { throw new Exception("Root directory metadata can not be changed using the file stream."); } }
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, long aValue) { Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetDirectoryEntryMetadataValue(long) --"); Global.mFileSystemDebugger.SendInternal("aValue ="); Global.mFileSystemDebugger.SendInternal(aValue); if (mParent != null) { var xData = ((FatDirectoryEntry)mParent).GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; xValue.SetUInt32(0, (uint)aValue); uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; Global.mFileSystemDebugger.SendInternal("offset ="); Global.mFileSystemDebugger.SendInternal(offset); //TODO: .Net Core //Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); Array.Copy(xValue, 0, xData, (int)offset, (int)aEntryMetadata.DataLength); ((FatDirectoryEntry)mParent).SetDirectoryEntryData(xData); } } else { throw new Exception("Root directory metadata can not be changed using the file stream."); } }
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, string aValue) { Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetDirectoryEntryMetadataValue(string) --"); Global.mFileSystemDebugger.SendInternal($"aValue = {aValue}"); if (IsRootDirectory()) { throw new Exception("Root directory metadata can not be changed using the file stream."); } var xData = ((FatDirectoryEntry)mParent).GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; var bValue = Encoding.UTF8.GetBytes(aValue); for (int i = 0; i < xValue.Length; i++) { if (i < bValue.Length) { xValue[i] = bValue[i]; } else { xValue[i] = 32; } } uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); ((FatDirectoryEntry)mParent).SetDirectoryEntryData(xData); } }
internal void SetLongFilenameEntryMetadataValue(uint aEntryHeaderDataOffset, FatDirectoryEntryMetadata aEntryMetadata, uint aValue) { Global.mFileSystemDebugger.SendInternal(" -- FatDirectoryEntry.SetLongFilenameEntryMetadataValue(uint) --"); Global.mFileSystemDebugger.SendInternal("aValue = " + aValue); var xData = GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; xValue.SetUInt32(0, aValue); uint offset = aEntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, (int)offset, (int)aEntryMetadata.DataLength); SetDirectoryEntryData(xData); } }
internal void SetLongFilenameEntryMetadataValue(uint aEntryHeaderDataOffset, FatDirectoryEntryMetadata aEntryMetadata, string aValue) { Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetLongFilenameEntryMetadataValue(string) --"); Global.mFileSystemDebugger.SendInternal("aValue = " + aValue); var xData = GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = Encoding.Unicode.GetBytes(aValue); uint offset = aEntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, (int)offset, (int)aEntryMetadata.DataLength); SetDirectoryEntryData(xData); } }
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, string aValue) { Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetDirectoryEntryMetadataValue(string) --"); Global.mFileSystemDebugger.SendInternal("aValue ="); Global.mFileSystemDebugger.SendInternal(aValue); var xData = ((FatDirectoryEntry)mParent).GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; xValue = aValue.GetUtf8Bytes(0, aEntryMetadata.DataLength); uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); ((FatDirectoryEntry)mParent).SetDirectoryEntryData(xData); } }
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, byte aValue) { Global.mFileSystemDebugger.SendInternal(" -- FatDirectoryEntry.SetDirectoryEntryMetadataValue(uint) --"); Global.mFileSystemDebugger.SendInternal("aValue = " + aValue); if (IsRootDirectory()) { throw new Exception("Root directory metadata can not be changed using the file stream."); } var xData = ((FatDirectoryEntry)mParent).GetDirectoryEntryData(); if (xData.Length > 0) { uint xOffset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; xData[xOffset] = aValue; ((FatDirectoryEntry)mParent).SetDirectoryEntryData(xData); } }
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, uint aValue) { Global.mFileSystemDebugger.SendInternal(" -- FatDirectoryEntry.SetDirectoryEntryMetadataValue(uint) --"); Global.mFileSystemDebugger.SendInternal("aValue = " + aValue); if (IsRootDirectory()) { throw new Exception("Root directory metadata can not be changed using the file stream."); } var xData = ((FatDirectoryEntry)mParent).GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; xValue.SetUInt32(0, aValue); uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); ((FatDirectoryEntry)mParent).SetDirectoryEntryData(xData); } }
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, string aValue) { var xData = mParent.GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; xValue = aValue.GetUtf8Bytes(0, aEntryMetadata.DataLength); uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); FileSystemHelpers.Debug("SetDirectoryEntryMetadataValue: DataLength =", aEntryMetadata.DataLength); FileSystemHelpers.Debug("SetDirectoryEntryMetadataValue: DataOffset =", aEntryMetadata.DataOffset); FileSystemHelpers.Debug("SetDirectoryEntryMetadataValue: EntryHeaderDataOffset =", mEntryHeaderDataOffset); FileSystemHelpers.Debug("SetDirectoryEntryMetadataValue: TotalOffset =", offset); FileSystemHelpers.Debug("SetDirectoryEntryMetadataValue: aValue =", aValue); mParent.SetDirectoryEntryData(xData); } }
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, string aValue) { var xData = mParent.GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; xValue = aValue.GetUtf8Bytes(0, aEntryMetadata.DataLength); uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); Global.mFileSystemDebugger.SendInternal($"FatDirectoryEntry.SetDirectoryEntryMetadataValue : DataLength = {aEntryMetadata.DataLength}"); Global.mFileSystemDebugger.SendInternal($"FatDirectoryEntry.SetDirectoryEntryMetadataValue : DataOffset = {aEntryMetadata.DataOffset}"); Global.mFileSystemDebugger.SendInternal($"FatDirectoryEntry.SetDirectoryEntryMetadataValue : EntryHeaderDataOffset = {mEntryHeaderDataOffset}"); Global.mFileSystemDebugger.SendInternal($"FatDirectoryEntry.SetDirectoryEntryMetadataValue : TotalOffset = {offset}"); Global.mFileSystemDebugger.SendInternal($"FatDirectoryEntry.SetDirectoryEntryMetadataValue : aValue = {aValue}"); mParent.SetDirectoryEntryData(xData); } }
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntryMetadata aEntryMetadata, ulong aValue) { Global.mFileSystemDebugger.SendInternal("-- FatDirectoryEntry.SetDirectoryEntryMetadataValue(ulong) --"); Global.mFileSystemDebugger.SendInternal("aValue ="); Global.mFileSystemDebugger.SendInternal(aValue); if (mParent != null) { var xData = ((FatDirectoryEntry)mParent).GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; xValue.SetUInt64(0, aValue); uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; Global.mFileSystemDebugger.SendInternal("offset ="); Global.mFileSystemDebugger.SendInternal(offset); Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); ((FatDirectoryEntry)mParent).SetDirectoryEntryData(xData); } } else { throw new Exception("Root directory metadata can not be changed using the file stream."); } }
internal void SetDirectoryEntryMetadataValue(FatDirectoryEntry aDirectoryEntry, FatDirectoryEntryMetadata aEntryMetadata, string aValue) { var xData = GetDirectoryEntryData(aDirectoryEntry.Parent); if (xData.Length > 0) { byte[] xValue = new byte[aEntryMetadata.DataLength]; xValue = aValue.ToString().GetUtf8Bytes(0, aEntryMetadata.DataLength); uint offset = aDirectoryEntry.EntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); FatHelpers.Debug("SetDirectoryEntryMetadataValue: DataLength = " + aEntryMetadata.DataLength); FatHelpers.Debug("SetDirectoryEntryMetadataValue: DataOffset = " + aEntryMetadata.DataOffset); FatHelpers.Debug("SetDirectoryEntryMetadataValue: EntryHeaderDataOffset = " + aDirectoryEntry.EntryHeaderDataOffset); FatHelpers.Debug("SetDirectoryEntryMetadataValue: TotalOffset = " + offset); FatHelpers.Debug("SetDirectoryEntryMetadataValue: aValue = " + aValue); for (int i = 0; i < xValue.Length; i++) { FatHelpers.DebugNumber(xValue[i]); } SetDirectoryEntryData(aDirectoryEntry.Parent, xData); } }
internal void SetDirectoryEntryMetadataValue( FatDirectoryEntryMetadata aEntryMetadata, string aValue) { var xData = mParent.GetDirectoryEntryData(); if (xData.Length > 0) { var xValue = new byte[aEntryMetadata.DataLength]; xValue = aValue.GetUtf8Bytes(0, aEntryMetadata.DataLength); uint offset = mEntryHeaderDataOffset + aEntryMetadata.DataOffset; Array.Copy(xValue, 0, xData, offset, aEntryMetadata.DataLength); //FatHelpers.Debug("SetDirectoryEntryMetadataValue: DataLength = " + aEntryMetadata.DataLength); //FatHelpers.Debug("SetDirectoryEntryMetadataValue: DataOffset = " + aEntryMetadata.DataOffset); //FatHelpers.Debug("SetDirectoryEntryMetadataValue: EntryHeaderDataOffset = " + mEntryHeaderDataOffset); //FatHelpers.Debug("SetDirectoryEntryMetadataValue: TotalOffset = " + offset); //FatHelpers.Debug("SetDirectoryEntryMetadataValue: aValue = " + aValue); //for (int i = 0; i < xValue.Length; i++) //{ // FatHelpers.DebugNumber(xValue[i]); //} mParent.SetDirectoryEntryData(xData); } }