Beispiel #1
0
        private static ClusterChainDirectory Read(FatDirectoryEntry entry, Fat fat)
        {
            if (!entry.IsDirectory())
            {
                throw
                    new ArgumentException(entry + " is no directory");
            }

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

            var result =
                new ClusterChainDirectory(chain, false);

            result.Read();
            return(result);
        }
Beispiel #2
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));
        }