コード例 #1
0
        /// <summary>
        /// Adds a file to the file system.
        /// </summary>
        /// <param name="path">The full path to the file.</param>
        /// <param name="contentPath">Local file system path to the file to add.</param>
        /// <param name="user">The owner of the file.</param>
        /// <param name="group">The group of the file.</param>
        /// <param name="permissions">The access permission of the file.</param>
        /// <param name="modificationTime">The modification time of the file</param>
        /// <remarks>
        /// <para>Any missing parent directories will be created with the specified owner and group,
        /// default directory permissions and the current time as the modification time.</para>
        /// </remarks>
        public void AddFile(string path, string contentPath, int user, int group, UnixFilePermissions permissions, DateTime modificationTime)
        {
            BuilderFile file = new BuilderFile(contentPath);

            file.UserId           = user;
            file.GroupId          = group;
            file.Mode             = permissions;
            file.ModificationTime = modificationTime;

            BuilderDirectory dirNode = CreateDirectory(
                Utilities.GetDirectoryFromPath(path),
                user,
                group,
                DefaultDirectoryPermissions);

            dirNode.AddChild(Utilities.GetFileFromPath(path), file);
        }
コード例 #2
0
        /// <summary>
        /// Adds a file to the file system.
        /// </summary>
        /// <param name="path">The full path to the file.</param>
        /// <param name="contentPath">Local file system path to the file to add.</param>
        /// <param name="user">The owner of the file.</param>
        /// <param name="group">The group of the file.</param>
        /// <param name="permissions">The access permission of the file.</param>
        /// <param name="modificationTime">The modification time of the file</param>
        /// <remarks>
        /// <para>Any missing parent directories will be created with the specified owner and group,
        /// default directory permissions and the current time as the modification time.</para>
        /// </remarks>
        public void AddFile(string path, string contentPath, int user, int group, UnixFilePermissions permissions, DateTime modificationTime)
        {
            BuilderFile file = new BuilderFile(contentPath);
            file.UserId = user;
            file.GroupId = group;
            file.Mode = permissions;
            file.ModificationTime = modificationTime;

            BuilderDirectory dirNode = CreateDirectory(
                Utilities.GetDirectoryFromPath(path),
                user,
                group,
                DefaultDirectoryPermissions);
            dirNode.AddChild(Utilities.GetFileFromPath(path), file);
        }