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); }
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)); }