Example #1
0
        public static DirectoryNode Load([NotNull] Address address, [NotNull] MasterRecord record, [NotNull] IDirectDiskAccess diskAccess)
        {
            Validate.ArgumentNotNull(address, "address");
            Validate.ArgumentNotNull(record, "record");
            Validate.ArgumentNotNull(diskAccess, "diskAccess");

            var node = new DirectoryNode(record, address, diskAccess);
            node.Load();
            return node;
        }
Example #2
0
        public static DirectoryNode Create([CanBeNull] DirectoryNode parent, [NotNull] Address address, [NotNull] MasterRecord record, [NotNull] IDirectDiskAccess diskAccess)
        {
            Validate.ArgumentNotNull(address, "address");
            Validate.ArgumentNotNull(record, "record");
            Validate.ArgumentNotNull(diskAccess, "diskAccess");

            var node = new DirectoryNode(record, address, diskAccess);
            using (NodeLocker.Lock(node, true))
            {
                node.AddChildEntry(SpecialNameCurrentDir, true, node.Address); // self
                if (parent != null)
                {
                    node.AddChildEntry(SpecialNameNavigateUp, true, parent.Address); // parent
                }

                node.Save();
                return node;
            }
        }