Esempio n. 1
0
 /// <summary>
 /// Gets up case table.
 /// </summary>
 /// <returns></returns>
 public ExFatUpCaseTable GetUpCaseTable()
 {
     if (_upCaseTable == null)
     {
         _upCaseTable = new ExFatUpCaseTable();
         var upCaseTableEntry = FindRootDirectoryEntries <UpCaseTableExFatDirectoryEntry>().FirstOrDefault();
         if (upCaseTableEntry != null)
         {
             using (var upCaseTableStream = OpenDataStream(upCaseTableEntry.DataDescriptor, FileAccess.Read))
                 _upCaseTable.Read(upCaseTableStream);
         }
         else
         {
             _upCaseTable.SetDefault();
         }
     }
     return(_upCaseTable);
 }
Esempio n. 2
0
        private static void CreateUpCaseTable(ExFatPartition partition, Stream directoryStream)
        {
            var upCaseTable = new ExFatUpCaseTable();

            upCaseTable.SetDefault();
            partition._upCaseTable = upCaseTable;
            var    upCaseTableDataDescriptor = new DataDescriptor(0, false, long.MaxValue, long.MaxValue);
            long   length;
            UInt32 checksum;

            using (var upCaseStream = partition.OpenClusterStream(upCaseTableDataDescriptor, FileAccess.ReadWrite, d => upCaseTableDataDescriptor = d))
            {
                checksum = upCaseTable.Write(upCaseStream);
                length   = upCaseStream.Position;
            }

            var upCaseTableEntry = new UpCaseTableExFatDirectoryEntry(new Buffer(new byte[32]));

            upCaseTableEntry.EntryType.Value     = ExFatDirectoryEntryType.UpCaseTable | ExFatDirectoryEntryType.InUse;
            upCaseTableEntry.TableChecksum.Value = checksum;
            upCaseTableEntry.FirstCluster.Value  = (uint)upCaseTableDataDescriptor.FirstCluster.Value;
            upCaseTableEntry.DataLength.Value    = (ulong)length;
            upCaseTableEntry.Write(directoryStream);
        }