Exemplo n.º 1
0
        /// <summary>
        /// Constructor used to create a new FileNode object with a specified ID.
        /// </summary>
        /// <param name="collection">Collection that this FileNode object will be associated with.</param>
        /// <param name="parentNode">The DirNode object that will be the parent to this object.</param>
        /// <param name="fileName">Friendly name of the FileNode object.</param>
        /// <param name="fileID">Globally unique identifier for the FileNode object.</param>
        public FileNode(Collection collection, DirNode parentNode, string fileName, string fileID) :
            base(collection, parentNode.GetFullPath(collection), fileName, fileID, NodeTypes.FileNodeType)
        {
            // Set the in-memory path that is only valid until this object has been committed.
            path = Path.Combine(parentNode.GetFullPath(collection), fileName);

            // Set the relative path for this directory.
            properties.AddNodeProperty(PropertyTags.FileSystemPath, parentNode.GetRelativePath() + "/" + fileName);

            // Set the parent attribute.
            properties.AddNodeProperty(PropertyTags.Parent, new Relationship(collection.ID, parentNode.ID));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor used to create a new DirNode object with a specified ID.
        /// </summary>
        /// <param name="collection">Collection that this DirNode object will be associated with.</param>
        /// <param name="parentNode">The DirNode object that will be the parent to this object or null
        /// if this directory exists at the collection root.</param>
        /// <param name="dirName">Name of the directory entry.</param>
        /// <param name="dirID">Globally unique identifier for the directory entry.</param>
        public DirNode(Collection collection, DirNode parentNode, string dirName, string dirID) :
            base(dirName, dirID, NodeTypes.DirNodeType)
        {
            // Set the in-memory path that is only valid until this object has been committed.
            path = Path.Combine(parentNode.GetFullPath(collection), dirName);

            // Set the relative path for this directory.
            properties.AddNodeProperty(PropertyTags.FileSystemPath, parentNode.GetRelativePath() + "/" + dirName);

            // Set the parent attribute.
            properties.AddNodeProperty(PropertyTags.Parent, new Relationship(collection.ID, parentNode.ID));

            // Set the create time for the directory.
            if (Directory.Exists(path))
            {
                properties.AddNodeProperty(PropertyTags.CreationTime, Directory.GetCreationTime(path));
            }
        }