示例#1
0
        internal static FatFile Get(Fat fat, FatDirectoryEntry entry)
        {
            if (entry.IsDirectory())
            {
                throw new ArgumentException(entry + " is a directory");
            }

            var cc = new ClusterChain(
                fat, entry.GetStartCluster(), entry.IsReadonlyFlag());

            if (entry.GetLength() > cc.GetLengthOnDisk())
            {
                throw new IOException(
                          "entry is larger than associated cluster chain");
            }

            return(new FatFile(entry, cc));
        }
示例#2
0
        /// <summary>
        /// Returns the length of this file in bytes. This is the length that
        /// is stored in the directory entry that is associated with this file.
        /// </summary>
        /// <returns>long the length that is recorded for this file</returns>
        public long GetLength()
        {
            CheckValid();

            return(entry.GetLength());
        }