示例#1
0
 protected internal virtual FileRecord GetFileRecord(MftSegmentReference fileReference)
 {
     lock (m_mftLock)
     {
         return(m_mft.GetFileRecord(fileReference));
     }
 }
示例#2
0
        protected internal virtual FileRecord GetFileRecord(MftSegmentReference fileReference)
        {
            m_mftLock.AcquireReaderLock(Timeout.Infinite);
            FileRecord fileRecord = m_mft.GetFileRecord(fileReference);

            m_mftLock.ReleaseReaderLock();
            return(fileRecord);
        }
示例#3
0
        public FileRecord GetFileRecord(string path)
        {
            if (path != String.Empty && !path.StartsWith(@"\"))
            {
                throw new ArgumentException("Invalid path");
            }

            if (path.EndsWith(@"\"))
            {
                path = path.Substring(0, path.Length - 1);
            }

            if (path == String.Empty)
            {
                return(m_mft.GetFileRecord(MasterFileTable.RootDirSegmentNumber));
            }

            string[] components             = path.Substring(1).Split('\\');
            long     directorySegmentNumber = MasterFileTable.RootDirSegmentNumber;

            for (int index = 0; index < components.Length; index++)
            {
                KeyValuePairList <MftSegmentReference, FileNameRecord> records = GetFileNameRecordsInDirectory(directorySegmentNumber);
                if (index < components.Length - 1)
                {
                    FileRecord record = FindDirectoryRecord(records, components[index]);
                    if (record != null)
                    {
                        directorySegmentNumber = record.MftSegmentNumber;
                    }
                    else
                    {
                        return(null);
                    }
                }
                else // last component
                {
                    return(FindRecord(records, components[index]));
                }
            }

            return(null);
        }