public FatDirectoryEntry CreateSub(Fat fat)
        {
            var chain = new ClusterChain(fat, false);

            chain.SetChainLength(1);

            var entry = FatDirectoryEntry.Create(true);

            entry.SetStartCluster(chain.GetStartCluster());

            var dir =
                new ClusterChainDirectory(chain, false);

            /* add "." entry */

            var dot = FatDirectoryEntry.Create(true);

            dot.SetShortName(ShortName.Dot);
            dot.SetStartCluster(dir.GetStorageCluster());
            CopyDateTimeFields(entry, dot);
            dir.AddEntry(dot);

            /* add ".." entry */

            var dotDot = FatDirectoryEntry.Create(true);

            dotDot.SetShortName(ShortName.DotDot);
            dotDot.SetStartCluster(GetStorageCluster());
            CopyDateTimeFields(entry, dotDot);
            dir.AddEntry(dotDot);

            dir.Flush();

            return(entry);
        }
Exemple #2
0
        internal FatLfnDirectoryEntry(string name, ShortName sn, FatLfnDirectory parent, bool directory) : base(false)
        {
            this.parent = parent;
            fileName    = name;

            var now = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;

            RealEntry = FatDirectoryEntry.Create(directory);
            RealEntry.SetShortName(sn);
            RealEntry.SetCreated(now);
            RealEntry.SetLastAccessed(now);
        }